Python Poetry: Cannot find beta versions of a package

Question:

I am trying to use SQLAlchemy 1.4 beta with Poetry. It is released on PyPi.

Poetry does not recognise the beta package in pyproject.toml:

[tool.poetry.dependencies]
SQLAlchemy = "^1.4.0b3"
poetry install
Installing dependencies from lock file

Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

  SolverProblemError

  Because ...  depends on SQLAlchemy (1.4.0b3) which doesn't match any versions, version solving failed.

How can I tell Poetry to fetch the beta versions of the package?

Asked By: Mikko Ohtamaa

||

Answers:

In your pyproject.toml you need to specify this dependency in a verbose form (more about it can be found here):

SQLAlchemy = {version = "^1.4.0b3"}

And then set the option allow-prereleases to true so your code would look like

SQLAlchemy = {version = "^1.4.0b3", allow-prereleases = true}

Alternatively you can add this dependency with a corresponding option usin CLI:

poetry add SQLAlchemy@^1.4.0b3 --allow-prereleases
Answered By: Teivaz

You can also do:

SQLAlchemy = {version = "^1.4.0*", allow-prereleases = true}
Answered By: Clintm
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.