feat(pypi): fallback to virtualenv if venv fails#1682
Open
kbenzie wants to merge 1 commit intomason-org:mainfrom
Open
feat(pypi): fallback to virtualenv if venv fails#1682kbenzie wants to merge 1 commit intomason-org:mainfrom
kbenzie wants to merge 1 commit intomason-org:mainfrom
Conversation
062412e to
a323b7e
Compare
a323b7e to
18bebc1
Compare
|
I'm using the PR for multiple months now in a rootless scenario as described by kbenzie and I haven't encountered any issues. I think it would be great to get this merged. It is only a very minor change, and the user could be even warned that the fallback happens to make it more clear that this is not the default behavior. |
18bebc1 to
f9303b6
Compare
Author
|
@LarsHaalck I'm glad it's also useful to someone other than myself. I've updated the PR to fix the merge conflicts. @williamboman is there anything I can do to help get this integrated into the main branch? |
f9303b6 to
93ba5c4
Compare
On Ubuntu 22.04 when the `python3-venv` package is not installed:
* Importing the `venv` module will succeed.
* Running `python3 -m venv --help` will output help.
* Running `python3 -m venv $VENV_DIR` fails with the following output:
```console
$ python3 -m venv $VENV_DIR
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.10-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: /root/venv/bin/python3
```
When running in a rootless environment installing the `python3-venv`
package is not tenable. However, the `virtualenv` package can be
installed via `pip` in the users home directory.
This patch checks the result of `python3 -m venv $VENV_DIR`, if that
fails then it will fallback to calling `python3 -m virtualenv $VENV_DIR`
instead.
93ba5c4 to
5ee1fca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Ubuntu 22.04 when the
python3-venvpackage is not installed:venvmodule will succeed.python3 -m venv --helpwill output help.python3 -m venv $VENV_DIRfails with the following output:When running in a rootless environment installing the
python3-venvpackage is not tenable. However, thevirtualenvpackage can be installed viapipin the users home directory.This patch checks the result of
python3 -m venv $VENV_DIR, if that fails then it will fallback to callingpython3 -m virtualenv $VENV_DIRinstead.