Python: What's PyPi, pip, easy_install, setuptools?

By Xah Lee. Date: . Last updated: .

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.python.org/pypi

Note: “PyPI” 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?

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

from [introduction to pip By Ian Bicking. At http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install , accessed on 2014-01-31 ]

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/

Python: virtualenv Tutorial

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.quora.com/Python-programming-language-1/What-are-the-differences-between-Pythons-easy_install-and-pip-for-package-managment-and-installation

http://www.b-list.org/weblog/2008/dec/15/pip/

http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install

If you have a question, put $5 at patreon and message me.

Python 3

Lang Detail

  1. Print Version String
  2. Quoting String
  3. String Operations
  4. Format String
  5. Operators
  6. Object, ID, Type

Misc

  1. Traverse Directory
  2. Sort List, Matrix, Object
  3. Python 3: Map with Side Effect Doesn't Work If Result is Not Used
  4. Python 3 Closure
  5. Python 2 and 3 Difference