Skip to content

Pip install fails when numpy is not installed #50

@pypae

Description

@pypae

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions