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

Windows install issue: corecrt.h not found #80

Closed
bfh78 opened this issue Nov 7, 2016 · 12 comments
Closed

Windows install issue: corecrt.h not found #80

bfh78 opened this issue Nov 7, 2016 · 12 comments

Comments

@bfh78
Copy link

bfh78 commented Nov 7, 2016

Windows 10
Python 2.7
CUDA toolkit 8
MS Visual 14 with c++ compiler

I was attempting to get #57 "solution" to work, but when I run from the cudamat.cu dir the following...
nvcc -c -O -o cudamat.obj cudamat.cu

I get the following error...
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/../../VC/INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

It turns out that corecrt.h is found in...
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt\

I added that directory to my path variable, but I still get the same error...
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/../../VC/INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

@bfh78 bfh78 closed this as completed Nov 11, 2016
@f0k
Copy link
Contributor

f0k commented Nov 14, 2016

You'd need to add it as an include path via -I. But it seems you solved your problem?

@bfh78
Copy link
Author

bfh78 commented Nov 14, 2016

So adding C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt\ to my path via -I or just in my system variables didn't do the trick. After some google searches and reading, I realized that Microsoft created this "universal directory," which contains the corecrt.h file in the Visual 2015 release. So after too much frustration I just went and got the Visual 2013 release, which still has the corecrt.h file in the VC/INCLUDE directory.

So I got passed all that.

I can successfully run "nvcc -c -O -o cudamat.obj cudamat.cu", and for that matter, I can now successfully run the setup.py file in the cudamat directory. But once I've run the setup file, and I try to import cudamat, I get a "%1 is not a valid win32 operation".

I've tried installing cudamat with the setup.py file, and then I tried the directions provided in #57. With both methods I ultimately complete the setups seemingly successfully, but when I try to import cudamat, I get that same "%1 is not a valid win32...". I don't have the exact wording of the error text as I'm not at my desktop. I can provide it later this evening if it will help. I can obviously also provide the exact python code that is failing on the "import cudamat" call if that will help.

Really, i should just open a new issue as the above one is "fixed/worked around". I can do that if you prefer?

@bfh78 bfh78 reopened this Nov 14, 2016
@f0k
Copy link
Contributor

f0k commented Nov 14, 2016

"%1 is not a valid win32 operation"

This looks like you're compiling with 64 bits for 32-bit Python, or vice versa.

This won't help you, but if you're at it, I'd be interested if you can also get it to compile with #79.

Really, i should just open a new issue as the above one is "fixed/worked around". I can do that if you prefer?

It's okay, there's a ton of Windows installation issues already. Let's just continue discussing here.

@bfh78
Copy link
Author

bfh78 commented Nov 14, 2016

Thanks. I'll check how I'm compiling vs which python (bit) version I'm running this evening and update here. Does cudamat work fine with both 32-bit and 64-bit python? I'll also attempt #79.

@f0k
Copy link
Contributor

f0k commented Nov 14, 2016

Does cudamat work fine with both 32-bit and 64-bit python?

I've only used it with 64-bit, but I assume it would work if you don't mix them up :)

@bfh78
Copy link
Author

bfh78 commented Nov 15, 2016

Just got it working! I had previously switched my python interpreter to a 32-bit version when I was trouble shooting something else. I never changed it back, so when I finally got cudamat compiled, it was in a 64-bit form and my python interpreter was 32-bit. I uninstalled 32-bit python and put the 64-bit version back in. Then I ran the setup.py file, which compiled cudamat with no issues, and ran the test script from the readme file. All good.

(Separately, I then uninstalled cudamat and tried out #79, which also worked without any issues, and I left a comment on #79 to that effect).

I'll admit that it took me 15+ hours to get cudamat installed and running. I came across many of the same issues previously noted in various posts, but some of the posts leave you hanging...wondering what ultimately resolved the issue referenced. Tomorrow when I get some time, I'll recap the various issues and error messages I got, what caused each, and what to do to rectify the issue in layman's terms, which I think will be helpful to others like myself.

thanks again!

@f0k
Copy link
Contributor

f0k commented Nov 15, 2016

I'll admit that it took me 15+ hours to get cudamat installed and running.

It seems two working days is typical to get CUDA to run in Windows along with Python. There are just too many options for the Python distribution and compiler version.

I'll recap the various issues and error messages I got [...]

Where do you plan to put this? We could add an installation guide to the wiki, similar to what I did for Lasagne: https://github.com/Lasagne/Lasagne/wiki/From-Zero-to-Lasagne

@f0k f0k closed this as completed Nov 15, 2016
@bfh78
Copy link
Author

bfh78 commented Nov 22, 2016

Sorry for the delay in getting back to this, but replicating my errors and error messages at my various steps throughout this process seemed more onerous once I attempted the process than I initially thought. What I feel would be the most helpful for new users is for there to be a straightforward "cudamat install friendly" environment outlined here. Just something to get cudamat up and running that will allow you to play around with it and get familiar (which is all I was looking for).

If you find cudamat useful, and you have a different environment you ultimately need to install cudamat in, you can tackle that in another post.

My primary issue is that Microsoft Visual Studio 2015 release created the "universal CRT" (see post https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/). The cudamat "setup.py install" fails every time with something like...

C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/../../VC/INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

Then when you change around your path variable to look here...
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt
...you get a different different error.

But enough of that...the following software environment should get cudamat up and running on a Windows 10 box.

Windows 10
CUDA Toolkit v8.0
NVIDIA GPU (I have the GTX 1080, but much older ones should work as well)
NVIDIA Display driver
Microsoft Visual Studio 2013 release -- Microsoft Visual Studio 12.0 (***NOT the 2015 release or later)
(2013 release available here https://www.microsoft.com/en-us/download/details.aspx?id=44914)
Python27 (64-bit)
numpy
cudamat

path variables:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
C:\Python27
***make sure you don't have other versions of either of these paths in your environment variables.

command line navigate to your cudamat-master directory where the setup.py file is found and execute the setup. something like...
C:\Downloads\cudamat-master>python setup.py install

This environment with these path variables (and no conflicting path variables) should work.
A couple of simple tests...

*command line run "nvcc -V" If you don't get version information, you either don't have the CUDA toolkit installed or you're missing the path variable to \CUDA\v8.0\bin

*run the following in python27
import sys
print(sys.maxsize > 2**32)
If it returns True, you're running 64-bit

*Once you think you've got cudamat successfully installed, run the "readme file" python test script.

I'll check back to this post to see if anyone using this environment posts any error messages. I'll likely have seen them myself and can hopefully help out.

thanks again.

@f0k
Copy link
Contributor

f0k commented Nov 22, 2016

Sorry for the delay in getting back to this, but replicating my errors and error messages at my various steps throughout this process seemed more onerous once I attempted the process than I initially thought.

I can imagine that! It will still be very helpful that you posted the error message verbatim and provided one way of getting it to work. This should be easy to find for people from the future running into the same error. Thank you!

@f0k
Copy link
Contributor

f0k commented Nov 22, 2016

Microsoft Visual Studio 2013 release -- Microsoft Visual Studio 12.0 (***NOT the 2015 release or later)
(2013 release available here https://www.microsoft.com/en-us/download/details.aspx?id=44914)

Wait, did you really use Visual Studio Express 2013 you linked to? From what I wrote for Lasagne, it seems the Express editions do not include a 64-bit compiler, so I recommended Microsoft Windows SDK for Windows 7 and .NET Framework 4 instead (this also seems to work for Windows 10).

@bfh78
Copy link
Author

bfh78 commented Dec 19, 2016

My apologies for the late reply...I kept meaning to reply to your comment, but just hadn't yet. Yes I, in fact, do have Windows SDK installed. I haven't had to re-install cudamat on any new boxes yet. Though I likely will be doing so in the next month or so. It'll be a brand new box, and I'll take detailed notes as to each piece of software I have installed when attempting to get cudamat up and running. It'll be one of the first few items I install.

@f0k
Copy link
Contributor

f0k commented Dec 19, 2016

It'll be a brand new box, and I'll take detailed notes as to each piece of software I have installed when attempting to get cudamat up and running. It'll be one of the first few items I install.

Cool! Looking forward to your notes.

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