Questions tagged [python-poetry]

Poetry is a Python tool to handle dependency installation, as well as the building and packaging of Python packages. Do NOT use this tag for poems written in the Python language, since this is off-topic on Stack Overflow.

Poetry is a Python tool to handle dependency installation as well as building and packaging of Python packages. Do not use this tag for poems written in Python language since this is off-topic on Stack Overflow.

What are the advantages of Poetry compared to other types of package management? From the documentation:

Packaging systems and dependency management in Python are rather convoluted and hard to understand for newcomers. Even for seasoned developers it might be cumbersome at times to create all files needed in a Python project: setup.py, requirements.txt, setup.cfg, MANIFEST.in and the newly added Pipfile.

So I wanted a tool that would limit everything to a single configuration file to do: dependency management, packaging and publishing.

It takes inspiration in tools that exist in other languages, like Composer (PHP) or Cargo (Rust).

And, finally, there is no reliable tool to properly resolve dependencies in Python, so I started poetry to bring an exhaustive dependency resolver to the Python community.

1108 questions
19
votes
1 answer

What files/directories should I add to .gitignore when using Poetry, the Python package manager?

I'm using a very new Python package manager called Poetry. It creates several files/directories upon creating a new project (environment), but I'm not sure which one I should add to .gitignore for the best practice. Say I create a new poetry…
user8491363
  • 2,924
  • 5
  • 19
  • 28
18
votes
2 answers

Error: Python packaging tool 'setuptools' not found

I have a poetry project that is not using setuptools [tool.poetry.dependencies] python = ">=3.9,<3.11" opencv-python = "^4.7.0.68" tensorflow-macos = "^2.11.0" tensorflow-metal = "^0.7.0" but I keep getting this error in pycharm. Command from…
mCs
  • 2,591
  • 6
  • 39
  • 66
18
votes
6 answers

poetry installation failing on Mac OS, says "should_use_symlinks"

I am trying to install poetry using the following command curl -sSL https://install.python-poetry.org | python3 - but it is failing with the following exception: Exception: This build of python cannot create venvs without using symlinks Below is…
17
votes
3 answers

What's the difference between extras and groups in poetry?

So far I have used poetry extras to install optional dependencies. For instance, in pyproject.toml I have defined [tool.poetry.dependencies] ... jupyter = { version = "^1.0.0", optional = true } [tool.poetry.extras] notebooks = ["jupyter"...] and…
dzieciou
  • 4,049
  • 8
  • 41
  • 85
17
votes
2 answers

How do I specify "extra" / bracket dependencies in a pyproject.toml?

I'm working on a project that specifies its dependencies using Poetry and a pyproject.toml file to manage dependencies. The documentation for one of the libraries I need suggests pip-installing with an "extra" option to one of the dependencies, like…
Sarah Messer
  • 3,592
  • 1
  • 26
  • 43
17
votes
1 answer

Poetry remove fails to remove any packages?

Poetry install: (installs dependencies) poetry show --tree black 20.8b1 The uncompromising code formatter. ├── appdirs * ├── click >=7.1.2 ├── mypy-extensions >=0.4.3 ├── pathspec >=0.6,<1 ├── regex >=2020.1.8 ├── toml >=0.10.1 ├── typed-ast…
Chris
  • 28,822
  • 27
  • 83
  • 158
17
votes
2 answers

What is the difference between `poetry lock` and `poetry update --lock`?

What is the difference between poetry update --lock and poetry lock? I wasn't able to find much useful hints in the official docs and I know that both are not the same since we recently had to switch from poetry update --lock to poetry lock for…
Arijit Basu
  • 171
  • 1
  • 1
  • 6
16
votes
2 answers

Poetry: Failed to unlock the collection

On a fresh poetry install, I get the following error trying to install anything: (base) ➜ celeba poetry add numpy Failed to unlock the collection! How can I fix this?
a06e
  • 18,594
  • 33
  • 93
  • 169
16
votes
4 answers

poetry install | SolverProblemError Because my_project depends on string (*) which doesn't match any versions, version solving failed

I am yet to use poetry to run project, so excuse lack of understanding. I successfully installed the poetry python library manager, using: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 Next step…
user16341274
16
votes
2 answers

How to deploy Python packages to Gitlab Package Registry with Poetry?

I'm trying to set up Poetry to deploy packages to our internal Gitlab Package Registry. According to other sources online the repository ID should be https://gitlab.com/api/v4/projects//packages/pypi, but no matter what I try, Poetry…
Jakob Vad Nielsen
  • 722
  • 1
  • 7
  • 13
16
votes
1 answer

How to use Cython with Poetry?

I have a file in my project which I would like to compile for performance reasons: mylibrary/myfile.py How to achieve this with Poetry?
kolypto
  • 31,774
  • 17
  • 105
  • 99
16
votes
5 answers

The virtual environment found seems to be broken | python poetry

I am following the following link to install RASA on my system: https://github.com/RasaHQ/rasa But unfortunately while trying to install the dependencies or any of the following poetry commands which are written in Makefile, $poetry run $poetry…
Kamaldeep Singh
  • 765
  • 2
  • 8
  • 28
15
votes
5 answers

Poetry fails with "Retrieved digest for package not in poetry.lock metadata"

We're trying to merge and old branch in a project and when trying to build a docker image, poetry seems to fail for some reason that I don't understand. I'm not very familiar with poetry, as I've only used requirements.txt for dependencies up to…
Basil
  • 313
  • 1
  • 2
  • 8
15
votes
1 answer

How to Configure Poetry Environments in Pycharm With Windows + WSL2?

TL;DR: can't configure a Python Interpreter on PyCharm (Windows) using an existing Poetry environment in WSL. When trying to set the Poetry environment path under Add Python Interpreter > Poetry Environment > Existing Environment, the needed Python…
aon
  • 362
  • 2
  • 10
15
votes
6 answers

Installing SQLAlchemy with Poetry causes an AttributeErrorr

When installing with pip, pip install sqlalchemy all is ok. When installing with poetry I am getting the error ➜ backend poetry add sqlalchemy Using version ^1.4.23 for SQLAlchemy Updating dependencies Resolving dependencies... (0.1s) …
Maksych
  • 153
  • 1
  • 4