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

exporting packages to stdout adds 'creating virtualenv ...' in v 1.2.0 #6275

Closed
2 tasks done
jegger opened this issue Aug 31, 2022 · 11 comments
Closed
2 tasks done

exporting packages to stdout adds 'creating virtualenv ...' in v 1.2.0 #6275

jegger opened this issue Aug 31, 2022 · 11 comments

Comments

@jegger
Copy link

jegger commented Aug 31, 2022

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Issue

Not sure if that should be considered a bug - maybe more an annoying change. However it broke our pipelines this morning as the new version 1.2.0 came out :)
I don't mind if you close this in case you think that it should be like that. Maybe it is helpful for others which use poetry in the same way we do.

We pipe the output of package export to pip for installation.
E.g. poetry export -f requirements.txt | poetry run pip install -r /dev/stdin

In case there is not virtualenv created yet, poetry prints to stdout Creating virtualenv foobar-pyXX in /foo/bar which will result in pip trying to install a package called "Creating virtualenv...", which then ofc. fails.

Workaround

As a workaround, we can simply export the dependencies to a file, and use pip to query the file instead of stdin.
poetry export -f requirements.txt --output requirements.txt && poetry run pip install -r requirements.txt

Thanks!

@neersighted
Copy link
Member

Likely related to the plugin migration. Going to tag in @finswimmer as he was doing work on environment commands (and implicit environment creation) recently.

@dimbleby
Copy link
Contributor

dimbleby commented Aug 31, 2022

-o requirements.txt was always the contract: IMO this is indeed "annoying change" rather than "bug".

That poetry export creates an unnecessary virtual environment is covered at python-poetry/poetry-plugin-export#78. You can run the command with POETRY_VIRTUALENVS_CREATE=false to avoid that, if you care to do so.

@dimbleby
Copy link
Contributor

Also --quiet, probably

@alex
Copy link

alex commented Aug 31, 2022

FWIW -o doesn't seem to be compatible with using the results with pip's -c: pyca/cryptography#7553 (the certbot-josepy job)

@dimbleby
Copy link
Contributor

dimbleby commented Aug 31, 2022

you want pip install -r not pip install -c and this is nothing to do with whether the file came via stdout or not. The output format is requirements.txt, not constraints.txt

@alex
Copy link

alex commented Aug 31, 2022

This was working under the previous version of poetry with the > constraints.txt operation. This thread suggests that the redirect was never supported, and -o should be used. Perhaps constraints.txt was never supported in either of them, but just happened to work?

@dimbleby
Copy link
Contributor

I don't know how to be clearer so I guess I'll just repeat myself. The output format is (and always was) requirements.txt, not constraints.txt.

@adferrand
Copy link

I am a little confused here. The poetry documentation about export states that if the --output flag is omitted, stdin will be used. So we should be able to pipe the result of poetry export to pip via the -c or -r flag no ?

To clarify about pip -c, an interesting usage of poetry export is to generate the dependency tree maintained by poetry into an understandable format for pip (the so-called "requirements.txt" format), then use the -c flag of pip to have reproducible pip install (typically in CI/CD pipelines).

@dimbleby
Copy link
Contributor

pip install -c expects a different input format than pip install -r. poetry export produces the latter format. If it used to work with pip install -c then that was just lucky.

This is nothing to do with the stdout / --output thing (and this whole discussion doesn't belong in this issue at all)

@neersighted
Copy link
Member

Closing this as duplicate -- the bug is tracked at python-poetry/poetry-plugin-export#78 and things have gone off-topic.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2022
TeoZosa added a commit to TeoZosa/structlog-sentry-logger that referenced this issue Sep 1, 2022
Fixes:
```
================================== log start ===================================
ERROR: Invalid requirement: 'Creating virtualenv structlog-sentry-logger in /home/runner/work/structlog-sentry-logger/structlog-sentry-logger/.venv' (from line 1 of requirements.txt)
Hint: It looks like a path. File 'Creating virtualenv structlog-sentry-logger in /home/runner/work/structlog-sentry-logger/structlog-sentry-logger/.venv' does not exist.

=================================== log end ====================================
```

see: python-poetry/poetry#6275
TeoZosa added a commit to TeoZosa/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd that referenced this issue Sep 1, 2022
Fixes:
```
================================== log start ===================================
ERROR: Invalid requirement: 'Creating virtualenv structlog-sentry-logger in /home/runner/work/structlog-sentry-logger/structlog-sentry-logger/.venv' (from line 1 of requirements.txt)
Hint: It looks like a path. File 'Creating virtualenv structlog-sentry-logger in /home/runner/work/structlog-sentry-logger/structlog-sentry-logger/.venv' does not exist.

=================================== log end ====================================
```

see: python-poetry/poetry#6275
pajowu added a commit to bugbakery/audapolis that referenced this issue Sep 1, 2022
pajowu added a commit to bugbakery/audapolis that referenced this issue Sep 2, 2022
Copy link

github-actions bot commented Mar 1, 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants