pip2pi
raw JSON → 0.8.2 verified Fri May 01 auth: no python maintenance
pip2pi is a tool for building a PyPI-compatible package repository from pip requirements. It takes a requirements.txt file and downloads packages and their dependencies to a local directory that can be served via a web server. Current version is 0.8.2, works with Python 3.8+. Release cadence is infrequent; last release was August 2023.
pip install pip2pi Common errors
error ImportError: cannot import name 'package_name' from 'pip2pi' ↓
cause pip2pi is primarily a CLI tool, not a library with a stable public API. Importing from pip2pi directly is not supported.
fix
Use the command-line tool pip2pi instead of importing it as a library. Or import from submodules like pip2pi.commands.
error pip2pi: error: unrecognized arguments: --download ↓
cause The --download flag was removed in version 0.8.0; pip2pi now uses pip download.
fix
Use pip2pi 0.8.0+ without the --download flag. The command is now just 'pip2pi <dir> -r <requirements>'.
error AttributeError: module 'html' has no attribute 'escape' ↓
cause Using Python version older than 3.2; html.escape was introduced in Python 3.2.
fix
Upgrade to Python 3.2+ or use pip2pi >=0.8.2 which requires Python 3.8+.
Warnings
breaking Version 0.8.0+ removed support for pip<10.0.0. Old downloads from pip's --download option are no longer used. ↓
fix Upgrade pip to version 10.0.0 or later.
deprecated The --download flag with pip install has been removed; pip2pi now uses pip download. ↓
fix Use pip2pi 0.8.0+ which uses pip download internally.
breaking Python 2 support dropped. Version 0.8.2 only supports Python 3.8+. ↓
fix Use Python 3.8+ or pin to pip2pi <0.8.2 for Python 2 compatibility (not recommended).
gotcha If your requirements.txt includes packages that require compilation (e.g., numpy, scipy), pip2pi may fail because it cannot download precompiled wheels for the target platform. ↓
fix Use --wheel-dir or --find-links options to include pre-built wheels.
Imports
- pip2pi wrong
import pip2picorrectfrom pip2pi import package_name
Quickstart
pip2pi /tmp/packages -r requirements.txt