question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fail to install using Poetry

See original GitHub issue

I’m trying to install this lib using poetry.

My pyproject.yml has two direct dependencies:

numpy = "1.18.4"
lap = "0.4.0"

But since lap also needs numpy, there’s no way to poetry to resolve dependencies without the lap mentioning that numpy is a install dependency.

I’ve found that this custom setup instructions is probably the issue, not compatible with the way poetry tries to install:

https://github.com/gatagat/lap/blob/ece5ee9d9876edfdcc770032fbdce66458c6b6a9/setup.py#L204-L222

Error:

❯ poetry add "lap[alldeps]"
Using version ^0.4.0 for lap

Updating dependencies
Resolving dependencies... (0.5s)


Package operations: 5 installs, 0 updates, 0 removals

  - Installing lap (0.4.0)

[EnvCommandError]
Command ['/home/fernando/.cache/pypoetry/virtualenvs/sM4e1v81-py3.7/bin/pip', 'install', '--no-deps', 'lap==0.4.0'] errored with the following return code 1, and output:
Collecting lap==0.4.0
  Using cached https://files.pythonhosted.org/packages/bf/64/d9fb6a75b15e783952b2fec6970f033462e67db32dc43dfbb404c14e91c2/lap-0.4.0.tar.gz
Installing collected packages: lap
  Running setup.py install for lap: started
    Running setup.py install for lap: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/fernando/.cache/pypoetry/virtualenvs/sM4e1v81-py3.7/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h0wwep35/lap/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h0wwep35/lap/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-fls2s3js/install-record.txt --single-version-externally-managed --compile --install-headers /home/fernando/.cache/pypoetry/virtualenvs/sM4e1v81-py3.7/include/site/python3.7/lap
         cwd: /tmp/pip-install-h0wwep35/lap/
    Complete output (12 lines):
    Partial import of lap during the build process.
    Traceback (most recent call last):
      File "/tmp/pip-install-h0wwep35/lap/setup.py", line 127, in get_numpy_status
        import numpy
    ModuleNotFoundError: No module named 'numpy'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-h0wwep35/lap/setup.py", line 236, in <module>
        setup_package()
      File "/tmp/pip-install-h0wwep35/lap/setup.py", line 220, in setup_package
        raise ImportError('lap requires numpy, '
    ImportError: lap requires numpy, please "pip install numpy".
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/fernando/.cache/pypoetry/virtualenvs/sM4e1v81-py3.7/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h0wwep35/lap/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h0wwep35/lap/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-fls2s3js/install-record.txt --single-version-externally-managed --compile --install-headers /home/fernando/.cache/pypoetry/virtualenvs/sM4e1v81-py3.7/include/site/python3.7/lap Check the logs for full command output.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
fgmacedocommented, Sep 7, 2021

Thanks @gatagat. I think that a quickly approach is to declare cython and numpy as explicit requirements using install_requires, I’ve forked the repo to not be blocked by this and it indeed solved the install issue. If you’re ok with this I’ll be glad to send a PR.

Let me know if you have any other suggestion.

Best regards!

1reaction
ligcommented, Aug 31, 2022

@fgmacedo do it 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running poetry install fails sometimes with new-installer #3336
Issue. At random, poetry install will fail with the following error. The package being installed by pip changes, but the brotli error ......
Read more >
Poetry install fails with EnvCommandError: looks for version ...
It installs just fine using plain old pip inside the environment poetry creates. cd project/ poetry shell pip install soupsieve # Installs 2.1 ......
Read more >
Dependency Management With Python Poetry
With the install command, Poetry checks your pyproject.toml file for dependencies then resolves and installs them. The resolving part is especially important ...
Read more >
Poetry installation fails on Ubuntu - command line
As of 22 Sep 2022, they recommend using the following command for Linux: curl -sSL https://install.python-poetry.org | python3 -.
Read more >
Python package installation issues with Poetry - Medium
My project.toml wanted to install scikit-learn v0.23.2 but somehow would fail with the following message every time i tried to run poetry update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found