Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 999
yenoolnairb Avatar asked Mar 15 '16 14:03

yenoolnairb


People also ask

Can you install Python packages without pip?

Most Python packages are now designed to be compatible with Python's pip package manager. But if you have a package that is not compatible with pip, you'll need manually install Python packages.

How do I install Python packages without installing them?

If you are not able to install modules on a machine(due to not having enough permissions), you could use either virtualenv or save the module files in another directory and use the following code to allow Python to search for modules in the given module: >>> import os, sys >>> file_path = 'AdditionalModules/' >>> sys.

What can I use instead of pip to install?

npm, Homebrew, Yarn, RequireJS, and Bower are the most popular alternatives and competitors to pip.


1 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.

like image 85
Jérôme Avatar answered Oct 01 '22 00:10

Jérôme