Skip to content

Conversation

G26karthik
Copy link

Summary

Fixes #1650

This PR implements the feature requested in #1650 by adding a new environment
variable PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE that allows users to disable
automatic upgrades of shared libraries (pip, setuptools, wheel).

Motivation

Users who need to maintain compatibility with older Python versions (e.g., Python 3.8)
can encounter errors when pip automatically upgrades to versions that no longer support
their Python version. This environment variable provides a way to disable the automatic
upgrade behavior while still allowing manual upgrades via pipx upgrade-shared.

Changes Made

  1. Added PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE constant to src/pipx/constants.py
  2. Modified src/pipx/venv.py to check the environment variable before auto-upgrading
  3. Added documentation in docs/examples.md explaining the new feature
  4. Added test in tests/test_shared_libs.py to verify the behavior

Usage

# Linux/MacOS
export PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE=1
pipx install <package>  # Will NOT auto-upgrade shared libraries

# Windows (PowerShell)
$env:PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE=1
pipx install <package>  # Will NOT auto-upgrade shared libraries

G26karthik and others added 7 commits October 7, 2025 21:49
- Add new environment variable PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE to disable automatic shared library upgrades
- Modify venv.py to check the environment variable before triggering auto-upgrade
- Add documentation in docs/examples.md explaining the new feature
- Add test in tests/test_shared_libs.py to verify the behavior

Fixes pypa#1650
@G26karthik
Copy link
Author

@maintainers Pls Review and Approve for Tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable auto-upgrading shared libraries

1 participant