Installing MxNet on Windows

I was not able to find clear, good documentation for installing MxNet on Windows. Is MXNet “really” supported on Windows?

Can someone knowledgeable please provide clear instructions for installing the pre-built MxNet packages on Windows?

Here is my saga of trying to do this so far. Queries by others on the internet seems to suggest installing MXNet on Windows has been difficult for others as well. Clear instructions will help a lot.

  • Went to the Install tab of MXNet website. I first selected the “Windows”, “Python”, “CPU” combination. Wow, that gives a blank page! I consoled myself saying “OK, don’t bother about the CPU version for now; let me get the GPU version”.
  • So, I selected the “Windows”, “Python”, “GPU” combination. The resulting page is confusing. At the top it says “Follow the installation instructions in this guide to set up MXNet.” and near the bottom it says “Install MXNet with GPU support using CUDA 8.0” and then gives the command “pip install mxnet-cu80==1.0.0”.
  • I first tried the “pip install mxnet-cu80==1.0.0”. Ouch, pip says “Could not find a version that satisfies the requirement mxnet-cu80==1.0.0”. Seems like only older versions of MxNet are available via pip on Windows??
  • Alright, now that pip install didn’t work, I thought I shall try the other way, by following the “Follow the installation instructions in this guide to set up MXNet.”. So, I clicked on the link for “this guide” which took me to a page titled “Installing MxNet in Windows”.
  • One set of instructions there are for building the libraries yourself. Another more attractive option listed there is “Installing the Prebuilt Package on Windows”. So, I decided to go for the latter.
  • I followed the link given with “Download the latest prebuilt package from the Releases tab of MXNet.”. Clicking the “Releases” link there took me to the following page: https://github.com/apache/incubator-mxnet/releases.
  • Ouch! Bad luck again. The promised pre-built binaries can’t be found there! I could find only source code zip.
  • Alright, after spending some time Googling, I found that people stopped posting the pre-built packages for Windows at that location (without updating the link at the MXNet site?). Instead, the new place to find the pre-built binaries seems to be https://github.com/yajiedesign/mxnet/releases.
  • So, I go to that page. Sure enough, there are some 7z packages there. But, I could not find any instructions there about what to do with those packages!
  • After some Googling around again and reading random posts by people who have tried going through the pain before, I downloaded “prebuildbase_win10_x64_vc14_v2.7z” and “prebuildbase_win10_x64_vc14_v2.7z”. Wondered what should be done with them…
  • Anyway, created the folder called “C:\MxNet” as suggested in some of those (rather old) random posts and extracted the first package there.
  • Now, where exactly should the second package be extracted into? I guessed that the second package is probably intended to be extracted so that the “lib” and “include” folders created by the two packages are same. Was that really correct guess? Anyway, as per that wild guess, I placed the contents of those two packages so that the “lib” and “include” folders of the two align.
  • The “README.txt” file there says to download CUDNN. But, I also see that the cudnn dlls are included in the “prebuildbase_win10_x64_vc14_v2.7z”. So, is downloading CuDNN from NVidia site really necessary (i.e., README.txt not updated after beginning to include CUDNN dll)? Anyway, to be safe, I downloaded and installed CUDNN from NVidia site also.
  • Opened a command prompt from the folder C:\MXNet and ran “setupenv.cmd”.
  • Now, from the README file, I was supposed to run setup.py in c:/MXNet/python folder. So, I brought up Anaconda prompt, went to the folder c:\MXNet\python and ran “python setup.py install”. That ran fine.
  • After this, I go to Anaconda prompt and try “import mxnet”. But, that gives “module not found” error. What should I do for this?

Thank you.
P.S. I am using Anaconda distribution of Python.

No replies so far :weary:

Are the active developers reading the messages on this group?

In contrast to the difficulties of installing MXNet on Windows, installing Theano on Windows needed just one line:

conda install theano

Though I haven’t done it yet, installing TensorFlow would be just one line as well since the package does show up on “conda search tensorflow”.

Wish installing MxNet was that simple!

Please provide your review comments by using the steps in this PR: https://github.com/apache/incubator-mxnet/pull/8619

Hi,

I have successfully built it on Windows 10, VS2015. I will try to contribute my method in a couple of days.

But you should know I used the free MKL library from Intel instead of OpenBLAS.

1 Like

Btw, I was talking about the C++ DLL :slight_smile:

For Python, try doing pip install mxnet-cu80 (if you have CUDA 8).

Doing “pip install mxnet-cu80” did not work. I get the error saying “GPU is not enabled”. I had separately installed CuDnn from NVidia site as well.

To build and install MXNet yourself, you need the following dependencies. Install the required dependencies:

  1. If Microsoft Visual Studio 2017 is not already installed, download and install it. You can download and install the free community edition. (https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15)

  2. Download and Install CMake GUI version if it is not already installed.

  3. Download and install OpenCV.

  4. Unzip the OpenCV package.

  5. Set the environment variable “OpenCV_DIR” to the value “OpenCV build directory”.

  6. If you don’t have the Intel Math Kernel Library (MKL) installed, download and install OpenBlas.

  7. Set the environment variable “OpenBLAS_HOME” to point to the “OpenBLAS” directory that contains the “include” and “lib” directories. Typically, you can find the directory in “C:\Program files (x86)\OpenBLAS”.

  8. Download and install CuDNN. To get access to the download link, register as an NVIDIA community user.

After you have installed all of the required dependencies, build the MXNet source code:

  1. Download the MXNet source code from GitHub.
  2. Open native tools command prompt for Visual Studio 2017( choose x64 or x86 native as required)
  3. Start CMake GUI tool installed previously, from within this command prompt
  4. In the CMake tool UI, “Browse Source” button and navigate to folder where MXNet source is downloaded. For example -"/GitHub/incubator-mxnet"
  5. Create a folder under “/GitHub/incubator-mxnet”, say releasex64
  6. Click “Browse Build…” and choose folder created above
  7. Click “Configure” button, a dialog prompt appears for choosing generator
  8. Choose appropriate generator, for example Visual Studio 2017 Win64, if building for x64
  9. Retain “use default native compilers” option
  10. Click Finish
  11. Click “Open Project” to open the generated project in Visual Studio IDE
  12. Choose “ALL_BUILD” and build the configuration that you want to build
  13. Find libmxnet.dll under the folder created in step 5 above for example “\GitHub\incubator-mxnet\releasex64\Debug\libmxnet.dll”
1 Like

There is a easy way to install mxnet directly without building it:
1.Install anaconda.

2.New folder, New file naming environment.yml.
Write it.

name: gluon
dependencies:
- python
- jupyter
- matplotlib
- pandas
- pip:
  - requests
  - mxnet>=0.11.1b20171003

3.Enter the folder using cmd window.

conda env create -f environment.yml
activate gluon

OK, you can use it.

If you want to use GPU,

pip uninstall mxnet
pip install --pre mxnet-cu75 # CUDA 7.5

or

pip uninstall mxnet
pip install --pre mxnet-cu80 # CUDA 8.0

Remver do it under (gluon) environment by the command “activate gluon”.
Rember to install CUDA before it.

This is a toturials about deep learning with MXNet ,which includes environment.yml file.

Running “Configure” from CMake GUI tool (3.10.2) on OpenBLAS (0.2.20) says CMake support is experimental and only X86 support is currently available (alas I’m building for x64).

If you have windows 10 related problem visit the link below to find the easiest solutions.
Windows 10 help guide

I am having also trouble to build it with Visual Studio 2015 basically the CMake fails with following error:
CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeDetermineCompilerId.cmake:251 (message):
No CUDA toolset found.
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeDetermineCompilerId.cmake:31 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeDetermineCUDACompiler.cmake:73 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:52 (project)

which is odd as I have CUDA8 and CuDNN7 installed on the machine I am trying to build and have run succesfully other CUDA/CUDNN based frameworks like CNTK also the paths are set in the environment. But what is even more odd that error message is coming out of CMake internal script

This is a real nightmare to build after installing CUDA 9 and CUDNN7.1 for it I got CMake to proceed, just to realize that you have to switch some of the options off and you actually have to clone some of the repositories that are linked in the 3rd party (great that no one mentions that and not a single word is dropped that this are external dependencies in the documentation). Although even that I finally get a solution file I can load and some of it actually builds just then to stumble over tvm_bridge.cc in mxnet project. According to the file the description in the .cc file this should be optional? But it really doesn’t seem to be. Can I simply remove it from the solution?

Hi, thank you for detailed guide!
I’m using conda and pytorch on Windows, and it’s installation is easy via pip. Taking in account that I have all nVidia CUDA and CuDNN installed.
Is it obligatory to compile MXnet from source, or following this guide with 1 line of code might be enough?
$ pip install mxnet --pre

https://mxnet.incubator.apache.org/install/index.html

Does this installation includes MXNet server for serving machine learning models?

Regards
Igor

Hello,

It is not mandatory to compile from source unless you have specific needs that require you to build MxNet from source.

The said pip package will install MxNet engine alone.

For MxNet Model server, please refer Introducing Model Server for Apache MXNet | Amazon Web Services

Introducing Model Server for Apache MXNet | Amazon Web Services

Earlier this week, AWS announced the availability of Model Server for Apache MXNet, an open source component bui…

Thanks

Eftiquar

I followed this instruction to install mxnet on a clean Windows 10 machine. I got the following error when importing numpy. Any idea?

Traceback (most recent call last):
File “C:\Users\wei16\Anaconda3\envs\gluon\lib\site-packages\numpy\core_init_.py”, line 16, in
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\Anaconda3\envs\gluon\lib\site-packages\numpy_init_.py”, line 142, in
from . import add_newdocs
File “C:\Users\Anaconda3\envs\gluon\lib\site-packages\numpy\add_newdocs.py”, line 13, in
from numpy.lib import add_newdoc
File “C:\Users\Anaconda3\envs\gluon\lib\site-packages\numpy\lib_init_.py”, line 8, in
from .type_check import *
File “C:\Users\Anaconda3\envs\gluon\lib\site-packages\numpy\lib\type_check.py”, line 11, in
import numpy.core.numeric as nx
File "C:\Users\Anaconda3\envs\gluon\lib\site-packages\numpy\core_init
.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you’re working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: DLL load failed: The specified module could not be found.

Hi Kasianenko,

I am unable to install MxNet on Windows still, can you please guide me. My laptop has got Nvidia Quadro P2000 and I can’t get my head around installing CUDA and CuDNN and all the dependencies.

Can you please show me the steps you took to set up your system. Thank you.

Regards,
Ikenna

Hello Ikenna,

It has been 2 years, and I didn’t work on windows with deep learning frameworks since then. Somehow all my experience with deep learning frameworks on Windows were negative. I’d recommend you using free or paid cloud platforms. For tests and prototyping Google Colab and free kernels on Kaggle are amazing. You get 30 hours of GPU more powerful than laptop. If your aim is to train models longer, I doubt that you want to use laptop.

All installations and running was so much easier on Ubuntu, that if you may install it alongside Windows you may get better performance and more instructions for installation.
In my humble opinion time that you can spent on installation on windows is better to spend on working in cloud. You may chose literally from 10 platforms (list is here).

But if you have to install it - find tutorial on installing CUDA and CUDnn on windows, something like this official Sorry, new users can only put 2 links in a post. be ready to fix tens of errors, and then install conda from official Sorry, new users can only put 2 links in a post. and run one comand in conda command prompt with admin rights

$ pip install mxnet --pre

@kasianenko Thanks alot for the information. I found it really useful, and have decided to go with Paperspace Gradient. So I will avoid going through the hassles of installing the libraries on Windows.

I’ve also come across Practical Deep Learning for Coders, v3 and hoping to explore all these. Thanks to you.