Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 'No module named numpy' error while installing 'lap' module, how to fix it?

Tags:

python

Whenever I try to do pip install lap, it shows:

Collecting lap
  Using cached lap-0.4.0.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Partial import of lap during the build process.
      Traceback (most recent call last):
        File "<string>", line 127, in get_numpy_status
      ModuleNotFoundError: No module named 'numpy'
      Traceback (most recent call last):
        File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\HP\AppData\Local\Temp\pip-build-env-0s58xbp4\overlay\Lib\site-packages\setuptools\build_meta.py", line 380, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "C:\Users\HP\AppData\Local\Temp\pip-build-env-0s58xbp4\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\Users\HP\AppData\Local\Temp\pip-build-env-0s58xbp4\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 236, in <module>
        File "<string>", line 220, in setup_package
      ImportError: lap requires numpy, please "pip install numpy".
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have tried this on multiple computers but every single one of them showed the same error.

like image 239
Harshit Sahu Avatar asked Oct 27 '25 03:10

Harshit Sahu


1 Answers

It seems to be something related of how lap setup is made. Check: https://github.com/gatagat/lap/issues/38 The same happened to me, I found the solution doing the following:

The solution is to downgrade pip to a known pip version that works to install lap 0.4.0

python -m pip install pip==21.1.1

after that, you can just:

pip install lap==0.4.0
like image 79
Baifito Avatar answered Oct 29 '25 18:10

Baifito



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!