How to Install Python Packages from the Tar.Gz File Without Using Pip Install

How to install Python packages from the tar.gz file without using pip install

Thanks to the answers below combined I've got it working.

  • First needed to unpack the tar.gz file into a folder.
  • Then before running python install had to point cmd towards the correct folder. I did this by pushd C:\Users\absolutefilepathtotarunpackedfolder
  • Then run python install

Thanks Tales Padua & Hugo Honorem

force pip to build from source (tar.gz), not the wheel (.whl)

If you have a .tar.gz file you can simply install it with pip:

pip install foobar.tar.gz

Also, see pip option --no-binary in the documentation. Use :all: to force compilation of all packages, or specify a list of packages to compile.

pip install --no-binary :all: foobar
pip install --no-binary numpy,scipy foobar

To install h5py from sources do

pip install --no-binary h5py h5py

This will still use wheels for all other packages that might be installed as a dependency.

installing python packages without internet and using source code as .tar.gz and .whl

This is how I handle this case:

On the machine where I have access to Internet:

mkdir keystone-deps
pip download python-keystoneclient -d "/home/aviuser/keystone-deps"
tar cvfz keystone-deps.tgz keystone-deps

Then move the tar file to the destination machine that does not have Internet access and perform the following:

tar xvfz keystone-deps.tgz
cd keystone-deps
pip install python_keystoneclient-2.3.1-py2.py3-none-any.whl -f ./ --no-index

You may need to add --no-deps to the command as follows:

pip install python_keystoneclient-2.3.1-py2.py3-none-any.whl -f ./ --no-index --no-deps

Installing downloaded tar.gz files with pip

You can install tar.gz with pip Install a particular source archive file.

pip install ./Package-1.0.4.tar.gz

You can also install it with extracting tar.gz file. First you should extract it using using tar command.

tar -xzvf PyGUI-2.5.4.tar.gz
cd PyGUI-2.5.4.tar.gz

And then use the file to install the package .

python install


sudo python install

( use sudo only in linux )


Installing python pip package from tar.gz with extra includes

From the pip changelog:

7.0.0 (2015-05-21)

  • Allowing using extras when installing from a file path without requiring the use of an editable (PR #2785).

Some Linux distros bundle very old versions of pip when using the system packages for virtualenv or venv. Update pip after creating your env.

pip install -U pip
pip install package.tar.gz[name]

Installing a module in Python using the source file (*.tar.gz)

First of all, you can still use pip to install downloaded source archives or wheels. Just point pip to the file:

pip install pdfminer.six-20170720.tar.gz

As for why your pip installation is broken: Due to path length issues on Windows, Anaconda had moved the pip vendored packages to normal dependencies (pip vendors packages to avert problems exactly like you have now).

You then installed a package (like Tensorflow), that requires an older version of one of the pip dependencies, html5lib. This caused everything to break, horribly.

You should be able to fix the pip issue with

conda update pip

as the newer version has returned to vendored dependencies (after a bugfix upstream that avoids the path length issues).

For more details, see this issue in the Tensorflow project, which is one such project that needed an older html5lib version and triggered the same problem.

Related Topics

Leave a reply