poetry: ModuleNotFoundError: No module named 'cleo' after poetry self:update

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: GNU/Linux 4.18.7-1-default, openSUSE Tumbleweed
  • Poetry version: 0.12.4
  • Link of a Gist with the contents of your pyproject.toml file: Irrelevant

Issue

I have updated poetry using the command:

$ poetry self:update
Updating to 0.12.4                                                                                                                                                      
  - Getting dependencies
  - Vendorizing dependencies
  - Updating poetry

poetry (0.12.4) successfully installed!

Then if run any command I get this:

$ poetry -vvv --version
Traceback (most recent call last):
  File "/home/rominf/.local/bin/poetry", line 7, in <module>
    from poetry.console import main
  File "/home/rominf/.pyenv/versions/3.6.5/envs/pendulum/lib/python3.6/site-packages/poetry/console/__init__.py", line 1, in <module>                                  
    from .application import Application
  File "/home/rominf/.pyenv/versions/3.6.5/envs/pendulum/lib/python3.6/site-packages/poetry/console/application.py", line 6, in <module>                               
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

I have tried to install cleo with pip, but it didn’t help. The only thing that helped me is the poetry installation using pip.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 43 (6 by maintainers)

Most upvoted comments

I leave this comment in here because it was the first search result I got: If you are running on Wndows 10 + Python 3.8, then you need to install the preview version that contains a fix for the issue:

Delete the installation removing the .poetry folder from C:\Users\<your user>

Then run this command: curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | POETRY_PREVIEW=1 python

Or, in PowerShell, you can run this:

Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -OutFile get-poetry.py
python .\get-poetry.py --preview
Remove-Item .\get-poetry.py
$env:Path += ";$env:USERPROFILE\.poetry\bin"

@PRINCEOYEBOLA since poetry 1.1.12 is missing some dependencies in python3.10.1 on Windows. You may work around by installing them pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile

Just documenting that I was having the same problem, even after upgrading poetry. As I just had installed python 3.8, I had to make

cp -r $HOME/.poetry/lib/poetry/_vendor/py3.7 $HOME/.poetry/lib/poetry/_vendor/py3.8

to be able to run poetry correctly. Now it is fine!

Edit: removed sudo. Thanks @sthysel!

I just did rm -rf ~/.poetry and that solved the issue.

Did you upgrade with self:update from version 0.11.5? I think this must be it and it is not supported as explained in the release notes.

You might want to uninstall poetry completely and reinstall with the recommended installer.

curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

install poetry with pipx fixed pipx install poetry

Removing poetry and re-installing with the new Poetry script did the trick for me on macOS

Remove poetry rm `which poetry`

Install poetry with the new script curl -sSL https://install.python-poetry.org | python3 -

Just pasting a note here that trying to use Python-3.9 hits same error with poetry==1.0.0 ~ poetry==1.0.3

Solved by pushd ~/.poetry/lib/poetry/_vendor/; ln -s py3.8 py3.9 Followed by collections.abc fix.

@crgarcia12 Had the same problem on Arch Linux, the fix worked there too 🎉

@PRINCEOYEBOLA since poetry 1.1.12 is missing some dependencies in python3.10.1 on Windows. You may work around by installing them pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile

Thanks. I dont totally get why this is necesarry all of a sudden… I did not read all post… When installing above dependencies, poetry shell still did not work. In order to fix that I needed to also install pexpect and shellingham, so the complete list will be: pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile pexpect shellingham

had the issue and the fix for me was to stop using the older install as mentioned in this stackoverflow answer https://stackoverflow.com/a/69152670/2128265

Since I rely on a feature that is currently broken in poetry v1.0-beta (poetry config settings.virtualenvs.in-project true) I ended up having to downgrade Python from 3.8 to 3.7.4.

The syntax has changed to poetry config virtualenvs.in-project true

Just documenting that I was having the same problem, even after upgrading poetry. As I just had installed python 3.8, I had to make

sudo cp -r $HOME/.poetry/lib/poetry/_vendor/py3.7 $HOME/.poetry/lib/poetry/_vendor/py3.8

to be able to run poetry correctly. Now it is fine!

That is for linux and mac, for windows you still need the preview 😢

I had this problem a few days ago, and I’ve tried to solve it. I have made a docker container that has poetry and python 3.10 installed. I think I figured out all the missing modules that poetry needs, so I also made a list to install them using pip on your personal computer. My repository is: https://github.com/Mapachana/Python-3.10-with-poetry And the docker image can be found here: https://hub.docker.com/repository/docker/mapachana/python3.10-with-poetry

@sdispater, OK, thanks. Didn’t read the release notes. Can you handle this in the future and give the user installation instructions if poetry can’t be updated the normal way?

Just chiming in to say that the pip install fix above also works for Windows 11!

If you are running into this with poetry 1.1.12 and python 3.10, this may also help.

For me, changing the python version back to 3.9.7 fixed the issued. I was running poetry in a Docker container. Using this as the base fixed it:

FROM python:3.9.7-bullseye
...

I just experienced this issue while setting up a new dev environment in a Windows 10 machine.

Since I rely on a feature that is currently broken in poetry v1.0-beta (poetry config settings.virtualenvs.in-project true) I ended up having to downgrade Python from 3.8 to 3.7.4.