Git Product home page Git Product logo

Comments (10)

khaledhosny avatar khaledhosny commented on April 28, 2024

How are you building with pip? I do pip install -e . routinely and had no issue with it.

from brotli.

anthrotype avatar anthrotype commented on April 28, 2024

I know, but that only runs python setup develop for testing a package while developing it.
The problem arises when doing pip install ., without the -e option.
If you look at the traceback, the reason why pip fails is because it cannot find the C/C++ sources, since they are referenced using a relative path which is "above" the setup.py working directory:

$ pip install .
Processing /Users/cosimolupo/Documents/Github/brotli/python
Installing collected packages: Brotli
  Running setup.py install for Brotli
    clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DOS_MACOSX=1 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.c -o build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.o
    clang: error: no such file or directory: '/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.c'
    clang: error: no input files
    error: command 'clang' failed with exit status 1
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/pip-oaQuzp-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/pip-R4EIB0-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_ext

    creating build

    creating build/temp.macosx-10.9-x86_64-2.7

    creating build/temp.macosx-10.9-x86_64-2.7/private

    creating build/temp.macosx-10.9-x86_64-2.7/private/var

    creating build/temp.macosx-10.9-x86_64-2.7/private/var/folders

    creating build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w

    creating build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn

    creating build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T

    creating build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec

    clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DOS_MACOSX=1 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.c -o build/temp.macosx-10.9-x86_64-2.7/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.o

    clang: error: no such file or directory: '/private/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/dec/bit_reader.c'

    clang: error: no input files

    error: command 'clang' failed with exit status 1

    ----------------------------------------
    Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/pip-oaQuzp-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/pip-R4EIB0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/1w/6098jtks69sgwz0vtz2ysmsm0000gn/T/pip-oaQuzp-build

from brotli.

khaledhosny avatar khaledhosny commented on April 28, 2024

I think we need to fix sdist command, since it seems not to copy any of the Brotli source files. If this does not fix pip, it will at least allow uploading to PyPI.

from brotli.

anthrotype avatar anthrotype commented on April 28, 2024

I'll have look at sdist.
The thing is, the way pip (but also distutils, setuptools, etc.) expects python packages to be organised is with a setup.py at the root of the package, and then everything else positioned either on the same level or inside sub-folders reachable from the root. Whereas here we want to keep the python folder isolated from the C/C++ source files, which is understandable, but this seems to conflict with the way Python packaging works. Maybe the solution could simply be to clone brotli as a submodule in another repository with a copy of setup.py positioned higher in the directory tree.

from brotli.

khaledhosny avatar khaledhosny commented on April 28, 2024

Maybe the solution could simply be to clone brotli as a submodule in another repository with a copy of setup.py positioned higher in the directory tree.

That is how it was done originally :)

from brotli.

anthrotype avatar anthrotype commented on April 28, 2024

yes, I do remember.

from brotli.

khaledhosny avatar khaledhosny commented on April 28, 2024

Thinking about it more, I think it shouldn’t harm to move the setup.py file to the top level directory, and leave the C file where it is, if it will simplify things.

from brotli.

anthrotype avatar anthrotype commented on April 28, 2024

It would definitely make the Python extension's setup much easier.

On Tue, Mar 31, 2015 at 8:42 AM, Khaled Hosny [email protected]
wrote:

Thinking about it more, I think it shouldn’t harm to move the setup.py file to the top level directory, and leave the C file where it is, if it will simplify things.

Reply to this email directly or view it on GitHub:
#52 (comment)

from brotli.

szabadka avatar szabadka commented on April 28, 2024

If it involves just the setup.py file, it should be ok to have it in the top-level directory.

from brotli.

anthrotype avatar anthrotype commented on April 28, 2024

I can confirm pip is happy after 5e3e97e

from brotli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.