-
Notifications
You must be signed in to change notification settings - Fork 132
Guide to Installing Python and Trackpy
- Download Anaconda, a free installer that includes Python and all the common scientific packages. It installs like any other program on Windows, OSX, or Linux.
- Double-click "Jupyter Notebook." You're up and running!
In a Jupyter notebook, press hold down Shift and press Enter to execute a command using with Python.
If you need any special packages not included in Anaconda -- including, for example, trackpy -- open up the Command Prompt / Terminal (or Jupyter, in that case, start the following commands with an exclamation mark). First try:
conda install trackpy
If that fails use the conda-forge
channel, which contains much more packages:
conda install trackpy -c conda-forge
If that still fails, you will have to obtain the source packages from PyPI. This may be elaborate on windows.
pip install trackpy
PyPI, the Python Package Index, is a collection of every public Python package. The pip
command connects to PyPI online, finds the package by name, downloads the source code, and tries to install it.
The Conda project aims to make installation faster and more reliable than pip. It is maintained by the same people who distribute the Anaconda installer.
Conda downloads and installs ready-to-use packages specific to whatever operating system you are using. (In technical terms, these are precompiled binaries.) Not every package is available through conda yet, but it's always worth trying conda
first. It's always faster than pip
, it's more user-friendly, and it's much less error-prone.
To upgrade to the latest released version of a project try:
conda update trackpy
and, if that fails,
pip install --upgrade trackpy
Again, if you want to invoke these from inside the Notebook, start with an exclamation mark (!pip install ...
).
More advanced users often like to separate Python instances into environments, so that each projects can have its own set of packages. Create an environment with name py36
and python version 3.6 as follows:
conda create --name py36 python=3.6 nb_conda trackpy
We installed nb_conda
so that Jupyter notebook sees the new environment as well.
Sometimes you may want a feature that hasn't been released yet. Some projects wait many months between official releases, and so you might decide to work with the very latest draft of their code. It's not as guaranteed to be stable, but most projects have safeguards and tests to avoid breaking their code at any point.
If you want the latest draft (a.k.a. "development version" or "master") you'll need to tell pip to get that specific version of the code, usually from a website like github where projects keep their source code. (Generally, conda does not keep recipes for building unreleased code, so it can't help in this case.)
A typical command looks like:
!pip install --upgrade http://github.com/organization_or_user_name/project_name/zipball/master
And here are some examples.
!pip install --upgrade http://github.com/matplotlib/matplotlib/zipball/master
!pip install --upgrade http://github.com/soft-matter/trackpy/zipball/master
For more advanced users, you may clone the trackpy repository using Git:
!git clone https://github.com/soft-matter/trackpy.git
And then install in development mode:
!python setup.py develop