-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry doesn't install extras #1145
Comments
I confirm this with poetry 1.0.0a3. |
I think there is a bug around option handling. cf. #1141 |
This is a workaround needed due the following issue in Poetry: python-poetry/poetry#1145
I had the same issue, but it seems to work correctly if I specify the extra dependencies in the Can any of you confirm this behavior? |
In my case it sometimes works and sometimes not. They are listed in |
I have this issue when installing from a password-protected private repo which does not have the package: [[tool.poetry.source]]
name = "private"
url = "https://private.repo.com/simple"
[tool.poetry.dependencies]
python = "^3.7"
scikit-learn = {version = "0.19.0",extras = ["alldeps"]} and then: $ poetry update
Updating dependencies
Resolving dependencies... (18.2s)
Package operations: 5 installs, 0 updates, 0 removals
- Installing scikit-learn (0.19.0)
[EnvCommandError]
Command ['/home/reza/projects/virtualenvs/nava_37/bin/python', '-m', 'pip', 'install', '--no-deps', '--index-url', 'https://xxxx:[email protected]/simple',
'scikit-learn==0.19.0'] errored with the following return code 1, and output:
Looking in indexes: https://xxxx:****@private.repo.com/simple
Collecting scikit-learn==0.19.0
Using cached https://files.pythonhosted.org/packages/c2/38/e3b0333e661ab411545583cb24940223917fe7ffc9c68a77730dce3b10b0/scikit-learn-0.19.0.tar.gz
Installing collected packages: scikit-learn
Running setup.py install for scikit-learn: started
Running setup.py install for scikit-learn: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/reza/projects/virtualenvs/nava_37/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pifc_oyo/scikit-learn/
setup.py'"'"'; __file__='"'"'/tmp/pip-install-pifc_oyo/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\
n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-s3itmoyt/install-record.txt --single-version-externa
lly-managed --compile --install-headers /home/reza/projects/virtualenvs/nava_37/include/site/python3.7/scikit-learn
cwd: /tmp/pip-install-pifc_oyo/scikit-learn/
Complete output (19 lines):
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "/tmp/pip-install-pifc_oyo/scikit-learn/setup.py", line 168, in get_numpy_status
import numpy
ModuleNotFoundError: No module named 'numpy'
Traceback (most recent call last):
File "/tmp/pip-install-pifc_oyo/scikit-learn/setup.py", line 148, in get_scipy_status
import scipy
ModuleNotFoundError: No module named 'scipy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-pifc_oyo/scikit-learn/setup.py", line 269, in <module>
setup_package()
File "/tmp/pip-install-pifc_oyo/scikit-learn/setup.py", line 249, in setup_package
.format(numpy_req_str, instructions))
ImportError: Numerical Python (NumPy) is not installed.
scikit-learn requires NumPy >= 1.8.2.
Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html
----------------------------------------
ERROR: Command errored out with exit status 1: /home/reza/projects/virtualenvs/nava_37/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/p
ip-install-pifc_oyo/scikit-learn/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pifc_oyo/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file_
_);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-s3itmoyt/install-re
cord.txt --single-version-externally-managed --compile --install-headers /home/reza/projects/virtualenvs/nava_37/include/site/python3.7/scikit-learn Check the logs
for full command output.
update [--no-dev] [--dry-run] [--lock] [--] [<packages>]... Note: the same Debug info
Poetry
Virtualenv
System
|
Could you give a gist link to your
[Code block removed]
# ~~ snip ~~
[tool.poetry.dependencies]
foo_package = {version = "^1.0", optional = true}
[tool.poetry.extras]
foo = ["foo_package"]
# ~~ snip ~~ Or am I mixing up things? (again...) |
@esciara |
Thanks @bersace . I don't quite understand the difference. Could you point to some references or the doc clarifying this? |
@esciara poetry add X -E Y is equivalent to appending What you understood is editing Maybe $ poetry add foo_package -E foo_extra --optional foo This would add foo_package[foo_extra] as depency of mypackage[foo]. Do you get it ? |
Aha! Yes got it. Yes I was expecting that everything If this logic is followed, then yes, doing something like adding a Do you reckon it would be the most intuitive way to add to And by the way, do you have an example where |
Maybe |
I don't know of usage of --optionnal out of extras. |
anyone else? @sdispater ? |
I also thought the extra feature was for optional dependencies. |
I have the same behavior. From a quick search it seems like this is by design, see #606 (comment) |
it was the missing optional dependency. |
This seems like a really important addition, IMO. Users are forced to add it manually to an (quick: tip for folks reading this comment: implement For the purpose of matching the |
Is it true that this problem has not been fixed yet? :( |
It looks like https://github.com/python-poetry/poetry/blob/master/poetry/installation/installer.py#L147-L159 does not pass extras to solver. |
Is it me, or are there two issues being mixed up here? This was originally about "extras" not being installed, but most discussion seems to be about needing a CLI instead of manually addin "extras" to pyproject.toml (and to poetry.lock using |
From #1145 (comment) of @esciara
Isn't this how I think From #1145 (comment) of @bersace
Are you there proposing to repurpose One way to somewhat sidestep this question of how to add a dependency into an "extras", would be to move towards a "dependency-group" terminology (as proposed in #1644), which might be more natural to reason about? |
This makes sure that *if* it is manually installed, it is not removed by `poetry install --no-dev`. This is not currently relevant, since mysqlclient and its dependencies are not listed as dev packages, so poetry will already leave them alone, but making this explicit is probably better. It might be better to add this as an "extras" dependency, so it can be installed by `poetry install --extras`, but it seems that that does not currently work: python-poetry/poetry#1145
I'm not able to understand this issue at the moment. It's both a bug and feature thread. I still don't know if this is 1.0 working as designed, a bug, if they're workarounds, etc. Ideally we'd be collecting / cross-referencing bugs and reproductions @finswimmer @sdispater Can we close this and make 2 new issues:
|
Thanks for going through this @tony. The original reported issue is can no longer be reproduced. $ cat pyproject.toml
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.8"
psycopg2-binary = {version = "^2.8.6", optional = true}
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[tool.poetry.extras]
pg = ["psycopg2-binary"]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
$ [email protected] install -E pg --no-dev
Creating virtualenv foobar in /tmp/foobar/.venv
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing psycopg2-binary (2.8.6)
- Installing foobar (0.1.0) Regarding (2) I think this warrants its own issue to discuss the options. The current options will likely not be repurposed. However, the CLI is tday lacking management of project extras. This migh also include a new option to specify what project extra an optional dependency should be added to. Documentation fixes can also be assessed if the current wording is causing confusion. |
Note that this also interacts with #1644, which is about extending the |
Also remove the extras from pyproject.toml as those seem buggy: python-poetry/poetry#2073 python-poetry/poetry#1145
Had a hard time continuing to use pipenv for dependency management while working with readthedocs automated builds. Migrated over to Poetry and its PEP517 compliance will allow for easier use with readthedocs and less overhead overall. Here are the sources I used to help make this decision: * python-poetry/poetry#1145 * python-poetry/poetry#1941 * readthedocs/readthedocs.org#3181
In poetry |
experiencing the same issue Manually adding the extras to the |
Can confirm this is only happening with If you run You can also notice the lock file is missing dev-dependency extras but includes normal dependencies extras. I believe the expected behavior for extras would be identical for |
Hello @njgrisafi, "extras" are only meant for fin swimmer |
ahh got it thank you @finswimmer! |
The feature is not supported for dev-deps. c.f. python-poetry/poetry#1145 (comment)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
setup:
only a pytoml file with the new build system
to reproduce:
poetry install -E foo
or
poetry install --extras "foo"
or
pip install ".[foo]"
result:
the dependencies of the foo group won't be installed
I think the issue here is that the extras system stops to work if no setup.py bails out.
The text was updated successfully, but these errors were encountered: