Python Environment Overview

Python Environment Overview

Last updated:
Table of Contents

There are many Python tools whose use is not obvious to someone who has only recently started using Python.

Here is a quick list that clarifies a couple of things you will hear about when using Python.

Distutils

A tool used to package Python projects. Now deprecated, use Setuptools instead.

EasyInstall

also written easy_install

A tool used to manage Python dependencies.

Use Pip instead.

Egg files

A format used to distribute Python projects.

Now deprecated, use Wheel files instead.

Pip

A package manager for projects hosted at PyPi.

  • It's a replacement for EasyInstall.

  • Very simple to use: $ pip install <libname>.

  • Similar to RubyGems.

  • Works nicely with Virtualenv

PyPa

Check Package a Python Project and Make it Available via pip install for an example of how to create a library and publish it to PyPa

PyPa is short for Python Packaging Authority.

An organization that defines and oversees everything related to packaging Python projects.

Projects such as Pip and Virtualenv are part of PyPa.

PyPi

Upload a python package to pypi: Example

PyPi is short for Python Package Index.

It's a repository for Python packages.

  • This is where Pip downloads and installs packages from

Setuptools

A tool for packaging Python projects. It's a replacement for Distutils.

Uses a file named setup.py located in a project's root (see the links below for a full example on how to package a python project)

Virtualenv

A tool you can use to install Python packages (via Pip) all in a single directory rather than globally on your system.

  • Supports different Python versions and environments in the same machine

  • If you mess up things, just delete the Virtualenv and start again

  • Works nicely with Pip

Wheel files

A format used to distribute Python projects. It's a replacement for Egg files.

  • Wheel files can be created using Pip: $ pip wheel ...

  • Wheel files can be directly installed using Pip:

    • So if for some reason pip install <my_package> gives you trouble, you can try to manually download the wheel file for that project and then do pip install <my_package>.whl instead.

Anaconda

Anaconda is a Python distribution aimed at data science and machine learning workflows.

You can download Anaconda for Windows, Linux, MacOS, etc.

It includes most common Python data science packages such as numpy, pandas, scipy, matplotlib, scikit-learn, etc.

Conda

It's a package manager and enviroment manager for Python but also for other languages.

Conda enables you to:

  • Create/activate enviroments (conda create, conda activate)

  • Keep track of all enviroments in your machine (conda info --envs)

  • Install conda packages in the global scope or within a separate enviroment (conda install)

  • List packages installed in the current enviroment (conda list)

Miniconda

It's an installer for Conda.

Conda vs Pip

Roughly, Conda == Pip + Virtualenv

They are not directly comparable as they do different things.3

Conda Pip
Package manager and
enviroment manager
Package manager only
Installs packages available on Anaconda1
and conda-forge
Installs packages available on PyPi
Tracks all enviroments
in your system.
There is no centralized management
for all virtualenvs in a system.

Conda install vs Pip install

Both commands install a given package into the current environment (either a conda environment or a virtualenv, respectively).

Conda install Pip install
Downloads and installs prebuilt binary packagesDownloads source files and builds
Python packages on your machine.2
Installs packages from Anaconda repos
and other sources such as conda-forge
Installs packages from PyPi


1: On newer versions of conda (4.6+), you can download Pip from within conda and then install and track packages via Pip.

2: Unless you directly install a wheel file, in which case it is already prebuilt for your OS/architecture.

3: See Conda vs Pip and Virtualenv: Commands Compared for detailed comparison on equivalent commands for both frameworks.


Other relevant posts on this topic