Installing from TestPyPI with Requirements: Overcoming Package Dependency Challenges
Encountering errors when attempting to install a custom Python package from TestPyPI due to missing dependencies? This issue arises when requirements specified in the setup.py file cannot be located on TestPyPI.
To address this, employ --extra-index-url:
python -m pip install --extra-index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple poirot
With this modification, TestPyPI becomes the primary source for your package (poirot), while dependencies are retrieved from the regular PyPI server.
Original Issue:
Users faced an error wherein tqdm and Jinja2, dependencies of the poirot package, could not be found on TestPyPI. This hindered the installation process.
Solution:
By specifying --extra-index-url as shown above, you can ensure that required packages are located on the appropriate servers. TestPyPI will host your package, while dependencies not found on TestPyPI will be sourced from the official PyPI repository.
Note:
Warning: Exercise caution when using --extra-index-url with private PyPI servers. It can pose security risks. Refer to A. Sottile's video for further insights into potential hazards.
The above is the detailed content of How to Install a Python Package from TestPyPI When Dependencies Are Missing?. For more information, please follow other related articles on the PHP Chinese website!