Python - Packages (Archive, Distribution)

Card Puncher Data Processing


Code Shipping - Archive (Distribution) in Python

Packages (or better Distribution package) are the result of the packaging of a project that may contains one or more (regular) package

Not to confound with regular package which are parents of modules. One distribution package may contains several regular package.

A package is a compressed tarball file that contains:

  • system-level libraries,
  • Python or other modules,
  • executable programs and other components.



Python - Source Distribution (sdists)



Wheel and Egg are both binary packaging formats created from compiled python file.

  • The Egg format was introduced by setuptools in 2004
  • The Wheel format was introduced by PEP 427 in 2012.

Wheel is currently considered the standard for built and binary packaging for Python.





First update the tools

python -m pip install --upgrade pip setuptools wheel

In a binary format

You can install your package:

pip install package_name
pip install "requirement-specifiers"
# Example
pip install "pyspark == 2.2.2"
easy_install package

From a tarball / source

cd /rootOfProject
python install
# or install
  • from a branch with pip
pip install 
pip install
  • by downloading the source
curl --location --output myPackage-X.X.X.tar.gz
tar xvfz myPackage-X.X.X.tar.gz
cd myPackage
# as script
python args
# as package
pip install .
  • From version control
pip install -e git+https://git.repo/some_pkg.git#egg=SomeProject          # from git
pip install -e hg+https://hg.repo/some_pkg.git#egg=SomeProject            # from mercurial
pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomeProject         # from svn
pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomeProject  # from a branch

where: VCS:

  • are detected using url prefixes: “git+”, “hg+”, “bzr+”, “svn+”.
  • command are required in the path: git, hg, svn, or bzr.

Installation Location

Install location


default global site-packages directory

(for instance /usr/lib/python2.7/site-packages)


This is the pip default

Example: install global of myPackage

pip install myPackage


The user location :

  • Default to ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.)
  • or via the env PYTHONUSERBASE

The package are then installed at USER_HOME/pythonX.X/site-packages/

To install in a user location, use the --user option of pip


pip install --user virtualenv

Virtual environment

When working in a virtual environment, the package will be installed in it. See Python - virtualenv (Python Environment)


See the –update option of pip

Example: upgrade the setuptools and wheel package

python3 -m pip install --user --upgrade setuptools wheel


Packaging task management, see cli

Reference / Specification

See Python - Pypa (Python Packaging Authority)

Documentation / Reference

Discover More
Card Puncher Data Processing
Conda - Install a PyPi Package

How to install a PyPi distribution package in the conda repository. The skeleton command get the PyPI package metadata and create the . Check that the skeleton file was created in the...
Card Puncher Data Processing
Conda - Package

in the context of the conda application Conda packages are downloaded from remote channels, which are URLs to directories containing conda packages. The conda command searches a default set of channels,...
Card Puncher Data Processing
PySpark - How to add a Jar

How to a jar file when executing a PySpark script. When starting pyspark, it had this directory in the classpath. Add your Jar there. site-packages\pyspark\jars\ With the pyspark client and...
Card Puncher Data Processing
Python - is a file found at the root directory of your project and serves two primary functions: configuration of the project command line interface for running various commands that relate to packaging...
Card Puncher Data Processing
Python - Namespace Package

Namespace packages allow you to split the sub-packages and modules within a single package across multiple, separate distribution packages And you use this package in your code like so: Then you...
Card Puncher Data Processing
Python - Project

Project in Python as describe by The project name is specified in the name properties in the setup function of the file Project are a set of file to package a package.: one package...
Card Puncher Data Processing
Python - Regular Package

A regular package is a directory containing an init file. Package can be installed via distribution package. See distribution package installation. See Their location can be chosen during...
Card Puncher Data Processing
Python - Script

in Python are source file that can be run. On Linux, begin your scripts with your interpreter. See or You can find them by executing the whereis commando: sys.argv[0] is the script name...

Share this page:
Follow us:
Task Runner