-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Configuration option to force use of system site-packages #1945
Comments
Are there any workarounds for this atm? What kind of work would be required to implement this? For some input on the proposed interface for this, I really like the environment variable approach because it can be very temporary (it can be used for the duration of a single |
Hello @jonapich and @zdog234, could you please describe your use-cases? For now it's hard for me to imagine why this feature would be needed. fin swimmer |
CI servers may want to launch poetry for various reasons. The "thing" that launches poetry, may be a Python script launched from another virtual environment. Another use case is to be able to script poetry actions in a batch. I have several small python projects in 1 tree and I like to automate common operations. Because of poetry's limitation, I was forced to do it in bash instead of python. |
Sure thing! I'm not actually sure if this particular issue would solve the problems I've had, or if I could write an issue that's more specific to windows. I've got a library called
I'd have to go verify this behavior, but I'm pretty sure that We tried using |
Ah, sorry for that long wall of text. Just realized that my answer is covered by @jonapich 's |
I was able to work around it by removing that env variable before launching poetry through a subprocess.call:
|
Same use case here as @jonapich. We run our tests via scripts in jenkins and they start with some default virtual environment. That's fine and dandy for anything not poetry, but for poetry I'd like it to be using separate venvs. I'm working around it now by creating and activating venvs manually for each project involved in the one script. |
If I may... In particular for the CI workflows, are you sure you need poetry's CLI? Which kinds of poetry commands are you running in those 3rd party environments? |
|
@roxchkplusony Thanks.
|
@sinoroc, for what it's worth, I need to:
Everything else could probably be easily automated. I guess we could parse out the python version specification to meet 1, but it doesn't seem fun to parse the version |
@zdog234
I think I would use tox for a use case like that. |
Also I do not understand why the following does not execute in the environment created by poetry (i.e. not the one currently active)? VIRTUAL_ENV= poetry run python -m site I had understood that poetry relies on the |
I think you're misunderstanding my (poorly written) comment. One of the assumptions of my script is that there are some (user-provided) |
I guess I'd throw 3.9 in now as well |
I see. My bad :/ |
Np :) |
I have this issue too. We use a CLI package at work to automate project setup. It downloads a repo (which contains a pyproject.toml), copies githooks to the appropriate folder, uses pyenv to download the python version pinned in pyproject.toml, sets nbdime to be the default diff viewer for notebooks, and finally uses poetry to set virtualenvs.create true and install the dependencies. If the CLI package is installed in base python then everything works. If the CLI package is installed and ran in it's own virtual environment (as it should be), then Poetry installs the dependencies into the CLI package's virtual environment, which is unwanted. |
Regrettably this does not work for me at all. I'm really pulling my hair out here - I don't know why Poetry defaults to this behavior? |
Feature Request
We need a way to tell poetry to ignore the currently active virtual environment. I am running into a roadblock trying to automate some of the poetry install operations from python.
As a comparison, pipenv supports it through the PIPENV_IGNORE_VIRTUALENVS environment variable.
The best approach, I think, is a switch like --breakout-of-venv (can't find a good name) to tell poetry to ignore the currently activated environment for any command that needs to deal with the virtual environment (install, add, remove...).
Other ideas:
poetry env
is the right candidate for this. Something likepoetry env use --default
maybe. But then you always need 2 commands per poetry command if you're using e.g. subprocess.call() to make it work; only useful in a real CLI context.poetry config
could work, but it sounds weird to modify this in order to run a script.The text was updated successfully, but these errors were encountered: