Installing CNTK v2.0 Beta

The Microsoft CNTK tool does deep neural networks and is more-or-less a direct competitor to Google TensorFlow. The CNTK v2.0 is in Beta as I write this. I figured I’d install CNTK v2.0 Beta to play around with it. The installation process wasn’t hideous but it wasn’t completely trivial.

During the installation process I grabbed screenshots every few steps. So, here’s installing CNTK v2.0 Beta in 17 screenshots. You can click on an image to enlarge.


0. Before starting the installation process I did two small preparatory steps. First I created a directory named “Local” in the C:\ root (see step #6). Second, I launched a PowerShell window with Administrative privileges and issued a “set-executionpolicy unrestricted” and then minimized the shell for use later (see step #11).


1. I went to the CNTK Releases Web page at https://github.com/Microsoft/CNTK/releases and scrolled down to the v2.0 Beta 11 section. (These instructions should work for later releases but for sure they work with Beta 11). I selected the CPU-only version because my machine didn’t have a GPU.

01_releasespage


2. I accepted the various license agreements. Yawn.

02_acceptdownload


3. The download is a zip file. I selected Save (I could have done Save As).

03_savethezipfile


4. After the download of the zip file finished, I opened the download directory in a File Explorer window.

04_downloadcomplete


5. I right-clicked on the zip file and selected the Extract All option from the context menu.

05_extractzippedfiles


6. Before starting the install process, I had created a C:\Local directory because later on CNTK puts a lot of files there by default. I extracted the zip file into C:\Local.

06_extracttoc_local


7. There is a root cntk directory.

07_directorystructureroot


8. Inside the cntk root directory there is another cntk directory (groan) that holds the core CNTK DLLs.

08_directorystructurecore


9. The setup instructions tell you to create a new User Environment variable named MYCNTKPATH but I don’t think it’s ever used.

09_optionaluservariable


10. The setup instructions didn’t say to edit the System PATH variable to point to the CNTK DLLS but I did so anyway. Not sure if it’s needed or not, but because my install eventually worked, it seems OK to create such a path.

10_editpath


11. To install CNTK you run a PowerShell script. I launched PowerShell with Administrative privileges. I checked my execution policy to make sure I could actually run scripts. I issued a install.ps1 command to run six sub-scripts. You can either unblock each or enter ‘R’ to run each.

11_powershellruninstallscript

11_powershelltrialinstallcomplete


12. The first run of install.ps1 command is really just a trial run of the install to see if anything blows up. So now I ran “install.ps1 -execute” to actually run the install script.

12_powershellinstallexecute


13. CNTK 2.0 has a new Python interface and part of the installation is an Anaconda distribution which includes Python + NumPy + SciPy + kitchen sink.

13_powershellinstallinprogress


14. The Anaconda part of the install runs in a separate command shell. It takes about 10 minutes.

14_powershellinstallcomponentsinprogress


15. The “install complete” message was a pleasant result. . .

15_installcompletesortof


16. I closed PowerShell. But to actually activate the installation I had to run a post-install cntkpy35.bat script in an ordinary command shell. Notice that my shell didn’t recognize python at first. After the post-install install script finished, I ran the FeedForwarNet.py example by typing python FeedForwardNet.py (which didn’t get captured in the screenshot) . It worked. Somewhat unusually, the documentation says you have to run the cntkpy35.bat activation script in order to run any CNTK script written in Python. Somewhat strange but eh.

16_runpostinstallbatfileandexample


17. I finished by running the Logistic Regression example which uses the CNTK BrainScript language which used to be the primary CNTK interface (it seems as if Python is the interface of choice now).

17_runbrainscriptexample


Whew. Now I’m ready to try a few of my own CNTK examples with Python, and I hope I’ll be somewhat prepared to install the non-Beta version of CNTK 2.0 when it’s released.

To summarize, installing CNTK isn’t like the nice process you may be used to with other Windows programs (“Next”, “Next”, “Next”) but if you follow the setup instructions closely you should have little or no trouble installing.

Advertisements
This entry was posted in Machine Learning. Bookmark the permalink.