Search code examples
pythonpython-3.xbashpython-poetry

Poetry was not installed with the recommended installer. Cannot update automatically


How to I upgrade to the latest version?

Specification:

  • Windows 10,
  • Visual Studio Code,
  • Ubuntu Bash.

Current Version:

me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ python3 --version
Python 3.8.10

Attempt to update | poetry self update:

me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ poetry self update

  RuntimeError

  Poetry was not installed with the recommended installer. Cannot update automatically.

  at ~/.local/lib/python3.8/site-packages/poetry/console/commands/self/update.py:389 in _check_recommended_installation
      385│         current = Path(__file__)
      386│         try:
      387│             current.relative_to(self.home)
      388│         except ValueError:
    → 389│             raise RuntimeError(
      390│                 "Poetry was not installed with the recommended installer. "
      391│                 "Cannot update automatically."
      392│             )
      393│

Please let me know if there is anything else I can add to post.


Solution

  • The error message suggests you've probably installed poetry with pip, which does not support automatic poetry updates. You should uninstall the poetry version currently installed, and reinstall it using the recommended method, which uses a custom installation script.

    On osx/linux, you'll just have to run curl -sSL https://install.python-poetry.org | python3 - to download and run this installation script.