In the middle of the desert you can say anything you want

16 Oct 2023

poetry and pyenv

When trying to use pyenv to use python 3.10 in my new poetry project, got issues, one of them being basically this: ModuleNotFoundError: No module named ‘cleo’ after poetry self:update · Issue #553 · python-poetry/poetry

Reinstalling alone didn’t help, had to delete the poetry dir too.

So solution:

# pyenv local 3.10.0 but shouldn't matter

# delete the poetry directory completely
rm -rf ~/.poetry
# reinstall it 
curl -sSL | python3 -
# in my project - 
poetry env use 3.10
# poetry shell, poetry install - works!

The poetry docu on poetry+pyenv: Managing environments | Documentation | Poetry - Python dependency management and packaging made easy

> poetry env use 3.10.0
# has to be available in $PATH I think..
> poetry env info

Python:         3.10.0
Implementation: CPython
Path:           /home/sh/uuni/master/code/up_crawler/.venv
Executable:     /home/sh/uuni/master/code/up_crawler/.venv/bin/python
Valid:          True

Platform:   linux
OS:         posix
Python:     3.10.0
Path:       /home/sh/.pyenv/versions/3.10.0
Executable: /home/sh/.pyenv/versions/3.10.0/bin/python3.10
14:02:42 ~/uuni/master/code/up_crawler/ 0
> python3
Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

It lies about the system one, and it’s not the initial pyenv local 3.10.0 setting, but I don’t care - it works :sparkles:

Nel mezzo del deserto posso dire tutto quello che voglio.