Failed deploy ModuleNotFoundError: No module named 'numpy'

I deployed Streamlit via GitHub and found an error:
× Running setup.py install for lap did not run successfully.

│ Exit Code: 1

╰─> [13 lines of output]

Partial import of lap during the build process.

Traceback (most recent call last):

File “/tmp/pip-install-9d2mn9h6/lap_2426d6716df14c8d80cee36a28b45779/setup.py”, line 127, in get_numpy_status

import numpy

ModuleNotFoundError: No module named ‘numpy’

Even though in the requirements file.txt the numpy package has been installed, I attach here also the contents of the requirements file.txt
filterpy==1.4.5
lap==0.4.0
matplotlib==3.5.2
numpy==1.23.5
opencv_python==4.7.0.72
pafy==0.5.5
Pillow==9.5.0
scipy==1.8.1
streamlit==1.22.0
streamlit_with_ssl==1.15.2.1
ultralytics==8.0.93

Hey @Noer_Barrihadianto,

Thanks for sharing this question! Can you please update your post to include links to your app and GitHub repo as well so we can try to reproduce the error?

The problem is the lap package. It is quite old and the setup requires numpy to be installed prior to running pip. Unfortunately this will not work on streamlit cloud, because there is only a single step installation possible.

However there is a newer branch of lap on github which seems to fix this issue. Therefore you could replace the above line in requirements.txt with the line below and try again:

git+https://github.com/gatagat/lap@new-packaging

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.