Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not install lap even numpy is installed #48

Open
drimyus opened this issue May 3, 2023 · 3 comments
Open

Can not install lap even numpy is installed #48

drimyus opened this issue May 3, 2023 · 3 comments

Comments

@drimyus
Copy link

drimyus commented May 3, 2023

I tried to run the lap package in virtual environment,

There was numpy installed already, but when I run the command line pip3 install lap, it failed with error message that numpy is required.

numpy==1.21.6
lap==0.4.0

I tried in python3.7, 3.8 and 3.9. Every time, I got same error message.

(venv_37) $ pip3 install lap
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 "/media/be/67F04CCE6BD713C5/Work/testproject/venv_37/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/media/be/67F04CCE6BD713C5/Work/testproject/venv_37/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/media/be/67F04CCE6BD713C5/Work/testproject/venv_37/lib/python3.7/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 "/tmp/pip-build-env-v8gwdupo/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-v8gwdupo/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 488, in run_setup
          self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-v8gwdupo/overlay/lib/python3.7/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.
@raphaelreme
Copy link

I don't really know if this is related but i had the same issue on a github workflow using the "setup-python" github action and lap (See the last commit of pylapy, which is a wrapper/benchmark around several lap-like libraries).

On my own laptop installing lap after numpy works, but with on the github workflow with the python installed by github it failed with the same error you have here (I don't know why...).

I solved it by using a virtualenv on github. Though, I think you already are using one here, so it may not be helpful... You can maybe try to go with a conda env (On my laptop with ubuntu, it works)

And if truly it does not work, you can try another lap lib:

  • lapjv - usually as fast as lap but no support for non-square matrix, non-linking, and inf cost
  • scipy - Easiest to install, a bit slower (but fine) though no support for non-square matrix, non-linking and inf cost
  • pylapy: My own wrapper of these libs -> I did some benchmark to optimize non-square matrix extension, non-linking cost and inf cost handling. It should also be more linter compliant. Though it is still in beta ;)

@gatagat These issues can probably be solved by merging one of the PR on the subject

@jchavesco
Copy link

If it helps anyone, I was running into the exact same issue when using the setup-python github action. I finally solved by installing the "wheel" package before installing lap (don't ask me why that works)

@raphaelreme
Copy link

Now for any installation issue I would advise to go with lapx.
(pip install lapx instead of pip install lap)

This is the same library but correctly deployed (Numpy is not required to be installed and it supports all recent python version > 3.7 or 3.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants