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

Question:

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.

Asked By: yenoolnairb

||

Answers:

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.

Answered By: Jérôme

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
Answered By: Tales Pádua

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

Answered By: Deusdeorum

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:Usersabsolutefilepathtotarunpackedfolder
  • Then run python setup.py install

Thanks Tales Padua & Hugo Honorem

Answered By: yenoolnairb

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.

Answered By: Sнаđошƒаӽ

For those of you using python3 you can use:

python3 setup.py install
Answered By: Shersha Fn

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'

3) Locate Python library folder where python is installed and paste the ‘WordCloud’ folder itself there

Python Library folder

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

enter image description here

Answered By: SVK
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.