Traceback when calling "poetry" command: ModuleNotFoundError: No module named 'cachecontrol'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
poetry (Debian) |
Fix Released
|
Unknown
|
|||
poetry (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Jammy |
Fix Released
|
High
|
Unassigned | ||
Kinetic |
Fix Released
|
High
|
Unassigned |
Bug Description
I installed poetry via apt (on Jammy amd64) and when I try to call the program, I get:
$ poetry
Traceback (most recent call last):
File "/usr/bin/poetry", line 5, in <module>
from poetry.console import main
File "/usr/lib/
from .application import Application
File "/usr/lib/
from .commands.about import AboutCommand
File "/usr/lib/
from .check import CheckCommand
File "/usr/lib/
from poetry.factory import Factory
File "/usr/lib/
from .repositories.
File "/usr/lib/
from cachecontrol import CacheControl
ModuleNotFoundE
$ dpkg -l|grep python3-poetry
ii python3-poetry 1.1.12+dfsg-1 all Python dependency management and packaging made easy (Python 3)
ii python3-poetry-core 1.0.7-2 all Poetry PEP 517 Build Backend
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: python3-poetry 1.1.12+dfsg-1
ProcVersionSign
Uname: Linux 5.13.0-22-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu75
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: ubuntu:GNOME
Date: Tue Jan 18 10:49:59 2022
InstallationDate: Installed on 2020-12-08 (405 days ago)
InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Release amd64 (20201022)
PackageArchitec
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: poetry
UpgradeStatus: Upgraded to jammy on 2021-11-30 (49 days ago)
### SRU process ###
[Impact]
Problem: the python3-poetry package misses a run-time dependency on python3-
Result: the poetry program "crashes" on startup
Users expect packages from the official repository to work out of the box. This is not the case here as can be seen above unless the user happens to already have the python3-
The release in lunar was fixed through a later release in Debian and is not affected by this bug as can be verified from the Debian BTS.
[Test]
1) spin up a jammy virtual server or other test environment, no GUI is required.
2) "sudo apt purge python3-
3) "poetry" -> failure with current package
4) "sudo apt install python3-
5) "poetry" -> no more failure
[Regression potential]
The python3-
Changed in poetry (Debian): | |
status: | Unknown → New |
Changed in poetry (Debian): | |
status: | New → Fix Released |
description: | updated |
description: | updated |
description: | updated |
Changed in poetry (Ubuntu Jammy): | |
importance: | Undecided → High |
Changed in poetry (Ubuntu): | |
importance: | Undecided → High |
Changed in poetry (Ubuntu Jammy): | |
status: | New → Triaged |
Changed in poetry (Ubuntu Jammy): | |
status: | Triaged → In Progress |
Changed in poetry (Ubuntu Kinetic): | |
status: | New → Fix Committed |
status: | Fix Committed → In Progress |
Changed in poetry (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in poetry (Ubuntu Kinetic): | |
importance: | Undecided → High |
Thanks for taking your time to report this issue and help making Ubuntu better.
I can confirm I get the same error message when attempting to run poetry on Ubuntu Jammy. After some digging I found a corresponding bug report in Debian (see the attached bug watch), which also explains the root cause. Poetry has an odd dependency on "python3- cachecontrol (>= 0.12.6) | python3 (>> 3.6)", and since python3 is already installed it skips the cachecontrol package. Based on the upstream report, they are looking into how to get the dependencies generated properly.
Until then, you can install "python3- cachecontrol" manually as a workaround. After doing that, poetry now lists information on usage and seems to be working as expected.