Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: install package offline with dependencies with Pip?

I have created a package which I can install with internet connection but I need to install it now without Internet connection so I need to download all external dependencies and install them from sources.

How can I install Python package from sources with external packages requiring internet connection? In other words, how can I make pip to look for local sources and not external sources in the installation?

like image 566
hhh Avatar asked Jul 14 '26 23:07

hhh


1 Answers

This question seems to have already been answered here

However, here is a quick summary:

  1. Upload your package to the Python Package Index (PyPI)
  2. Download the package using pip on a machine with internet connection, then turn the package into a .tar file

    mkdir ~/some_directory
    pip download some_package -d "~/some_directory"
    tar -cvfz some_package.tar some_directory
    
  3. Once in .tar format, you can install the package without internet connection on a machine with Python.

    tar -xzvf some_package.tar
    cd some_directory
    pip install some_package-x.x.x-py2.py3-x-x.whl -f ./ --no-index
    
like image 126
John Laboe Avatar answered Jul 16 '26 15:07

John Laboe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!