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.

the simplest 'poetry install' fails

See original GitHub issue

Working environment is Python 3.10.4 on Ubuntu 22.04 LTS

user@comp:~$ poetry config virtualenvs.in-project true
user@comp:~$ poetry new first
Created package first in first
user@comp:~$ cd first
user@comp:~/first$ poetry install
Creating virtualenv first in /home/user/first/.venv
Updating dependencies
Resolving dependencies... (3.6s)

Writing lock file

Package operations: 1 install, 7 updates, 0 removals

  • Updating pyparsing (2.4.7 /usr/lib/python3/dist-packages -> 3.0.8)
  • Updating attrs (21.4.0 /home/user/.local/lib/python3.10/site-packages -> 21.4.0)
  • Updating more-itertools (8.10.0 /usr/lib/python3/dist-packages -> 8.12.0)
  • Updating packaging (21.3 /home/user/.local/lib/python3.10/site-packages -> 21.3)
  • Updating pluggy (1.0.0 /home/user/.local/lib/python3.10/site-packages -> 0.13.1)
  • Updating py (1.11.0 /home/user/.local/lib/python3.10/site-packages -> 1.11.0)
  • Installing wcwidth (0.2.5)
  • Updating pytest (7.1.2 /home/user/.local/lib/python3.10/site-packages -> 5.4.3)

Installing the current project: first (0.1.0)  - Failed to create first.pth for /home/user/first
  - Failed to find a suitable script installation directory for /home/user/first

  OSError

  Unable to access any of "/usr/local/lib/python3.10/dist-packages/first-0.1.0.dist-info"

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:265 in _path_method_wrapper
       261│ 
       262│         if results:
       263│             return results
       264│ 
    →  265│         raise OSError("Unable to access any of {}".format(paths_csv(candidates)))
       266│ 
       267│     def write_text(self, path, *args, **kwargs):  # type: (Path, *Any, **Any) -> Path
       268│         return self._path_method_wrapper(path, "write_text", *args, **kwargs)[0]
       269│ 

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
refi64commented, Apr 29, 2022

I encountered the same issue, and I think some mix of the following fixed it:

  • Make sure the virtualenv package inside your Poetry venv is at least version 20.10.0, so it has this commit
  • rm -rf ~/.local/share/virtualenv/py_info/ to clear the cached path information

I believe this is a distro packaging bug (Fedora bug report). In my case, Fedora 36, changed the way it tried to install packages to /usr/local instead of /usr, but that broke venv creation. Although I have the fixed packages, I’m guessing that the cached path information still had the old values.

The related Python bug mentions Ubuntu, so they might have encountered a similar problem. If so, it worked in Docker because there was no virtualenv py_info cache there.

2reactions
jediecommented, Nov 13, 2022

I ran into the same problem. Work-a-round is to create the venv first, e.g.:

python3 -m venv .venv
poetry install

Then poetry used the existing .venv and the bug https://github.com/pypa/setuptools/issues/3278 didn’t happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python poetry install failure - invalid hashes - Stack Overflow
There are several issue reports about invalid hashes. One common cause is running multiple Poetry instances simultaneously; ...
Read more >
Repositories | Documentation | Poetry - Python dependency ...
By default, Poetry discovers and installs packages from PyPI. But, you want to install a dependency to your project for a simple API...
Read more >
Poetry installation fails on Ubuntu - command line
Poetry installation fails on Ubuntu · 1. you add PATH=$PATH:~/poetry/bin to path, but the path is ~/.poetry/bin ! – pLumo. Dec 2, 2021...
Read more >
A Poetic Apology - Mutt Data Blog
Imagine one lonely night you decide to start a simple dummy Python ... To address the first two issues, you first add the...
Read more >
Poetry install fails inside GitHub actions on a private repo
This makes it as easy as possible for people to read your post and help you. I think I have detected some formatting...
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