fabianp / mord

Ordinal regression algorithms
Other
263 stars 71 forks source link

Unable to determine build deps if numpy not installed #15

Closed davidsmf closed 6 years ago

davidsmf commented 6 years ago

If you don't have numpy installed, setuptools can't parse setup.py. This is because there's import mord in the setup.py, which exectued mord/__init__.py, which imports mord/threshold_based.py, which imports numpy and failed.

Yes, it needs numpy to run, but pip can't determine that it needs numpy without having numpy already installed (note this is also true for scipy and sklearn).

I can't think of an easy fix that doesn't require having the version number in two places,

davids@davids:~$ mkvirtualenv test
Using base prefix '/usr'
New python executable in /home/davids/.virtualenvs/test/bin/python3
Also creating executable in /home/davids/.virtualenvs/test/bin/python
Installing setuptools, pip, wheel...done.
(test) davids@davids:~$ pip install mord
Collecting mord
  Downloading https://files.pythonhosted.org/packages/82/3f/f5689633bcde3fced1e50296e555cd67141e12a90499655f9dfc0771251d/mord-0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-hesxyg_3/mord/setup.py", line 2, in <module>
        import mord
      File "/tmp/pip-install-hesxyg_3/mord/mord/__init__.py", line 1, in <module>
        from .threshold_based import *
      File "/tmp/pip-install-hesxyg_3/mord/mord/threshold_based.py", line 7, in <module>
        import numpy as np
    ImportError: No module named 'numpy'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hesxyg_3/mord/

however

davids@davids:~$ mkvirtualenv test
Using base prefix '/usr'
New python executable in /home/davids/.virtualenvs/test/bin/python3
Also creating executable in /home/davids/.virtualenvs/test/bin/python
Installing setuptools, pip, wheel...done.
(test) davids@davids:~$ pip install numpy scipy scikit-learn
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/29/b9/479ccb55cc7dcff3d4fc7c8c26d4887846875e7d4f04483a36f335bed712/numpy-1.15.0-cp35-cp35m-manylinux1_x86_64.whl
Collecting scipy
  Using cached https://files.pythonhosted.org/packages/cd/32/5196b64476bd41d596a8aba43506e2403e019c90e1a3dfc21d51b83db5a6/scipy-1.1.0-cp35-cp35m-manylinux1_x86_64.whl
Collecting scikit-learn
  Using cached https://files.pythonhosted.org/packages/b6/e2/a1e254a4a4598588d4fe88b45ab88a226c289ecfd0f6c90474eb6a9ea6b3/scikit_learn-0.19.2-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: numpy, scipy, scikit-learn
Successfully installed numpy-1.15.0 scikit-learn-0.19.2 scipy-1.1.0
(test) davids@davids:~$ pip install mord
Collecting mord
  Downloading https://files.pythonhosted.org/packages/82/3f/f5689633bcde3fced1e50296e555cd67141e12a90499655f9dfc0771251d/mord-0.5.tar.gz
Installing collected packages: mord
  Running setup.py install for mord ... done
Successfully installed mord-0.5
(test) davids@davids:~$