Skip to content Skip to sidebar Skip to footer

Poetry Can't Find Version Of Dependency Even Though It Exists

When bumping my python version from 3.7 to 3.8 in poetry, reinstalling all the dependencies fail with a version of the following: ERROR: No matching distribution found for... The

Solution 1:

There are two issues here which feed into each other. 1. poetry seems to consistently botch the upgrade of a venv when you modify the python versions. According to finswimmer, the upgrade should create a new virtual env for the new python version, however this process can fail when poetry uses the wrong pip version or loses track of which virtual env it's using. 2. poetry uses whatever pip is no questions asked - with no way to override and force usage of pip3.

Here are the distilled steps I used to solve this issue

  1. delete the virtual env ( sometimes poetry loses track of the venv/thinks it's already activated. Best to clear the slate )
rm -rf `poetry env list --full-path`
  1. create a new virtual env ( the command should fail, but the venv will be created )
poetry install
  1. manually activate the virtual env
source "$(poetry env list --full-path | tail -1 | sed 's/.\{12\}$//')/bin/activate"
  1. poetry install within the virtual env ( this ensures poetry is using the correct version of pip )
poetry install

Post a Comment for "Poetry Can't Find Version Of Dependency Even Though It Exists"