Python: What's PyPi, pip, easy_install, setuptools?
Python Package Index (PyPI)
The Python Package Index (aka PyPI) is the official third-party software repository for the Python. It is similar to Perl's CPAN.
PyPI homepage at https://pypi.org/
Note, “PyPi” is often stylized as PyPI, and it is not “PyPy”. PyPy is Python interpreter and JIT compiler.
Python Package Manager (pip)
pip
(package manager). pip is a is a command-line program used to {install, remove, update, …} software packages written in Python.
pip home page is at https://pypi.python.org/pypi/pip
Python EasyInstall
easy_install
is a package manager for the Python programming language that provides a standard format for distributing Python programs and libraries (based on the Python Eggs wrapper). easy_install is a module bundled with setuptools, a third-party library meant to enhance the Python standard library's distutils (Distribution utilities).[1] It is analogous to RubyGems for the Ruby programming language.
By default, EasyInstall looks in the Python Package Index (PyPI) for the desired packages and uses the metadata there to download and install the package and its dependencies. It is also hosted itself on the PyPI.
Python Eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects.
EasyInstall is not a fully fledged package manager. It cannot list local packages nor update them all. Pip and distribute are Python applications designed to fulfil the same role as easy_install. Distribute was created specifically due to the lack of progress in easy_install development. [2] Start from 0.7, EasyInstall merged distribute.
“Eggs are to Pythons as Jars are to Java…” — http://peak.telecommunity.com/DevCenter/PythonEggs
./easy_install --help Global options: --verbose (-v) run verbosely (default) --quiet (-q) run quietly (turns verbosity off) --dry-run (-n) don't actually do anything --help (-h) show detailed help message --no-user-cfg ignore pydistutils.cfg in your home directory Options for 'easy_install' command: --prefix installation prefix --zip-ok (-z) install package as a zipfile --multi-version (-m) make apps have to require() a version --upgrade (-U) force upgrade (searches PyPI for latest versions) --install-dir (-d) install package to DIR --script-dir (-s) install scripts to DIR --exclude-scripts (-x) Don't install scripts --always-copy (-a) Copy all needed packages to install dir --index-url (-i) base URL of Python Package Index --find-links (-f) additional URL(s) to search for packages --build-directory (-b) download/extract/build in DIR; keep the results --optimize (-O) also compile with optimization: -O1 for "python - O", -O2 for "python -OO", and -O0 to disable [default: -O0] --record filename in which to record list of installed files --always-unzip (-Z) don't install as a zipfile, no matter what --site-dirs (-S) list of directories where .pth files work --editable (-e) Install specified packages in editable form --no-deps (-N) don't install dependencies --allow-hosts (-H) pattern(s) that hostnames must match --local-snapshots-ok (-l) allow building eggs from local checkouts --version print version information and exit --no-find-links Don't load find-links defined in packages being installed usage: easy_install [options] requirement_or_url ... or: easy_install --help
what's setup.py?
most basic original tool python setup.py install
it requires the “distutils” module.
what's setuptools?
“setuptools” is a python module. it is used by easy_install
and pip
. For example, easy_install contains this line:
from setuptools.command.easy_install import main
What is the difference between pip and easy_install?
virtualenv
pip is most nutritious when used with virtualenv. One of the reasons pip doesn't install “multi-version” eggs is that virtualenv removes much of the need for it. Because pip is installed by virtualenv, just use path/to/my/environment/bin/pip to install things into that specific environment.
To tell pip to only run if there is a virtualenv currently activated, and to bail if not, use:
export PIP_REQUIRE_VIRTUALENV=true
easy_install
pip was originally written to improve on easy_install in the following ways:
- All packages are downloaded before installation. Partially-completed installation doesn't occur as a result.
- Care is taken to present useful output on the console.
- The reasons for actions are kept track of. For instance, if a package is being installed, pip keeps track of why that package was required.
- Error messages should be useful.
- The code is relatively concise and cohesive, making it easier to use programmatically.
- Packages don't have to be installed as egg archives, they can be installed flat (while keeping the egg metadata).
- Native support for other version control systems (Git, Mercurial and Bazaar)
- Uninstallation of packages.
- Simple to define fixed sets of requirements and reliably reproduce a set of packages.
pip doesn't do everything that easy_install does. Specifically:
- It cannot install from eggs. That's not a problem anymore though because pip supports the superior binary wheel format since the 1.4 release.
- It is incompatible with some packages that extensively customize distutils or setuptools in their setup.py files.
buildout
If you are using zc.buildout you should look at gp.recipe.pip as an option to use pip and virtualenv in your buildouts.
from [introduction to pip By Ian Bicking. At
http://www.pip-installer.org/en/latest/other-tools.html]
to install pip, do easy_install pip
pip depends on setuptools
what's “.egg” file?
Python Eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects.
setuptools understands .egg file
what's “virtualenv”?
virtualenv is a tool to create isolated Python environments.
virtualenv homepage and documentation. http://www.virtualenv.org/en/latest/
virtualenv on pypi https://pypi.python.org/pypi/virtualenv
http://dubroy.com/blog/so-you-want-to-install-a-python-package/
[On packaging By James Bennett. At http://www.b-list.org/weblog/2008/dec/14/packaging/ , accessed on 2014-01-30 ]http://www.b-list.org/weblog/2008/dec/15/pip/
http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install