question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip install with relative paths in pyproject.toml doesn't seem to work

See original GitHub issue

How do I specify relative paths that pip can use in pyproject.toml?
poetry successfully installs them, however pip fails with the following error:

File "/tmp/pip-build-env-ck09aiax/overlay/lib/python3.7/site-packages/poetry/core/packages/directory_dependency.py", line 36, in __init__
        raise ValueError("Directory {} does not exist".format(self._path))
    ValueError: Directory ../lib_foo does not exist

Example

I have the following repository structure

.
β”œβ”€β”€ lib_foo
β”‚   β”œβ”€β”€ lib_foo
β”‚   β”‚   └── __init__.py
β”‚   └── pyproject.toml
└── main_app
    β”œβ”€β”€ main_app
    β”‚   └── __init__.py
    └── pyproject.toml

main_app is dependent upon lib_foo, its dependecies looks like this:
./main_app/pyproject.toml

[tool.poetry.dependencies]
python = "^3.7"
lib-foo = { path = "../lib_foo" }  # also tried  path = "../lib_foo/"

when doing:

./main_app$ poetry install  # runs successfully 
./main_app$ python -m pip install ../lib_foo/ # runs successfully
./main_app$ python -m pip install .  # fails with the error mentioned above 
./main_app$ python -m pip --version
pip 20.1.1 from ./main_app/my_venv/lib/python3.7/site-packages/pip (python 3.7)

I am using poetry when developing a project however when deploying them I want to only use pip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Feb 28, 2021

You should not be able to build the package, since it is not allowed to have dependencies specified as relative paths in package metadata. PEP 508 only allows version specifiers and URL (which only allows absolute paths even if you use file://). Poetry should fix this.

1reaction
uranusjrcommented, Nov 12, 2020

Consequence of #7555. May be resolved with #9091.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip install with relative paths in poetry - Stack Overflow
I am pretty sure pip can not handle dependencies with relative paths. Absolute paths might be okay. The way I see it, pip...
Read more >
What is the correct interpretation of path-based PEP 508 ...
We assume this is always a filesystem path and interpret it relative to the parent directory of the unpacked filesystem resource we consider...
Read more >
The pyproject.toml file | Documentation | Poetry
README paths are implicitly relative to pyproject.toml . The contents of the README file(s) are used to populate the Description field of your...
Read more >
Changelog - pip documentation v22.3.1
Support editable installs for projects that have a pyproject.toml and use a build ... Correctly handle relative cache directory provided via --cache-dir.
Read more >
Flit Documentation
python3 -m pip install flit. 3. Run flit init in the directory containing the module to create a pyproject.toml file. It will look...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found