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 setup.py install
had to point cmd towards the correct folder. I did this bypushd C:\Users\absolutefilepathtotarunpackedfolder
- Then run
python setup.py 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 setup.py file to install the package .
python setup.py install
or
sudo python setup.py install
( use sudo only in linux )
Source: https://pip.readthedocs.io/en/stable/reference/pip_install/#git
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
Using Regex to Get the Value Between Two Characters (Python 3)
Find Value in Dictionary Using Regex in Python
How to Bold Text in Telepot Telegram Bot
Check If a Specific Class and Value Exist in HTML Using Beautifulsoup Python
Keep Other Columns When Doing Groupby
Plot Different Dataframes in the Same Figure
Get the Row(S) Which Have the Max Value in Groups Using Groupby
How to Sum Multiple Columns in a Spark Dataframe in Pyspark
Remove Timestamp from Date String in Python
How to Constantly Run Python Script in the Background on Windows
Sub Totals and Grand Totals in Python
How to Make Type Cast for Python Custom Class
How to Save\Load Models in Spark\Pyspark
How to Detect and Remove Outliers from Each Column of Pandas Dataframe At One Go
How to Split a Byte String into Separate Bytes in Python
How to Split Text Without Spaces into List of Words
How to Check All Versions of Python Installed on Osx and Centos