Commit 498e2d2
authored
Invoke
When `python -m venv` is run, after creating the virtual environment it
invokes `ensurepip` to install pip.
The `ensurepip` module in older Python versions didn't correctly run its
Python subprocesses in isolated mode, meaning that the working directory
is added to `sys.path`. This can cause issues if the app's build
directory contains files/directories that shadow expected package names
(such as a `brotli` directory).
For example:
```
-----> Installing Poetry 1.8.4
Error: Command '['/tmp/codon/tmp/cache/.heroku/python-poetry/venv/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
! Internal Error: Unable to create virtual environment for Poetry.
!
! The 'python -m venv' command to create a virtual environment did
! not exit successfully.
!
! See the log output above for more information.
```
The best fix is for apps to upgrade to newer Python patch versions
(3.8.14+, 3.9.14+, 3.10.6+), since they include the upstream
`ensurepip` fix as well as many other bug and security fixes.
However, to ensure venv creation still works on these older Python
versions, as a workaround we can run the `python -m venv` command from a
different working directory (as an alternative to isolated mode).
Fixes #1697.
GUS-W-17215816.python -m venv from a different working directory (#1698)1 parent ddf6aea commit 498e2d2
File tree
4 files changed
+12
-3
lines changed- lib
- spec
- fixtures/poetry_oldest_python/brotli
- hatchet
4 files changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
0 commit comments