We only support the Anaconda distribution, although other Python distributions should work too.
In this work-in-progress document, we give very detailled instructions about how to install a full scientific Python distribution. This document targets beginners, and tackles things such as using the command-line interface, installing Anaconda, etc. These instructions are sometimes hard to find, scattered across many websites, blog posts, and posts on support mailing lists. Eventually, you'll find here the very minimum you need to know.
This document aims at being maintained by the community: please propose a Pull Request if an information is missing.
Anaconda is a program created by Continuum Analytics. It lets you install a Python distribution with many scientific packages like NumPy, SciPy, IPython, matplotlib, and many others. Anaconda also comes with a packaging tool named conda. This tool lets you maintain, install, and update your Python packages. It is actually more general than that, in that it can deal with any non-Python binary package.
You need to know/learn, several things before you start:
- The system terminal, or command-line interface.
- Git, a version control system.
Use Powershell.
TODO
TODO
- On Windows:
c:\users\yourname\
- On Linux:
/home/yourname/
cd subfolder
: go into a subfoldercd ~
: go in your home directoryls
(if on Windows and not in Powershell, replace bydir
)
Not strictly required, but highly recommended if you want to use obscure packages, or if you start to write significant amount of code.
TODO:
- Installing git...
- git bash...
- git GUI...
TODO
Once you're relatively confortable with the terminal and git, you can install Anaconda, a Python distribution.
Don't execute conda
or any other Python-related commands in the Anaconda directory: go somewhere else.
- Install Anaconda for Windows with Python 3.x (the latest is 3.4 in Sept. 2014).
- Don't install Anaconda with admin rights: check "Just for me" in the installer.
- Install in a path like
c:\anaconda
. - You'll be able to install Python 2.x in a separate conda environment.
- If you use Powershell, you need to use customized activate/deactivate scripts. Clone the repository, and copy them in
c:\anaconda\scripts
or similar.
TODO
TODO
conda update conda
Anaconda lets you maintain various isolated environements. You can switch to any environment at any time from the command-line.
conda info -e
- On Windows:
activate myenv
- On another OS:
source activate myenv
-
Run the following command:
conda create -n py27 python=2.7.8
(press
f` if you have a WARNING) -
You'll have no package in this new environment. Make sure to install pip!
conda install pip
conda update pip
- A profile is a set of parameters and configuration files specific to a project of yours.
- You can use different profiles for different use-cases: one profile when running code from the Cookbook, another one for your work, etc.
- Using IPython profiles is not strictly necessary, and you can do everything in the same default profile. But it is good practice to use different profiles.
ipython profile create cookbook
- Command-line interface:
ipython --profile=cookbook
- Notebook:
ipython notebook --profile=cookbook
conda install mypackage
- If that doesn't work, it needs that there is no conda package for this Python module. There are solutions.
- Important: make sure pip is installed in the currently activated environment with
conda install pip
. - Then you can try to use pip:
pip install mypackage
.