You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ModuleNotFoundError: No module named 'numpy' - heroku deployment #11
Hi, I'm deploying a web app to heroku and the app seems to require python-javabridge (not javabridge). As it tries to download python-javabridge-4.0.0.tar.gz to its server, I get the error:
remote: Collecting python-javabridge==4.0.0
remote: Downloading python-javabridge-4.0.0.tar.gz (1.3 MB)
remote: ERROR: Command errored out with exit status 1:
remote: command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-um4hs34c/python-javabridge/setup.py'"'"'; __file__='"'"'/tmp/pip-install-um4hs34c/python-javabridge/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bn8fvmq1
remote: cwd: /tmp/pip-install-um4hs34c/python-javabridge/
remote: Complete output (7 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-install-um4hs34c/python-javabridge/setup.py", line
412, in <module>
remote: ext_modules=ext_modules(),
remote: File "/tmp/pip-install-um4hs34c/python-javabridge/setup.py", line
100, in ext_modules
remote: from numpy import get_include
remote: ModuleNotFoundError: No module named 'numpy'
remote: ----------------------------------------
remote: ERROR: Command errored out with exit status 1: python setup.py egg_info
Check the logs for full command output.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
I read around this error and it seems to be a common issue that the get_include function is called from the setup.py file of a package before numpy has been installed, however, I am not sure how to fix it myself (or to verify this is indeed the problem here). Of course I have pip installed numpy and python-javabridge on my local machine and this works fine, but not sure what happens when it tries to install it on the heroku server. I'm using Anaconda 3 Python 3.7 and Spyder IDE (and Spyder terminal for the commands).
It looks like this issue was initially fixed (by the upstream repo) in e9fe3dc but accidentally re-introduced by 7cd83b7. The result does not work prpoerly with the in-built Python distutils.
By first installing setuptools and numpy (pip install setuptools numpy) I am able to cleanly install python-javabridge with pip. Installing setuptools may be unnecessary if #17 is landed, but pre-installing numpy still seems to be required (for some reason). A starting-point for proper PEP 621 setup can be found in #18
Errors when installing via poetry still cause headaches highly similar to this one - I would be curious if #18 would solve this.
Please, is there any chance you could review this @bethac07?
Activity
BjarneHerland commentedon Sep 20, 2022
It looks like this issue was initially fixed (by the upstream repo) in e9fe3dc but accidentally re-introduced by 7cd83b7. The result does not work prpoerly with the in-built Python
distutils.By first installing
setuptoolsandnumpy(pip install setuptools numpy) I am able to cleanly installpython-javabridgewith pip. Installingsetuptoolsmay be unnecessary if #17 is landed, but pre-installingnumpystill seems to be required (for some reason). A starting-point for proper PEP 621 setup can be found in #18m-martin-j commentedon Jan 4, 2023
Errors when installing via poetry still cause headaches highly similar to this one - I would be curious if #18 would solve this.
Please, is there any chance you could review this @bethac07?
otchita-waiv commentedon Jul 24, 2023
Hello,
Has this issue been solved ?
orgonth commentedon Sep 12, 2023
Same issue (python 3.8 and 3.9), running
pip install numpyfirst does not help.The only way I could complete the install was reverting to an older version of pip:
sebnarvaez19 commentedon Jul 9, 2024
I had the same issue with Python 3.12, but using Python 3.10 I handled it