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 install fails when numpy is not installed #50

Open
pypae opened this issue May 15, 2019 · 1 comment
Open

Pip install fails when numpy is not installed #50

pypae opened this issue May 15, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pypae
Copy link

pypae commented May 15, 2019

pip install git+git://github.com/uzhdag/pathpy.git fails with error message:

ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\patrick\AppData\Local\Temp\pip-req-build-rc8ef3uw\setup.py", line 7, in <module>
        from pathpy import __version__
      File "C:\Users\patrick\AppData\Local\Temp\pip-req-build-rc8ef3uw\pathpy\__init__.py", line 10, in <module>
        from .classes import *
      File "C:\Users\patrick\AppData\Local\Temp\pip-req-build-rc8ef3uw\pathpy\classes\__init__.py", line 5, in <module>
        from .paths import Paths
      File "C:\Users\patrick\AppData\Local\Temp\pip-req-build-rc8ef3uw\pathpy\classes\paths.py", line 30, in <module>
        import numpy as np
    ModuleNotFoundError: No module named 'numpy'
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\patrick\AppData\Local\Temp\pip-req-build-rc8ef3uw\

This is caused by setup.py importing __version__ from the package directly and therefore loading numpy which is not yet installed.

Could use a sperate file __version__.py with a __version__ variable and then load it like:

here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(here, NAME, '__version__.py')) as f:
    exec(f.read(), about)
...
setup(
  ...
  version = about['__version__']
  ...
)

To avoid loading dependencies before they are actually installed.

@verginer verginer added the bug Something isn't working label May 20, 2019
@verginer verginer self-assigned this May 20, 2019
@verginer
Copy link
Member

Hi @PatDue, nice catch! I will look into it.
However the proposed solution would make the root directory even more cluttered and I would like to avoid it. As you have already pointed out, the error can be avoided by installing numpy before pathpy, which I think we should just add in the setup instructions.

L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants