This question already has answers here:
How to easily distribute Python software that has Python module dependencies? Frustrations in Python package installation on Unix
(2 answers)
Closed 5 months ago.
I wish to package a utility that I have created that depends on Pillow, a port of the Python Imaging Library. Is there a way to include Pillow in my own package or to automatically install Pillow upon running the setup script?
Python 3 mainly uses pip for installing packages. This is based off of setuptools and distribute. You would create the setup.py script with the requirement specified. The easiest way is to create a requirements file using pip. http://codeinthehole.com/writing/using-pip-and-requirementstxt-to-install-from-the-head-of-a-github-branch/
Command Line:
pip freeze > requirements.txt
setup.py
import setuptools
from pip.req import parse_requirements
requirements = [str(ir.req)
for ir in parse_requirements("requirements.txt", session=uuid.uuid1())
if ir.req is not None]
setuptools.setup(..., install_requires=requirements)
If you want to build an executable then the process if fairly similar to the standard setup.py file approach only you use cx_freeze.
Related
This question already has answers here:
How to install packages offline?
(12 answers)
Closed 5 months ago.
I am not able to use PIP on this device, so I need to install a module manually. The only problem is that I have to install like 30 dependencies of this module. I would have to download, unzip, include and install them all one by one.
Is there any faster way, like downloading a module with all its dependencies included?
If all requirements are pip packages, a quick solution might involve creating a lean python environment on another machine, installing the package using pip, and then copying over all of the resultant wheel files to the restricted machine either via SSH or another method.
This question already has answers here:
Install python wheel file without using pip
(2 answers)
Closed 4 years ago.
I have downloaded .whl and trying to install it. Can you tell me the possible ways of installing wheel without using pip.
For tar.gz files, I executed python setup.py install and it installed my package.
How the same can be done for wheel when there is no setup.py file in it?
.whl: A compressed file like Zip Achieve.
How to install?
Install Winrar or other software that can extract compressed files.
Extract your .whl file in a safe folder.
Add that directory to your Path Variables.
Now everything is done.
It's bad practice to install a .whl file. You should use PIP.
Well, I recommend you to extract your .whl file in that folder where all Python modules are installed.
This question already has answers here:
How to install Python packages from the tar.gz file without using pip install
(7 answers)
Closed 5 years ago.
I have downloaded the tar file of the Python geohash package
I import functions from this package to use them inside my python programs. It works completely fine, but only inside its own folder, where it is extracted.
If I intend to use this package in any other location, it doesn't simply import that package.
What should I do if I want to use it anywhere in my system ?
(the package is only available through this tarfile, not through pip/sudo apt-get)
Simply untar/unzip the file and make sure you have setup.py visible. From you command prompt in windows or linux. Go to the dir of the package which you just unzipped/untarred and dir/ls to make sure that setup.py is there and then do the following:
If you are using virtualenv:
/path-to-your-venv/venv/bin/python setup.py install
If you are not using virtualenv
python setup.py install
This question already has answers here:
How to use pip with Python 3.x alongside Python 2.x
(11 answers)
Closed 6 years ago.
I am trying to install the yweather module for python 3.5 on my mac using pip install, however as i have both python 3.5 and 2.7 i don't know how to specify which distribution to install the module for - how would you do this?
pip will install a module for the default python on your system. If you want to be sure that pip installs for a specific version, use pip2 or pip3 instead of pip.
Also if you aren't already, you should consider using virtual environments.
As seen in the docs
Download the most recent release from yweather’s PyPi page. Unpack the
tarball. From inside the yweather-0.X directory
Python 2
python setup.py install
Python 3
python3 setup.py install
This question already has answers here:
How can I make setuptools install a package that's not on PyPI?
(4 answers)
Closed 8 years ago.
I want to pull the live version of a package as a dependency of another package I install with pip.
Now, I have already found out how to install a live version of a package via pip; and that is not the question I am asking here.
I'd like to know whether I can pull in a live dependency version (e.g. from the PyPI index) - at present I was only able to set up tarballs via PyPI.
In your setup.py, do:
from setuptools import setup
setup(
...
install_requires=[
'a_required_pypi_package',
'another_package_in_pypi>=minimum_version'
]
...
)
and pip, setup.py install or setup.py develop will take care of it.
However the requirement will be considered satisfied, if any version of a_required_pypi_package is installed. This is especially true, if you use pip freeze to write a requirements.txt and use it to install packages.