pip install ignores extras defined under pyproject.toml
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Issue
Hi, I’m trying to specify extras to my package,
My pyproject.toml contains optional dependencies:
[tool.poetry.dependencies]
mlflow = { version = "<2.0.0", optional = true }
And under extras I’ve defined it just like the documentation:
[tool.poetry.extras]
my_extra = ['mlflow']
The command poetry install -E my_extra works properly for local development.
But when I build the package, and try installing it with pip (from another project)
running pip install mypkg[my_extra]
I get the following message:
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Ignoring mlflow: markers 'extra == "my_extra"' don't match your environment
...
...
I’m not sure why this is happening, previously with setup.py it never ignored my extras.
So I’ve tried playing around the pyproject.toml and I found a strange thing
When I modified my_extra to specify the package versions:
[tool.poetry.extras]
my_extra = ['mlflow<2.0.0']
The installation with pip doesn’t ignore the extras anymore,
BUT the poetry install -E my_extra command has stopped working…
Am I missing something? or is it a bug?
EDIT: The versions I’m using Poetry version: 1.1.4 pip version: 20.2.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (1 by maintainers)

Top Related StackOverflow Question
Ok, I’ve figured it out -
if you name your extra with capital letters (in
pyproject.toml), for some reason it ignores it withpipThe strange part is that apparently extras are case insensitive, so it doesn’t really matter
pip install ./mypkg[EXT]is the same aspip install ./mypkg[ext]and yet, defining your extras likewon’t work as intended.
I’m closing this issue, Thanks everyone for helping!
OK. You had me worried. Thanks for confirmation.