1. Overview
In this short tutorial, we will cover how to install Poetry on Linux Mint or Ubuntu. Poetry is a dependency management tool for packaging in Python.
Similarly to pip it allows you to declare and project libraries. As a bonus it will install and update them for you.
2. Install Poetry on Linux Mint by script
Let's start by installing Poetry on Linux Mint by script - get-poetry.py
:
The output of the installation will be something like this:
Retrieving Poetry metadata
This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
$HOME/.poetry/bin
This path will then be added to your `PATH` environment variable by
modifying the profile files located at:
$HOME/.profile
$HOME/.bash_profile
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing version: 1.1.12
- Downloading poetry-1.1.12-linux.tar.gz (66.00MB)
Poetry (1.1.12) is installed now. Great!
To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source $HOME/.poetry/env`
Note: If you notice a warning like:
This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later
You can simply ignore it or check this issue: "This installer is deprecated" with recommended install
3. Install Poetry on Linux Mint by PIP
As an alternative we can install Poetry by PIP.
Since Python is pre-installed on Linux Mint and Ubuntu we can install PIP if needed:
sudo apt update
sudo apt install python3-pip
And then install Poetry by:
pip install --user poetry
Note: that it will install Poetry’s dependencies which might cause conflicts with other packages.
4. Verify the installation
To verify the installation we can run the following command:
$HOME/.poetry/bin
which will result in something like:
/home/van/.poetry/bin/poetry
5. Update Poetry
To update Poetry once it's installed we can use command like:
poetry self update
and to the check the installed version we can use:
poetry --version
result:
Poetry 1.1.12
If you like to update to specific version you can use the next syntax:
poetry self update 0.8.0
6. Conclusion
In this article we saw how to install the popular package manager Poetry on Linux Mint.
It covered how to verify the installation, check the version and update it.