Skip to main content

Tool to mark packages as installed in pip without actually installing them.

Project description

pip-mark-installed

A utility tool to mark packages as installed in pip without actually installing them.

Description

pip-mark-installed creates the necessary metadata files to make pip believe that a package is installed, without actually installing any of the package code. This is particularly useful for resolving conflicts between different package variants that share the same namespace (e.g., different OpenCV distributions, system installations of pytorch etc.).

Installation

Grab the pip-mark-installed.py script or install it via pip:

pip install pip-mark-installed

Usage

pip-mark-installed PACKAGE_SPEC [PACKAGE_SPEC ...]

Where PACKAGE_SPEC can be either:

  • PACKAGE_NAME (uses a default future version)
  • PACKAGE_NAME==VERSION

Examples

Mark a package with default version:

pip-mark-installed.py opencv-python

Mark multiple packages with specific versions:

pip-mark-installed.py opencv-python-headless==4.5.1 opencv-contrib-python==4.5.1

Specify a custom site-packages directory:

pip-mark-installed.py --site-packages /path/to/site-packages some-package

Common Use Cases

For example, OpenCV has several Python package variants that conflict with each other:

  • opencv-python (standard build)
  • opencv-python-headless (without GUI)
  • opencv-contrib-python (with extra modules)
  • opencv-contrib-python-headless (extra modules, no GUI)

Different dependencies might specify different variants, leading to accidental file overwrites and runtime errors. pip-mark-installed can help you resolve these conflicts by marking undesired packages as installed without actually installing them:

# First install the variant you actually want
pip install opencv-python-headless

# Then mark the conflicting package as installed
pip-mark-installed opencv-python

How It Works

The script creates the necessary .dist-info directory structure and metadata files that pip uses to determine if a package is installed.

License

MIT

Project details


Download files

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

Source Distribution

pip_mark_installed-0.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pip_mark_installed-0.0.1-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pip_mark_installed-0.0.1.tar.gz.

File metadata

  • Download URL: pip_mark_installed-0.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pip_mark_installed-0.0.1.tar.gz
Algorithm Hash digest
SHA256 98b702de53ef7efe3aca7d5fe3b483f8b8e2815906fdf9ceb021034baea9cd91
MD5 7ba3d45158b40e89660cafa07010e595
BLAKE2b-256 ac03c92bf910ec6d8aecbe872e65a7ceeaf7db7c121c82bfa5165488d213fb3c

See more details on using hashes here.

File details

Details for the file pip_mark_installed-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pip_mark_installed-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d4de413b924f3c25fdb7224a2d80ab1e2d308e95ed04a7ec2dacf83318a4d3d8
MD5 186c8357a96e0ef1a84c8548235ec6ea
BLAKE2b-256 b8a02e0ee89e68846d67e9fc66ac458405dd0ccb0e601585d6a5c894d07f4b26

See more details on using hashes here.

Supported by

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