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

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

  1. Python 3 Basics
  2. Python 2 Basics
  3. Python 2 and 3 Difference
  4. Print Version
  5. Builtin Help
  6. Quote String
  7. String Methods
  8. Format String
  9. Operators
  10. Complex Numbers
  11. True, False
  12. if then else
  13. Loop
  14. List Basics
  15. Loop Thru List
  16. Map f to List
  17. Copy Nested List
  18. List Comprehension
  19. List Methods
  20. Sort
  21. Dictionary
  22. Loop Thru Dict
  23. Dict Methods
  24. Tuple
  25. Sets
  26. Function
  27. Closure
  28. 2 Closure
  29. Decorator
  30. Class
  31. Object, ID, Type
  32. List Modules
  33. Write a Module
  34. Unicode 🐍

Regex

  1. Regex Basics
  2. Regex Reference

Text Processing

  1. Read/Write File
  2. Traverse Directory
  3. File Path
  4. Process Unicode
  5. Convert File Encoding
  6. Find Replace in dir
  7. Find Replace by Regex
  8. Count Word Frequency

Web

  1. Send Email
  2. GET Web Page
  3. Web Crawler
  4. HTTP POST

Misc

  1. JSON
  2. Find Script Path
  3. Get Env Var
  4. System Call
  5. Decompress Gzip
  6. Append String in Loop
  7. Timing f timeit
  8. Keyword Arg Default Value Unstable
  9. Check Page Load Size
  10. Thumbnail Generation