Python Poetry Install on Ubuntu/Debian

Posted on : 22nd Mar 2021

What is Poetry ?

Poetry is a dependency management tool for python. Similar to pip, you can use poetry to install and manage dependencies in your python project.

Poetry also has built-in support for packaging your python app and releasing it to PyPi (or to any other private repository). As of Mar 22, 2021, poetry is compatible with python3.5+ and supports Linux, OSX & Windows operating systems.

Why do we need Poetry ?

If you have tried packaging your app to release on PyPi, you must know the annoying process of manually creating the setup files. Well, poetry eliminates it (or... just makes it easier).

Other than that, poetry also removes the dependency of manually creating and updating the requirements.txt. Poetry does the package management with commands similar to npm and stores the package setup info and dependencies pyproject.toml file.

Long story short, with Poetry :

  1. Creating a requirements file, install latest available package and all package-dependencies is not your problem, poetry will take care of it.
  2. Crafting the required config for your package is done interactively at the time you initiate poetry in your project.

Installing Poetry

Poetry can be installed on Windows, Linux, OSX systems. We will install poetry on Linux for now.

Note : Make sure you have latest version of python installed on your system before proceeding ahead with the tutorial.

  1. We will first get the Poetry installer script from it's website and execute it with our local python installation. Open your terminal, and run the following command :
    curl -sSL | python -
  2. This will install poetry on your home directory. You can find the installed files here :
  3. Verify the installation with the following command :
    poetry --version

Installing Poetry with Pip

You can also install poetry using pip. But since I find poetry much easier to use, I will recommend using the previous step.

If that did not convince you and you still want to install poetry with pip, run the following command :
pip install --user poetry

and you are done! Woohoo!

© 2021, All Rights Reserved · Vipin Joshi