menu

Questions & Answers

Failed building wheel for nes-py

Info: I am using Windows 10 with python 3.7.7 and pip 19.2.3

Problem: I was trying to install nes-py in cmd prompt using pip install nes-py, but during the Building wheel for nes-py (setup.py) ... error stage of the install I got the following error:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include\yvals.h(12): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for nes-py

Edit: I copy and pasted over many files from the Windows SDK and now have a new error:

  Generating code
  Finished generating code
  LINK : fatal error LNK1158: cannot run 'rc.exe'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\link.exe' failed with exit status 1158
  ----------------------------------------
  ERROR: Failed building wheel for nes-py
Comments:
2023-01-24 00:00:11
It seems crtdbg.h is a header file from Windows SDK. developercommunity.visualstudio.com/content/problem/958134/…
2023-01-24 00:00:11
I installed the windows sdk in C:\Program Files (x86)\Windows Kits but the error still persisted. The missing file was in the Windows Kits folder though so I copy and pasted it over to `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include`. The error then disappeared but I got a new one for a different file. So I then copy and pasted over the entire include folder and lib folder. This made a lot of errors disappear but I got another one which I do not know what to do about. I have added the error message to the question.
Answers(5) :

I solved this issue by installing node.js. This installed all the needed files for me and allowed me to install any packages that had a wheel. This isn't a very elegant fix since it also installed many files that I do not need, but it seems to work and is very simple.

Comments:
2023-01-24 00:00:11
What is the relationship between this and node.js? I already have node installed, but did not solve problem.

I only solved this issue by installing Visual Studio Community (I had Visual Studio Code).

I did this following the comment here about the requirements to install py-nes that are already inside Visual Studio Community.

Try with completely new enviorment using conda create -n your_env_name python=3.7. I have created with python 3.7. It resolves the issue.

You just download and install this program and run the command again https://visualstudio.microsoft.com/visual-cpp-build-tools/

Comments:
2023-01-24 00:00:11
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
2023-01-24 00:00:11
Please consider adding some explanation to the framework/library suggested, explaining how it solves the problem.

I can solve the problem - install SDK for Windows 10 screenshot