poetry export --without-hashes --format=requirements.txt ouputs local file dependencies as "editable":
-e local/path/package.whl
This is reported as an error when parsed by pip install:
local/path/package.whl should either be a path to a local project
or a VCS url beginning with svn+, git+, hg+, or bzr+
The correct format should not include the -e part (ref. https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format).
NOTE:
This is covered in test_exports.py https://github.com/sdispater/poetry/blob/develop/tests/utils/test_exporter.py#L353
Bumping this issue. We're noticing a similar problem and it's causing problems for our serverless deployments. Pip is complaining whenever we try to install from the requirements.txt file that poetry export generates. Is there a fix for this issue?
+1
I've come across something similar. My export came with the editable flag for a dependency using a Git url. Had to remove the flag before I could deploy it using Pip in production. Using Poetry 1.0.0b2.
I think this line here needs to be changed to remove the -e?
https://github.com/sdispater/poetry/blob/master/poetry/utils/exporter.py#L84
I see a few other -e's scattered through the file though, so I'm not sure if there's something else that needs to be replaced as well?
In any case, a quick workaround is to use sed to strip out the offending -es.
poetry export -f requirements.txt | sed 's/-e //'
I'm having the same issue here.
Thanks for reporting!
fin swimmer
Unless I'm mistaken this still adds the -e tag? I'm calling poetry export --without-hashes -f requirements.txt > requirements.txt with Poetry version 1.0.9
Hello @JulianFerry ,
can you show an example of your output where you think it's still wrong?
fin swimmer
As a full reproducible example, I did:
poetry new dependency
poetry new proj
cd proj
then added this to my pyproject.toml:
dependency = { path = "../dependency" }
then:
poetry export --without-hashes -f requirements.txt > requirements.txt
cat requirements.txt
returns:
-e ../dependency
@JulianFerry the behavior is correct here. Path dependencies are installed in editable mode (by default). So it's also exported in editable mode.
fin swimmer
@finswimmer
Thanks. Is there a way to override this? I am trying to test both packages together in a fresh docker environment (e.g. CI build), without having to push the dependency to a repository. As it stands I am using sed 's/-e //'
+1 for having the installation _method_ of path dependencies being controllable by a flag.
Use case:
When _developing locally_ (i.e. not dockerized) in a monorepo, it could be convenient to have editable installs of path dependencies, so that they are automatically up to date without poetry update'ing.
When build time comes in a Dockerfile, though, a solution to having path dependencies at all is to have them installed (by copy / non-editable) to a venv in a multi-step build, and simply copy the venv from build to final image.
From my experimentation this seems to be accomplishable by either poetry install (forcing you to have develop=false in path dependencies) or using the above mentioned sed-trick and install using pip.
It would be helpful to have flag (perhaps --non-editable) that was respected by both export and install.
Most helpful comment
I think this line here needs to be changed to remove the
-e?https://github.com/sdispater/poetry/blob/master/poetry/utils/exporter.py#L84
I see a few other
-e's scattered through the file though, so I'm not sure if there's something else that needs to be replaced as well?In any case, a quick workaround is to use
sedto strip out the offending-es.