Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip installing fails if numpy is not already installed #170

Closed
jdavidheiser opened this issue Jun 14, 2017 · 4 comments · Fixed by #171
Closed

pip installing fails if numpy is not already installed #170

jdavidheiser opened this issue Jun 14, 2017 · 4 comments · Fixed by #171

Comments

@jdavidheiser
Copy link

Since setup.py tries to import numpy before even defining any dependencies, it's possible for the numpy import to be attempted before the dependencies trigger installing numpy. This made it difficult to install fastparquet as part of a larger requirements.txt.

@martindurant
Copy link
Member

Yes, I can see how that might be a problem. Can you think of a way around it?

jjhelmus added a commit to jjhelmus/fastparquet that referenced this issue Jun 16, 2017
Allow fastparquet to be installed when NumPy and Cython are not already
installed. pip attempts to run `python setup.py egg_info` to detemine the
install requirements.  Allow this command and other non-build related commands
to be run without importing numpy or cython.

closes dask#170
@jbrockmendel
Copy link

Just ran into this problem. An issue over in pip has a discussion about this that mentioned bottleneck. bottleneck has a solution that includes a comment crediting stackoverflow.

# workaround for installing bottleneck when numpy is not present
class build_ext(_build_ext):
    # taken from: stackoverflow.com/questions/19919905/
    # how-to-bootstrap-numpy-installation-in-setup-py#21621689
    def finalize_options(self):
        _build_ext.finalize_options(self)
        # prevent numpy from thinking it is still in its setup process
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        # place numpy includes first, see gh #156
        self.include_dirs.insert(0, numpy.get_include())

@martindurant
Copy link
Member

@jjhelmus , your solution appears to work; is there any benefit to the one above mentioned by @jbrockmendel ?

@jjhelmus
Copy link

I believe that the solution suggested by @jdavidheiser and in the stack overflow post works around the numpy dependency but Cython would need to be install before calling setup.py or pip. The stack overflow comments mention this limitation and do not offer a work around.

The solution in #171 works by examining the command line arguments which allows pip to be run without NumPy or Cython installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants