You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Poetry is an illustrative example here, but the root cause lies within pip (or possibly even PEP 517)
Description
When performing a PEP 517 build, pip creates an isolated environment for the build to execute in within a temporary directory. No information about the directory the build originated from is shared with the build backend. As a result, any dependencies specified as a relative file/folder path cannot be resolved.
Expected behavior
Relative directory dependencies can be resolved in a PEP 517 build
How to Reproduce
Create a project which specifies a relative directory dependency using a PEP 517 build backend
Run pip install .
Build will fail to resolve directory dependency
Output
Most of this output is from poetry, but including here for completeness
Processing /home/andrew/worksapce/projects/my-project Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/bin/python /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp0h3jkq4v cwd: /tmp/pip-req-build-5e4zvq59 Complete output (16 lines): Traceback (most recent call last): File "/home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module> main() File "/home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/tmp/pip-build-env-ta34h747/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 43, in prepare_metadata_for_build_wheel poetry = Factory().create_poetry(Path(".").resolve(), with_dev=False) File "/tmp/pip-build-env-ta34h747/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 93, in create_poetry self.create_dependency(name, constraint, root_dir=package.root_dir) File "/tmp/pip-build-env-ta34h747/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 244, in create_dependency dependency = DirectoryDependency( File "/tmp/pip-build-env-ta34h747/overlay/lib/python3.8/site-packages/poetry/core/packages/directory_dependency.py", line 41, in __init__ raise ValueError("Directory {} does not exist".format(self._path)) ValueError: Directory ../../lib/my-project-lib does not exist ----------------------------------------WARNING: Discarding file:///home/andrew/worksapce/projects/my-project. Command errored out with exit status 1: /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/bin/python /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp0h3jkq4v Check the logs for full command output.ERROR: Command errored out with exit status 1: /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/bin/python /home/andrew/.cache/pypoetry/virtualenvs/my-project-JuauOX3v-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp0h3jkq4v Check the logs for full command output.
Code of Conduct
I agree to follow the PSF Code of Conduct
The text was updated successfully, but these errors were encountered:
Relative paths in a package is a non-standard Poetry extension. The build is handled by Poetry, so it should either reject this with a clear message, or somehow support it for you. pip can't do much about this.
pip version
21.0.1
Python version
3.8.5
OS
Linux, Ubuntu 20.04
Additional information
Relevant pyproject.toml bits:
Poetry is an illustrative example here, but the root cause lies within pip (or possibly even PEP 517)
Description
When performing a PEP 517 build, pip creates an isolated environment for the build to execute in within a temporary directory. No information about the directory the build originated from is shared with the build backend. As a result, any dependencies specified as a relative file/folder path cannot be resolved.
Expected behavior
Relative directory dependencies can be resolved in a PEP 517 build
How to Reproduce
pip install .
Output
Most of this output is from poetry, but including here for completeness
Code of Conduct
The text was updated successfully, but these errors were encountered: