Python 2

Python 2 is installed in a separate conda environment called py27. This container uses the anaconda python distribution.


In [1]:
!which python


/home/jupyter/conda/envs/py27/bin/python

In [2]:
!python --version


Python 2.7.10 :: Continuum Analytics, Inc.

Installing additional packages

In python 2 notebooks you get everything that is installed in this environment. This container is a "base" container, to further customise it you should create your own docker container that inherits from this one and install things there.

To quickly try out a new package from the notebook simply run:


In [3]:
!conda install -n py27 -y scikit-learn


Fetching package metadata: ....
Solving package specifications: .................
Package plan for installation in environment /opt/conda/envs/py27:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    openssl-1.0.2d             |                0         3.2 MB
    nose-1.3.7                 |           py27_0         194 KB
    python-2.7.10              |                2        12.0 MB
    scikit-learn-0.16.1        |      np110py27_0         7.8 MB
    ------------------------------------------------------------
                                           Total:        23.1 MB

The following NEW packages will be INSTALLED:

    nose:         1.3.7-py27_0      
    scikit-learn: 0.16.1-np110py27_0

The following packages will be UPDATED:

    openssl:      1.0.1k-1 --> 1.0.2d-0          
    python:       2.7.10-1 --> 2.7.10-2          

Fetching packages ...
openssl-1.0.2d 100% |################################| Time: 0:00:03 866.70 kB/s
nose-1.3.7-py2 100% |################################| Time: 0:00:00 310.43 kB/s
python-2.7.10- 100% |################################| Time: 0:00:13 897.75 kB/s
scikit-learn-0 100% |################################| Time: 0:00:15 540.90 kB/s
Extracting packages ...
[      COMPLETE      ]|###################################################| 100%
Unlinking packages ...
[      COMPLETE      ]|###################################################| 100%
Linking packages ...
[      COMPLETE      ]|###################################################| 100%

In [4]:
# You now have scikit-learn
import sklearn

In [ ]: