Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83768

Python Poetry: Cannot find beta versions of a package

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?

Upvotes: 8

Views: 3638

Answers (2)

Teivaz
Teivaz

Reputation: 5665

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

Upvotes: 6

Clintm
Clintm

Reputation: 4867

You can also do:

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

Upvotes: 1

Related Questions