Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible compiler when installing cudamat on windows #69

Open
WKrauze opened this issue Jun 27, 2016 · 4 comments
Open

Incompatible compiler when installing cudamat on windows #69

WKrauze opened this issue Jun 27, 2016 · 4 comments

Comments

@WKrauze
Copy link

WKrauze commented Jun 27, 2016

For some time now I am trying to install cudamat on Windows 10 x64, so that later I can install gnumpy. I did quite a lot of research on the subject and now I am pretty confused.
I read, that to compile a Python module I must use the same compiler that was used to compile the Python itself. Since I have Python 3.5, that means I need to use Visual Studio 14.0 (2015). But when I type
python setup.py install
in the developer's command prompt of VS2015 when in the cudamat-master directory, I get the following error:

running install
running bdist_egg
running egg_info
writing cudamat.egg-info\PKG-INFO
writing dependency_links to cudamat.egg-info\dependency_links.txt
writing top-level names to cudamat.egg-info\top_level.txt
reading manifest file 'cudamat.egg-info\SOURCES.txt'
writing manifest file 'cudamat.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'cudamat.libcudamat' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\cudamat
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe --compiler-bindir "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN" -c -IC:\Users\Wojtek\Anaconda3\include -IC:\Users\Wojtek\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" cudamat/cudamat.cu -o build\temp.win-amd64-3.5\Release\cudamat/cudamat.obj -O --ptxas-options=-v --compiler-options=/nologo,/Ox,/W3,/GL,/DNDEBUG,/MD
nvcc fatal   : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v7.5\\bin\\nvcc.exe' failed with exit status 1

The error suggests that I cannot use VS2015... What am I doing wrong?
When I tried to use VS2013 I had the well known error "missing vcvarsall.bat".
At this point I am completely lost and would appreciate any help.

@f0k
Copy link
Contributor

f0k commented Jun 27, 2016

I read, that to compile a Python module I must use the same compiler that was used to compile the Python itself.

We don't compile a Python module that links against Python.h and can be imported directly via import thename, we just compare a shared library (or DLL in the case of Windows) to be loaded via ctypes. For this, the compiler doesn't have to match, but distutils may try to find one that matches your Python distribution (I dimly remember that Anaconda had a hack for that). We may need to implement #53 to make it easier.

When I tried to use VS2013 I had the well known error "missing vcvarsall.bat".

Actually you just need to find a way to make setup.py choose your VS2013 compiler, probably by adding it to the PATH and removing any others. Don't feel shy to look at cudamat's setup.py and add some print statements to see what's going on.
If nvcc then complains about a missing vcvarsall.bat, you either need to write one (maybe the Lasagne instructions help in this respect, they also include instructions on how to test your nvcc setup separately) or set the necessary environment variables via some other means and pass --use-local-env --cl-version 2013 to nvcc (via the NVCCFLAGS variable that our setup.py reads and passes on to nvcc).

@WKrauze
Copy link
Author

WKrauze commented Jun 30, 2016

Thank you for your answer.
I uninstalled VS2015 from the computer and added the VS2013 folder to system PATH (no other VSs are in the PATH right now), however it still doesn't see the vcvarsall.bat file. I don't understand why, since when VS2015 was installed it found it (and said that this compiler is wrong - but nevermind that, it saw the compiler). What is the difference between VS2015 and VS2013 that makes the latter one invisible?
Does it have to do anything with the x32 vs x64 version of Python? May there be any incompatibility between my 64bit Python and VS2013? I tried installing the module through python setup.py install command in:

  • standard cmd.exe
  • Developer Command Prompt for VS2013
  • VS2013 x64 Cross Tools Command Prompt
  • VS2013 x64 Native Tools Command Prompt,

with no effect.
I noticed that in my Anaconda folder in \Anaconda3\Lib\distutils folder there is no distutils.cfg file. Does it matter in any way? I would be very grateful for your help - I didn't think that installing gnumpy will be such a pain.

@f0k
Copy link
Contributor

f0k commented Jun 30, 2016

I would be very grateful for your help - I didn't think that installing gnumpy will be such a pain.

I went through similar pains to figure out how to install Lasagne on Windows so we could document it (https://github.com/Lasagne/Lasagne/wiki/From-Zero-to-Lasagne-on-Windows-7-(64-bit)). It took me a full weekend of trial and error (but I'm not a Windows user). Installing Ubuntu as a second operating system will be the easiest solution if you plan to dive into research, otherwise setup issues will hold you back again and again.

What is the difference between VS2015 and VS2013 that makes the latter one invisible? Does it have to do anything with the x32 vs x64 version of Python? May there be any incompatibility between my 64bit Python and VS2013?

These are the kind of questions you need to answer, yes. I don't have any clue. I'd really recommend to step through setup.py to see how distutils tries to figure out where your compiler lives. Who complains about vcvarsall.bat, is it Python or nvcc? Did you try to test your nvcc setup separately as I suggested above? This will help you to figure out the easier questions of which command prompt to use and what arguments to pass to nvcc. If this works, you can also duck out and follow the comments near the end of #57 to compile and install cudamat manually.

@f0k
Copy link
Contributor

f0k commented Oct 26, 2016

I've attempted to simplify cudamat's setup.py in #79 -- if you have the time, please try that and report back! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants