Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export requirements.txt - local dependency file exported as editable #897

Closed
visciang opened this issue Feb 16, 2019 · 13 comments · Fixed by #1840
Closed

export requirements.txt - local dependency file exported as editable #897

visciang opened this issue Feb 16, 2019 · 13 comments · Fixed by #1840
Assignees
Labels
kind/bug Something isn't working as expected

Comments

@visciang
Copy link

  • OS version and name: Linux
  • Poetry version: 1.0.0a2

Issue

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

@gizmo385
Copy link

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?

@severinsimmler
Copy link

+1

@riclima
Copy link

riclima commented Oct 12, 2019

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.

@iwoloschin
Copy link

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 //'

@filipelbc
Copy link

I'm having the same issue here.

@finswimmer finswimmer self-assigned this Jan 7, 2020
@finswimmer finswimmer added the kind/bug Something isn't working as expected label Jan 7, 2020
@finswimmer
Copy link
Member

Thanks for reporting!

#1840 should fix it.

fin swimmer

sdispater pushed a commit that referenced this issue Jan 9, 2020
* fix(exporter): don't export local file dependency as editable

* fix(exporter): don't check for source_type "url" when prepending `-e`
@JulianFerry
Copy link

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

@finswimmer
Copy link
Member

Hello @JulianFerry ,

can you show an example of your output where you think it's still wrong?

fin swimmer

@JulianFerry
Copy link

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

@finswimmer
Copy link
Member

@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

@JulianFerry
Copy link

@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 //'

@adamal
Copy link

adamal commented Sep 1, 2020

+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.

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants