Skip to content

Setup Windows Python

Wolfgang Manousek edited this page Feb 27, 2017 · 38 revisions

Installing CNTK for Python on Windows

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

Windows CPU

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

Anaconda

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

If you do not have a Python 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 Anaconda is now installed and that it is listed before any other Python installations in your PATH

pip install without an environment

This is the easiest option and the only reason to avoid it is if you require specific versions of certain packages. For example, CNTK is known not to work with numpy <= 1.10. If you have other packages that require an old version of numpy skip to this section.

If you already have a previous version of CNTK installed, you need to uninstall it

c:\> pip uninstall cntk

or upgrade via

c:\> pip install --upgrade --no-deps <url>

where <url> is the corresponding wheel file URL in the table on the top of this page.

If this is the first time you install CNTK then

c:\> pip install <url>

where <url> is the corresponding wheel file URL in the table on the top of this page. E.g. if you have Python 3.5

c:\> pip install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.0.beta12.0-cp35-cp35m-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!

pip install in an environment

In the following we will create a new Python 3.4 environment inside Anaconda called cntk_py34 and will pip-install CNTK 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