Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'cleo' #3071

Closed
3 tasks done
gh640 opened this issue Oct 4, 2020 · 20 comments
Closed
3 tasks done

ModuleNotFoundError: No module named 'cleo' #3071

gh640 opened this issue Oct 4, 2020 · 20 comments
Labels
kind/bug Something isn't working as expected

Comments

@gh640
Copy link

gh640 commented Oct 4, 2020

  • 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: Mac OS X / 10.14.6 / 18G5033
  • Poetry version: 1.1.0
  • Python version: 3.8

Issue

After updating poetry to 1.1.0 with poetry self update, it stopped working. I cannot run even poetry --version now.

$ poetry self update
Updating to 1.1.0
 - Downloading poetry-1.1.0-darwin.tar.gz 100%

Poetry (1.1.0) is installed now. Great!

$ poetry
Traceback (most recent call last):
  File "/Users/username/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/Users/username/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/Users/username/.poetry/lib/poetry/console/application.py", line 3, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

$ poetry --version
Traceback (most recent call last):
  File "/Users/username/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/Users/username/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/Users/username/.poetry/lib/poetry/console/application.py", line 3, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

I searched for an issue but couldn't find one. #2991 was for a different problem.

@gh640 gh640 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 4, 2020
@gh640
Copy link
Author

gh640 commented Oct 4, 2020

poetry -vvv generates the following output:

$ poetry -vvv
Traceback (most recent call last):
  File "/Users/username/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/Users/username/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/Users/username/.poetry/lib/poetry/console/application.py", line 3, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

@gh640
Copy link
Author

gh640 commented Oct 4, 2020

I needed to use Poetry soon and re-installed it.

python get-poetry.py --uninstall
python get-poetry.py

The error has gone.

I hope this helps other people.

@gh640 gh640 closed this as completed Oct 4, 2020
@laike9m
Copy link
Contributor

laike9m commented Oct 4, 2020

Same here

@Hultner
Copy link

Hultner commented Oct 10, 2020

I had to do the same thing after adding python 3.9 to my pyenv and update poetry, re-install was the only thing that would do it.

@MamadouSDiallo
Copy link

I had the same problem after updating to python 3.9 but the issue went away after "pip install --user poetry". Note that I use python through pyenv.

@paulmattheww
Copy link

I needed to use Poetry soon and re-installed it.

python get-poetry.py --uninstall
python get-poetry.py

The error has gone.

I hope this helps other people.

Of course you'll need the file as such

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

@laike9m
Copy link
Contributor

laike9m commented Sep 11, 2021

This still happens

@tomjohnburton
Copy link

I'm getting this error running ubuntu all of a sudden

@plyte
Copy link

plyte commented Oct 6, 2021

I'm getting this error running ubuntu all of a sudden

I'm getting the same after using:
curl -sSL --proxy $https_proxy https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

@tomjohnburton
Copy link

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

@plyte
Copy link

plyte commented Oct 6, 2021

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

Ah ok I'll give that shot. I've been using the python:slim container which I believe is on 3.9.5

@plyte
Copy link

plyte commented Oct 6, 2021

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

Ah ok I'll give that shot. I've been using the python:slim container which I believe is on 3.9.5

Looks like that fixed it! Thanks @tomjohnburton

@anpr
Copy link

anpr commented Dec 9, 2021

I use python with pyenv, and experienced the same issue if I tried to run poetry with Python 3.10.

I fixed it with

$ pyenv install 3.9.9   # if you haven't done so already
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > get-poetry.py
$ pyenv local 3.9.9
$ python get-poetry.py --uninstall
$ python get-poetry.py

Then I manually edited ~/.poetry/bin/poetry to use python 3.9.9 all the time:

#!/Users/anpr/.pyenv/versions/3.9.9/bin/python

Seems like a hack, and there is maybe a bug in poetry if it's run with Python 3.10?

@ben-hampson
Copy link

@anpr I struggled to get this working on Python 3.10 too. The following worked:

pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile

@nazmicancalik
Copy link

@ben-hampson Same for me. All of a sudden my poetry also stopped working, I was running system update on arch at the time and it updated python from 3.9 to 3.10 and I think this was the reason why it stopped working. I installed the required packages like you and it started working again.

@SamCrabtree
Copy link

@anpr I struggled to get this working on Python 3.10 too. The following worked:

pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile

Thank you @ben-hampson . After searching for a solution for over 2 hours this seemed to do the trick!

@moattarwork
Copy link

@anpr I struggled to get this working on Python 3.10 too. The following worked:
pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile

Thank you @ben-hampson . After searching for a solution for over 2 hours this seemed to do the trick!

It is working but if you spawn a new shell, that will be the same and you need to run the command again

@rosbly
Copy link

rosbly commented Jan 29, 2022

I got this error and though it was a bug, until I figured out I was within a Poetry shell/virtual env (which is automatically activated by Pycharm).

Everything works fine outside Poetry shell.

$ poetry run poetry --version
Traceback (most recent call last):
  File "/home/syr/.poetry/bin/poetry", line 17, in <module>
    from poetry.console import main
  File "/home/syr/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/syr/.poetry/lib/poetry/console/application.py", line 3, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

$ poetry --version
Poetry version 1.1.12

Maybe Poetry should do like Pipenv: detect this situation, print a warning, and execute outside the virtualenv?
This is very unlikely anyone would want to execute Poetry within Poetry (except maybe for Poetry developers, in which case some opt-in option could be handy).

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
@vuongtuha
Copy link

@ben-hampson thank you. Solve after 1 year!

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests