Skip to main content

Run pip outside of environment.

Project description

Run pip outside of environment

At a glance:

$ virtualenv --no-pip myenv  # Create environment without pip.

$ source myenv/bin/activate  # Activate environment.

$ pip --version      # pip is not available.
bash: pip: command not found

$ ouo install six    # But we can still do this.
Collecting six
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: six
Successfully installed six-1.15.0

$ python -c 'import six; print(six.__file__)'
.../myenv/lib/python3.9/site-packages/six.py

How?

ouo downloads pip wheels into the user's data dirctory. When executed, it executes pip with something like

/path/to/python /path/to/pip-20.3.3-py2.py3-none-any.whl/pip

where the path of the Python interpreter is detected with the VIRTUAL_ENV environment variable. The interpreter would then perform a zip import to execute the pip module inside the wheel.

Future Works

  • setuptools and wheel are still needed to build legacy (non-PEP-517) source distributions. This makes python -m venv --no-pip unrealistic.
  • Invocation is slow. This has two causes: ouo needs to iterate through the wheel directory to find a suitable pip version for the current Python version. Also, zip imports are very slow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ouo-0.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file ouo-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ouo-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for ouo-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc5926a978672f9b6feab89409fed12c549310fde595df0641635b48f8e3c5c6
MD5 a907de5aea7e4b7b7811a6b0525e475e
BLAKE2b-256 517d9ed10b3b3347cef0e6a98828b60690dac47c832e7a7804d77dd92dc27d9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page