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

354,646

Solution 1

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 2

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 3

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 4

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

For those of you using python3 you can use:

python3 setup.py install
Share:
354,646

Related videos on Youtube

yenoolnairb
Author by

yenoolnairb

Updated on August 01, 2022

Comments

  • yenoolnairb
    yenoolnairb 5 months

    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.

  • yenoolnairb
    yenoolnairb almost 7 years
    This gives the following error: You must give at least one requirement to install (maybe you meant "pip install file:///absolute path.."?)
  • yenoolnairb
    yenoolnairb almost 7 years
    and I have actually entered the path in case you're wondering!
  • yenoolnairb
    yenoolnairb almost 7 years
    No such file or directory This could be to do with the setup of my files and folders. Python isn't gonna be in the default place Python would normally install
  • Deusdeorum
    Deusdeorum almost 7 years
    Okey, so he could use another unzipper like 7-zip, it's pretty irrelevant what unzipper he uses..
  • Tales Pádua
    Tales Pádua almost 7 years
    unpack from tar, go to the folder where the setup.py is, and then run the command above
  • yenoolnairb
    yenoolnairb almost 7 years
    Do I need to amend the code above to point it directly to where the unpacked tar is? Cos I'm still getting no such file or directory
  • Deusdeorum
    Deusdeorum almost 7 years
    might be, anyhow, the instructions are: unzip the folder -> change dictionary in your command line into that folder -> execute python setup.py install
  • Tales Pádua
    Tales Pádua almost 7 years
    Unpack the tar.gz to somewhere. Then, from the terminal, go to the folder where you extracted it. You need to be on the folder where setup.py is, and then run this command
  • yenoolnairb
    yenoolnairb almost 7 years
    Unfortunatley github is blocked on my work computer!! I've got it working now though; thanks
  • Tales Pádua
    Tales Pádua almost 7 years
    Can you edit the PATH variables of your machine? If so, you can add python to it, and use python anywhere without need to use pushd
  • Jérôme
    Jérôme almost 7 years
    You can also use pip + git but I assumed network issues ruled out this option.
  • Sнаđошƒаӽ
    Sнаđошƒаӽ over 6 years
    Actually you don't have to extract the tar.gz file to install it. Take a look at my answer
  • Magic_Matt_Man
    Magic_Matt_Man almost 6 years
    Running this on python 3.4.3 and pip 9.0.1 I get an error relating to a temp file: [Errno 2] No such file or directory: '/tmp/pip-anjip21-build/setup.py running on Jessie (raspberry pi 3)
  • Hawkins
    Hawkins over 4 years
    If you can download on another machine and bring them over, it's possible to download each dependency you need and install them in this manner in such an order that the desired package has all dependencies met and does not need a network connection anymore. I.e., A depends on B. So install B, then A.
  • Sнаđошƒаӽ
    Sнаđошƒаӽ almost 4 years
    @Magic See the examples in official docs. So it should work. From the error message you showed it seems the tarball you are trying to install isn't following proper file naming conventions.
  • adin
    adin over 3 years
    This works perfect for situations where using pip generates error(10054, 'An existing connection was forcibly closed by the remote host')
  • Lev
    Lev over 3 years
    pip install *.tar.gz will install all the packages in the directory... just trying to help:)
  • Bill Wallis
    Bill Wallis over 1 year
    I was getting a whole host of different errors using the other solutions -- this was the only solution that worked for me

Related