python-poetry / python-poetry/poetry-plugin-export
requirements.txt not installable by pip when local package depends on another
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 335
- Forks
- 57
- Avg merge
- 1h 23m
- Merged PRs (30d)
- 3
Description
-
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 (
-vvvoption). -
OS version and name: Docker (python:3.7-slim)
-
Poetry version: 1.1.4
-
Link of a Gist with the contents of your pyproject.toml file: https://github.com/jyggen/poetry-example
Issue
pip is unable to install the dependencies using the requirements.txt from poetry export when the main application is depending on the local path package B, and where package B in turn depends on local path package A. I've created a repository (see above) that can reliably reproduce the error by running docker build ..
Dependency Graph:
app
|-- package-b
|-- package-a
Example output:
$ docker build .
Sending build context to Docker daemon 81.92kB
Step 1/8 : FROM python:3.7-slim
---> 84de2ffd919d
Step 2/8 : ENV POETRY_VERSION=1.0.4
---> Using cache
---> 7b1b2eaa0c59
Step 3/8 : ENV POETRY_HOME=/usr/local/poetry
---> Using cache
---> 1b0452673941
Step 4/8 : RUN apt-get update && apt-get install -y wget && wget https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py && python get-poetry.py
---> Using cache
---> 60b085346606
Step 5/8 : ENV PATH="/usr/local/poetry/bin:${PATH}"
---> Using cache
---> 4799b083ead0
Step 6/8 : COPY . /build
---> fdf2a1ac60a3
Step 7/8 : WORKDIR /build/app
---> Running in cb8b784b1f88
Removing intermediate container cb8b784b1f88
---> 67acda5f4b2c
Step 8/8 : RUN poetry export --without-hashes -f requirements.txt | sed 's/-e //' | pip install -r /dev/stdin
---> Running in dbafc8616663
Processing /build/package-a
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Processing /build/package-b
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpnhnp2nm6
cwd: /tmp/pip-req-build-2y1q91vj
Complete output (16 lines):
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-t7gqct2d/overlay/lib/python3.7/site-packages/poetry/masonry/api.py", line 38, in prepare_metadata_for_build_wheel
poetry = Factory().create_poetry(Path("."))
File "/tmp/pip-build-env-t7gqct2d/overlay/lib/python3.7/site-packages/poetry/factory.py", line 99, in create_poetry
package.add_dependency(name, constraint)
File "/tmp/pip-build-env-t7gqct2d/overlay/lib/python3.7/site-packages/poetry/packages/package.py", line 333, in add_dependency
develop=constraint.get("develop", True),
File "/tmp/pip-build-env-t7gqct2d/overlay/lib/python3.7/site-packages/poetry/packages/directory_dependency.py", line 36, in __init__
raise ValueError("Directory {} does not exist".format(self._path))
ValueError: Directory ../package-a does not exist
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpnhnp2nm6 Check the logs for full command output.
The command '/bin/sh -c poetry export --without-hashes -f requirements.txt | sed 's/-e //' | pip install -r /dev/stdin' returned a non-zero code: 1
I've also seen a related error (where a local package depends on another local package that's also required by the main app) occur in an actual project when trying to install the export output with pip, but haven't been able to create a reproducible case yet. The error output, however, is the following:
ERROR: Could not find a version that satisfies the requirement package-a (from package-b==0.1.0->-r /dev/stdin (line 9)) (from versions: none)
ERROR: No matching distribution found for package (from package-b==0.1.0->-r /dev/stdin (line 9))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository and run docker build . to inspect the poetry export output and subsequent pip install -r /dev/stdin failure. Review the referenced pyproject.toml files and the app/package-a/package-b dependency graph; done means pip can install the exported requirements when local packages have nested path dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100