Search code examples
pythonpython-poetry

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?


Solution

  • 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