← All tasks
pythonpython-poetry/poetry #5273Not a task: not reproduced

Project with path dependency cannot be installed with `pip install .` (or via requirements file) due to "RequirementParseError: Invalid URL"

envgap__python-poetry__poetry-5273

Original GitHub issue ↗Opened 2022-03-04

01 / FAILURE SIGNATURE

As reported upstream

error: metadata-generation-failed
Not a benchmark task.
  • No curated issue-specific recipe or verified environment fix is available.

02 / ENVIRONMENT RECIPE

Base commit
Not freshly verified
Manifest
requirements.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

python-poetry/poetry #5273 · read the original issue
<!--

  Hi there! Thank you for discovering and submitting an issue.



  Before you submit this; let's make sure of a few things.

  Please make sure the following boxes are ticked if they are correct.

  If not, please try and fulfill these first.

-->



<!-- Checked checkbox should look like this: [x] -->

- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.

- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.

- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).



<!--

  Once those are done, if you're able to fill in the following list with your information,

  it'd be very helpful to whoever handles the issue.

-->



- **OS version and name**: macOS 11.4

- **Poetry version**: 1.1.13, 1.2.0b2.dev0 (f2c365fb6a23e78205681d6aa4111c888e9ee6ab)

- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://github.com/huonw/poetry-path-deps-issue



## Issue



We're working within a monorepo where we have several projects that depend on each other via `path = "..."` relative dependencies. Installing such a project directly with `pip install` fails with `pip._vendor.pkg_resources.RequirementParseError: Invalid URL: ../a`.



Why are we trying to do this? We want to have access to `pip install --target` to install packages to a specific directory, when packaging for an AWS Lambda .zip file. This means we're exporting to a requirements file and installing that.



This is potentially caused by only absolute paths being turned into a URL, in https://github.com/python-poetry/poetry-core/blob/c5f4cda45402c38bb87ab73d0e32de509ba68f41/src/poetry/core/packages/directory_dependency.py#L125



Potentially related issues:



- similar error messages: python-poetry/poetry#3930, python-poetry/poetry#3899, python-poetry/poetry#4709, python-poetry/poetry#4868

- similar set-up: python-poetry/poetry-plugin-export#147

- python-poetry/poetry#936 for the monorepo style with a lot of path deps



### Example



https://github.com/huonw/poetry-path-deps-issue contains a full reproducible example:



```shell

cd /tmp

git clone https://github.com/huonw/poetry-path-deps-issue.git

pip install poetry-path-deps-issue/b

```



The core layout is:



```

.

├── a

│   ├── a

│   │   └── __init__.py

│   └── pyproject.toml

├── b

│   ├── b

│   │   └── __init__.py

│   └── pyproject.toml

└── c

    ├── c

    │   └── __init__.py

    ├── poetry.lock

    └── pyproject.toml

```



Where `b/pyproject.toml` contains a dependency `a = { path = "../a" }` (`c` is left over from an older version of this issue, see below).



The `pip install .` fails with:



```

Processing /poetry-path-deps-issue/b

...

  File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3103, in __init__

    raise RequirementParseError(
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]

Issue-specific recipe and runtime smoke command require review against the complete issue and repository.

Legacy reproduction is generic install-only; match the actual issue failure before admission.