Search code examples
pythonubuntu-20.04python-poetry

Running poetry fails with /usr/bin/env: ‘python’: No such file or directory


I just installed poetry with the following install script

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

However, when I execute poetry it fails with the following error

$ poetry
/usr/bin/env: ‘python’: No such file or directory

I recently upgraded to ubuntu 20.04, is this an issue with the upgrade or with poetry?


Solution

  • poetry is dependent on whatever python is and doesn't attempt to use a specific version of python unless otherwise specified.

    The above issue will exist on ubuntu systems moving forward 20.04 onwards as python2.7 is deprecated and the python command does not map to python3.x

    You'll find specifying an alias for python to python3 won't work ( unless, perhaps you specify this in your bashrc instead of any other shell run command file ) as poetry spins it's own shell to execute commands.

    Install the following package instead

    sudo apt install python-is-python3
    

    It should be noted that you can install python2.7 if you want to and poetry should run fine.