question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry install --extras doesn't work

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

The docs show a pyproject.toml:

[tool.poetry]
name = "awesome"

[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"

# A list of all of the optional dependencies, some of which are included in the
# below `extras`. They can be opted into by apps.
psycopg2 = { version = "^2.7", optional = true }
mysqlclient = { version = "^1.3", optional = true }

[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]

And then an example of installing the “extras”:

poetry install --extras "mysql pgsql"

But pasting the relevant part of this example into my own pyproject.toml (see gist) it doesn’t work:

$ poetry install --extras "mysql pgsql"
Installing dependencies from lock file

[ValueError]
Extra [mysql] is not specified.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
wshayescommented, Aug 27, 2020

Looks like you can install multiple dependencies in a single set using the following approach:

poetry add -E api fastapi
poetry add -E api gunicorn
poetry add -E api uvicorn

resulting in the following changes to the pyproject.toml file:

fastapi = {version = "^0.61.0", extras = ["api"]}
gunicorn = {version = "^20.0.4", extras = ["api"]}
uvicorn = {version = "^0.11.8", extras = ["api"]}

But running poetry update; poetry install -E API doesn’t work yet.

You need to add the following entry to the pyproject.toml file (NOTE you have to add the requirements specifier otherwise what gets passed to pip install complains and errors out):

[tool.poetry.extras]
api = ["fastapi^0.61.0", "gunicorn^20.0.4", "uvicorn^0.11.8"]

and then poetry update; poetry install -E API works fine.

3reactions
dekozacommented, Apr 28, 2020

My django-getpaid project has a test extra dependency group declared among others.

poetry install does not install pytest

poetry install -E test does not install pytest either.

Read more comments on GitHub >

github_iconTop Results From Across the Web

poetry doesn't install extras · Issue #1145 - GitHub
I had the same issue, but it seems to work correctly if I specify the extra dependencies in the tool.poetry.dependencies section instead of...
Read more >
Python poetry - how to install optional dependencies?
5. For anyone getting the Extra is not specified error, you have to run poetry update first. · 1. Is there a short...
Read more >
Commands | master | Documentation | Poetry - Python ...
--all-extras : Install all extra features (conflicts with –extras). --no-dev : Do not install dev dependencies. (Deprecated, use --without dev or --only main ......
Read more >
The pyproject.toml file | master | Documentation | Poetry
When a script is added or updated, run poetry install to make them available in the project's virtualenv. extras #. Poetry supports extras...
Read more >
Announcing Poetry 1.2.0 | Blog
The Poetry team is pleased to announce the immediate availability of Poetry 1.2.0. Poetry 1.2 boasts a massive list of changes, new features ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found