You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: Update installation guide for PEP 668 compatibility (#6495)
Modern Linux distributions (Ubuntu 24.04+, Fedora 38+) enforce PEP 668
which prevents 'pip install --user'. Updated the installation docs to:
- Add new recommended approach: isolated venv for pipenv
- Document PIPENV_IGNORE_VIRTUALENVS=1 for proper project isolation
- Add per-project bootstrap instructions for CI/CD
- Mark legacy --user installation with warning about PEP 668
- Update best practices and next steps sections
- Mention 'pipenv activate' as an alternative to 'pipenv shell'
Fixes#6264
The recommended approach is to install Pipenv for your user account. This avoids permission issues and prevents conflicts with system packages:
35
+
Modern Python installations (Python 3.11+ on recent Linux distributions like Ubuntu 24.04, Fedora 38+) enforce [PEP 668](https://peps.python.org/pep-0668/), which prevents installing packages with `pip install --user`. The recommended approach is to install Pipenv in its own isolated virtual environment.
The `PIPENV_IGNORE_VIRTUALENVS=1` setting ensures pipenv still creates and manages separate virtual environments for your projects.
57
+
58
+
#### Option 2: Per-Project Bootstrap
59
+
60
+
For CI/CD or when you want pipenv isolated per-project:
61
+
62
+
```bash
63
+
$ python3 -m venv .venv
64
+
$ source .venv/bin/activate # On Windows: .venv\Scripts\activate
65
+
$ pip install pipenv
66
+
$ pipenv install
67
+
```
68
+
69
+
### Legacy: User Installation
70
+
71
+
On older systems that don't enforce PEP 668, you can still use user installation:
36
72
37
73
```bash
38
74
$ pip install --user pipenv
39
75
```
40
76
41
-
This installs Pipenv in your user site-packages directory.
77
+
```{warning}
78
+
This method no longer works on modern Linux distributions (Ubuntu 24.04+, Fedora 38+) due to PEP 668. Use the isolated virtual environment approach above instead.
79
+
```
42
80
43
81
### Adding Pipenv to PATH
44
82
45
-
After installing with `--user`, you may need to add the user site-packages binary directory to your PATH.
83
+
If you used the legacy `--user` installation, you may need to add the user site-packages binary directory to your PATH.
46
84
47
85
#### On Linux and macOS
48
86
@@ -327,11 +365,11 @@ If pip is not found:
327
365
328
366
## Best Practices
329
367
330
-
1.**Use user installation**(`--user`) to avoid permission issues and system conflicts.
368
+
1.**Use isolated virtual environment installation**on modern systems to avoid PEP 668 restrictions.
331
369
332
370
2.**Keep Pipenv updated** to benefit from the latest features and bug fixes.
333
371
334
-
3.**Consider pipx**for a cleaner, isolated installation if you use multiple Python command-line tools.
372
+
3.**Set `PIPENV_IGNORE_VIRTUALENVS=1`**if you install pipenv in a dedicated venv, so it still manages project-specific environments.
335
373
336
374
4.**Add Pipenv to your project's development setup instructions** to ensure all developers use the same environment.
337
375
@@ -343,7 +381,9 @@ Now that you have Pipenv installed, you can:
343
381
344
382
1. Create a new project: `pipenv --python 3.10`
345
383
2. Install packages: `pipenv install requests`
346
-
3. Activate the environment: `pipenv shell`
384
+
3. Activate the environment:
385
+
- Spawn a subshell: `pipenv shell`
386
+
- Or activate in current shell: `eval $(pipenv activate)`
347
387
4. Run commands: `pipenv run python script.py`
348
388
349
389
For more detailed usage instructions, see the [Quick Start Guide](quick_start.md) and [Commands Reference](commands.md).
0 commit comments