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

Created on 24 Oct 2018  路  14Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] 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.

Most helpful comment

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"

All 14 comments

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

@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?

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"

I have an docketing image with:

FROM alpine:edge
RUN apk add --no-cache alpine-sdk poetry --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

Which worked perfectly but now it fails. A couple days ago was ok. Something went wrong because I'm getting Cleo dependency missing.

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

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!

@lucastamoios works for me to, I'd get rid of the 'sudo' though.

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 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.

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

@finswimmer I tried again and here is what worked for me (Powershell@Windows10 + python 3.8.0 + poetry 1.0.0b5):

poetry config virtualenvs.in-project true
poetry update -vvv

Before (Powershell@Windows10 + python 3.7.4 + poetry 0.12.17):

poetry config settings.virtualenvs.in-project true
poetry -vvv update

Oops, of course without =.

Fixed it :laughing:

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"

this will break on Python 3.5

Installing version: 1.0.0b6
  - Downloading poetry-1.0.0b6-linux.tar.gz (27.81MB)

Poetry (1.0.0b6) is installed now. Great!

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run `source $HOME/.poetry/env`

Traceback (most recent call last):
  File "/root/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/root/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/root/.poetry/lib/poetry/console/application.py", line 1, in <module>
    from cleo import Application as BaseApplication
  File "/root/.poetry/lib/poetry/_vendor/py3.5/cleo/__init__.py", line 3, in <module>
    from .application import Application
  File "/root/.poetry/lib/poetry/_vendor/py3.5/cleo/application.py", line 4, in <module>
    from clikit.console_application import ConsoleApplication
  File "/root/.poetry/lib/poetry/_vendor/py3.5/clikit/__init__.py", line 1, in <module>
    from .api.config.application_config import ApplicationConfig
  File "/root/.poetry/lib/poetry/_vendor/py3.5/clikit/api/config/__init__.py", line 1, in <module>
    from .application_config import ApplicationConfig
  File "/root/.poetry/lib/poetry/_vendor/py3.5/clikit/api/config/application_config.py", line 6, in <module>
    from typing import ContextManager
ImportError: cannot import name 'ContextManager'
Exited with code 1

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhrmnn picture jhrmnn  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments

sobolevn picture sobolevn  路  3Comments

probablykasper picture probablykasper  路  3Comments

jbarlow83 picture jbarlow83  路  3Comments