Skip to content

Setup Windows Python

Chris Basoglu edited this page Feb 24, 2017 · 38 revisions

Installing CNTK for Python on Windows

These instruction apply to CNTK 2.0 Beta 12

This site describes the PIP install of CPU-only version CNTK on Windows. If you want to install the GPU or 1bit-SGD CNTK version for Python or any form of distributed training with CNTK, you will have to use the script based installation (PIP install for the other versions will follow shortly). If you are looking for any other kind of support in setting up CNTK you should go here instead.

Depending on the Python and CNTK version (CPU, GPU, 1bit-SGD) we supply different WHL-files to install CNTK. Please select the correct installation from the table below, and substitute the name and/or link during the installation.

Python CNTK Version URL
2.7 CPU https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp27-cp27m-win_amd64.whl
3.4 CPU https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp34-cp34m-win_amd64.whl
3.5 CPU https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp35-cp35m-win_amd64.whl

Anaconda

We have tested CNTK with Anaconda3 4.1.1 and Python versions 2.7, 3.4 and 3.5.

If you do not have an Anaconda installation, install Anaconda3 4.1.1 Python for Windows. Newer versions of Anaconda will default to Python 3.6 and are not yet supported.

In the following, we assume Anaconda3 is now installed and that it is listed before any other pythons in your PATH

PIP install into Anaconda root environment

PIP is used to install CNTK into the Anaconda root environment and not into a separate environment. An installation in the root environment might impact other Python-based installations. This is the easiest installation option and you will only need a couple of commands.

  • If you already have a version of CNTK installed in the Anaconda root environment root you need to uninstall it by entering pip uninstall cntk from your command prompt. As an alternative you can also upgrade your existing installation by pip install --upgrade --no-deps <url> (<url> is the corresponding WHL-file URL in the table on the top of this page).

We will install a CPU-only CNTK in the Anaconda Python 3.5 root environment. Start a standard command prompt. We assume Anaconda3 is in your path.

To install the CPU version:

c:\> pip install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp35-cp35m-win_amd64.whl

At the end of the installation you will receive a message like Successfully installed cntk-2.0.beta12.0

A quick test that the installation succeeded can be done by querying the CNTK version:

c:\> python -c "import cntk; print(cntk.__version__)"

You can also install the CNTK samples/tutorials (see below) and run some of the samples to verify your installation.

You now have successfully installed CNTK, you can start developing / training / evaluating with CNTK in Python!

PIP install in an Anaconda environment

In the following we will create a new Python 3.4 environment inside Anaconda called cntk_py34 and will pip-install Anaconda into this environment. If you want a different Python version or environment name, please adjust the parameters accordingly.

Open a standard command shell, create the environment, make it active, and pip-install CNTK:

c:\> conda create --name cntk_py34 python=3.4 numpy scipy h5py jupyter
c:\> activate cntk_py34
c:\> pip install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp34-cp34m-win_amd64.whl

A quick test that the installation succeeded can be done by querying the CNTK version:

c:\> python -c "import cntk; print(cntk.__version__)"

You can also install the CNTK samples/tutorials (see below) and run some of the samples to verify your installation.

You now have successfully installed CNTK, you can start developing / training / evaluating with CNTK in Python!

Installing Samples and Tutorials

We provide various samples and tutorials with CNTK. After you installed CNTK you can install the samples/tutorials and Jupyter notebooks. If you installed CNTK into a Python environment, make sure you activated the environment before running this command:

c:\> python -m cntk.sample_installer

This will download the samples/tutorials, install the required Python packages, and copy the samples into a directory named 'CNTK-Samples-VERSION (VERSION` is replaced with the actual CNTK version) beneath your current working directory.

You can now follow the standard description to test your installation from Python and run the tutorials or Jupyter notebooks.

Clone this wiki locally