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

PythonInstallationPackages

Python Problem Overview


Long story short my work computer has network constraints which means trying to use pip install in cmd just leads to timing out/not finding package errors.

For example; when I try to pip install seaborn: enter image description here

Instead I have tried to download the tar.gz file of the packages I want, however, I do not know how to install them. I've extracted the files from the tar.gz file and there is a "setup" file within but it's not doing much for me.

If someone could explain how to install python packages in this manner without using pip install on windows that would be amazing.

Python Solutions


Solution 1 - Python

You may use pip for that without using the network. See in the docs (search for "Install a particular source archive file"). Any of those should work:

pip install relative_path_to_seaborn.tar.gz    
pip install absolute_path_to_seaborn.tar.gz    
pip install file:///absolute_path_to_seaborn.tar.gz    

Or you may uncompress the archive and use setup.py directly with either pip or python:

cd directory_containing_tar.gz
tar -xvzf seaborn-0.10.1.tar.gz
pip install seaborn-0.10.1
python setup.py install

Of course, you should also download required packages and install them the same way before you proceed.

Solution 2 - Python

You can install a tarball without extracting it first. Just navigate to the directory containing your .tar.gz file from your command prompt and enter this command:

pip install my-tarball-file-name.tar.gz

I am running python 3.4.3 and this works for me. I can't tell if this would work on other versions of python though.

Solution 3 - Python

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 setup.py install had to point cmd towards the correct folder. I did this by pushd C:\Users\absolutefilepathtotarunpackedfolder
  • Then run python setup.py install

Thanks Tales Padua & Hugo Honorem

Solution 4 - Python

Install it by running

python setup.py install

Better yet, you can download from github. Install git via apt-get install git and then follow this steps:

git clone https://github.com/mwaskom/seaborn.git
cd seaborn
python setup.py install

Solution 5 - Python

For those of you using python3 you can use:

python3 setup.py install

Solution 6 - Python

If you don't wanted to use PIP install atall, then you could do the following:

  1. Download the package
  2. Use 7 zip for unzipping tar files. ( Use 7 zip again until you see a folder by the name of the package you are looking for. Ex: wordcloud)

Folder by Name 'wordcloud'

  1. Locate Python library folder where python is installed and paste the 'WordCloud' folder itself there

Python Library folder

  1. Success !! Now you can import the library and start using the package.

enter image description here

Solution 7 - Python

Is it possible for you to use sudo apt-get install python-seaborn instead? Basically tar.gz is just a zip file containing a setup, so what you want to do is to unzip it, cd to the place where it is downloaded and use gunzip -c seaborn-0.7.0.tar.gz | tar xf - for linux. Change dictionary into the new seaborn unzipped file and execute python setup.py install

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionyenoolnairbView Question on Stackoverflow
Solution 1 - PythonJérômeView Answer on Stackoverflow
Solution 2 - PythonSнаđошƒаӽView Answer on Stackoverflow
Solution 3 - PythonyenoolnairbView Answer on Stackoverflow
Solution 4 - PythonTales PáduaView Answer on Stackoverflow
Solution 5 - PythonShersha FnView Answer on Stackoverflow
Solution 6 - PythonSVKView Answer on Stackoverflow
Solution 7 - PythonDeusdeorumView Answer on Stackoverflow