CUDA 9.1 cannot install due to failed Visual Studio Integration

My computer:

  • Windows 10 version 1803
  • GeForce GTX 1050 Ti
  • Visual Studio 2015 Update 3
  • Latest driver 397.31 installed

I tried to install CUDA 9.1 (downloaded from https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetwork ), but the Base Installer always reports failure at Visual Studio Integration (other components are not installed yet). The order of installation is: driver -> Visual Studio -> CUDA (we cannot change the order of VS and CUDA; otherwise CUDA installer would complain). The installation configuration of Visual Studio is the default plus C++ and common tools. VS builds and runs OpenGL program correctly so I can’t find any fault with it. I have tried both network and local installer, version 9.1 and 9.0, but got the same problem. I have to use CUDA inside VS. So, how to fix the failure of CUDA installer to integrate with Visual Studio? Is there any log I can troubleshoot? If you need any info please let me know. Thank you.

A link to the output of msinfo32 is: https://www.dropbox.com/s/gxft9733vcq3sdi/msinfo32.nfo?dl=0

PS: I checked some of previous threads of the same problem. I have only one instance of Visual Studio installed. For example, the filtered results of “Visual Studio” in Programs and Features are as follows:

And Nsight only find one instance of VS – 2015:

Of course these do not mean CUDA installer detects VS instances correctly, so is it safe to remove all directories not belonging to VS2015?

After many trials in a sleepless night, I finally succeeded in installing everything together. As I said in the original question, the order I followed at first is: driver -> Visual Studio -> CUDA. It turns out that the very first step is wrong. DO NOT UPDATE DRIVER! Let me repeat: DO NOT UPDATE DRIVER!

Nowadays people usually install Windows 10 version 1803, not version 1709 or even Windows 7. The driver shipped with it is 388.13. If we update it to the latest 397.31 as is a natural practice, then no matter what you will do in the last two steps – how you try your best to make sure there is only one VS instance, whatever the version of VS is, whatever the version of CUDA is – you’ll surely fail. To succeed in integrating CUDA with VS, you have to keep the original 388.13.

So the first thing after Windows 10 1803 is installed afresh, is to install Visual Studio 2015 Update 3 immediately. Then install CUDA 9.1. After completion, CUDA installer will launch Experience in which you can safely install the latest 397.31 driver. If you are not sure, you can convince yourself that CUDA has successfully installed with VS even though there are many other directories of other VS versions by trying to new a project in VS. CUDA 9.1 is in the templates list of VS. Interestingly, Experience will complain there is no nVidia driver. Likewise, the CUDA 9.1 installer also installs NSight 5.4 which does not recognize the original 388.13, thinking the driver version is 0.0 and therefore fail the addWithCuda() function, even though the popups claim that NSight 5.4 works with 343.98+. So if you want to use Nsight to debug CUDA, you have to install the latest driver AFTER CUDA is installed. Since the problem I want to solve is to have CUDA integrate with VS, we can do installation on a simple basis (like old driver version or bare VS components). When the two agree with each other, we can then refine by installing new drivers, adding new features of VS and/or upgrading Nsight. After all, VS is not as delicate as CUDA.

I installed Windows 10 1709, CUDA and VS2015 previously (around half a year ago) without such problems. Yesterday, due to some accident I have to reinstall Windows 10. I downloaded the most recent installation (i.e., 1803) and these new problems bothered me a lot. So I am quite sure the problem comes with recent drivers. Anyone can easily reproduce the problem and the solution, including nVidia employees. So I hope they can fix it, because it is natural for a user to update drivers after the installation of the new Windows 1803 is done.

Same problem.

Me too…

It seems that the latest graphics driver causes this problem. I tried on a bare new machine and Win10, if I first install the version 397, the CUDA VS integration failed. If I install CUDA9.1 directly(the installer contains the graphics driver it needs whose version is 388), then the VS integration is installed successfully.

And I remember that the first time I incur the VS integration problem is just after the installation of version 397.

Besides, it seems that although uninstalled, version 397 still left something in the system causing VS integration failed.

So try the method posted by @oregonduckman.

Use the tool Revo Uninstaller to clean all things left by version 397.

But it’s so weird that the VS integration has relation with the graphics driver version.

Ich have excatly the same Problem. Unfortunately the concept of linhsu0723 doesn’t work.

Machine:
Fresh Win10
GTX 1060
VS2017 mit C++ Toolkit 15.3 v140
CUDA 9.1

Here is what worked for me.

Shutdown Visual Studio

Keeping in mind that cuda_9.1.85_win10.exe is just a zip file

Unzip cuda_9.1.85_win10.exe into a directory

run setup.exe in the root of that directory and deselect the VS integration option and let the rest of the install complete.

now gow to the folder you unzipped cuda_9.1.85_win10.exe into and open the CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions

Now copy the CUDA 9.1.props file to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations and you should be good to go.

Here is some additional information I received from Nvidia, hope it helps… I tried it out and it worked for me

Unable to install CUDA 9.1- Installer failed

Response By Email (Ray) (05/10/2018 10:32 AM)
Hello,

My name is Ray and your support case was escalated to me for further review. We have received report of this issue and currently investigating. The workaround from another user impacted suggest this has something to do with the graphic drivers that is installed. Consider the steps below to install the standard VGA driver first and then install CUDA and see if that helps. Here are some steps below. I did include steps to enable installer logging below as well in case this fails, so we’ll have logs for development to analyze.

Step A: Install the standard VGA driver:

  1. Bring up the Windows Device Manager. You can do that my right-clicking on the Start button and then select Device Manager.
  2. Expand the “Display Adapter” list, right-click on the GeForce card and then select “Update Driver Software”.
  3. Click “Browse my computer for driver software”.
  4. Then click the “Let me pick from a list of device drivers on my computer”.
  5. Uncheck the “Show compatible hardware” option.
  6. Under the “Manufacture” scroll to the top and select the “(Standard display type)” and then click “Next”. If you are running multiple GPUs then repeat steps #2 - #6 for each GPU.
  7. Restart Windows. This will basically load the standard VGA driver.

Step B: Uninstall existing NV driver and clean registry:

  1. Download and install the Revo Uninstaller from here: http://www.revouninstaller.com/. There is a 30 days trial period.
  2. Launch the Revo Uninstaller tool.
  3. Uninstall all NVIDIA entries. There should be a few and they all should start with “NVIDIA…”.
  4. After each one you uninstall, Revo will give you option to scan for additional registry entry. Do the scan for each component and then select all the additional left-over registry entries and delete them all. This way all traces of all NVIDIA components will be removed.
  5. When all NVIDIA entries have been removed, restart windows again.
  6. Once back in Windows navigate to “C:\Program Files” and delete the entire “NVIDIA Corporation” folder if it exists.
  7. Once back in Windows navigate to “C:\Program Files (x86)” and delete the entire “NVIDIA Corporation” folder if it exists.
  8. Rename the “C:\Temp” folder to “C:\Temp_old” if folder exists.

Step C: Enable installer logging:

  1. To enable logging follow the steps in the knowledge based article here:
    http://nvidia.custhelp.com/app/answers/detail/a_id/3171. It’s just a matter of downloading the registry key file to enable/disable logging.

Step D: Install CUDA Toolkit 9.1:

  1. Navigate to the folder where you saved the CUDA Toolkit 9.1 package. This assumes you still have the binaries, otherwise just download again.
  2. Install the CUDA Toolkit 9.1 again.

Hopefully the above steps will allow CUDA Toolkit to install with the graphics drivers that is included in the package. Once CUDA has been successfully installed you can then update the graphics drivers back to the latest 397.64 version. But if problem still persists after above steps then please upload all the logs from the “C:\nvidialogging” folder. We will also need SetupAPI log files. This file is located in “C:\Windows\INF” folder . Please attached any logs matching “Setupapi.*.log”. I’ll have to forward these to development team to analyze and see if they can determine what is causing the failure.

Hello @ubejdp!

I guess you have tried uninstalling the version 397 first and then install CUDA.

Acturally I have tried this and failed too.

It seems that although uninstalled, version 397 still left something in the system causing VS integration failed.

So try the method posted by @oregonduckman.

Use the tool to clean all things left by version 397.

The method of @oregonduckman actually works, and doesn’t appear to break anything. The problem looks like Cuda’s Visual Studio plug-in cannot be installed with the new drivers present for some reason, and rolling back doesn’t fix the problem because it leaves something behind. Also Step C is unnecessary - installation logging is not necessary for working.

ALSO PLEASE NOTE: Some users report some Nvidia Services still running even after driver switch and uninstillation steps. This will prevent you from deleting Nvidia folders. If you are unable to delete the Nvidia folders found in /Program Files/, /Program Files (x86)/, and /Program Data/ after uninstalling all Nvidia software, make sure there are no Nvidia Services running: Go to Task Manager (Ctrl-Shift-Esc), and under “Details” and “Services” there should be absolutely nothing Nvidia running. Also open Windows Services, and manually stop any and all services starting with the word “Nvidia”. Re-try deleting the folders.

Alternatively, if you are starting with a fresh install of Windows (you have installed nothing!), the procedure is a little bit simpler (modifies Step B): install Visual Studio (2015 preferably; the samples apparently do not support VS2017). Then, proceed with the driver installation steps in “Step A”, in which you switch the display adapter to Windows Basic Display Adapter. Then, in Windows Services, stop all nvidia services, so that you can delete all nvidia files from C:\ProgramData, C:\Program Files, C:\Program Files(x86). Then proceed with cuda installation.

For Nvidia: Steps to reproduce: Install most-up-to-date display drivers on an updated Windows machine that has not seen CUDA yet. Then, install cuda. Observe error.

Finally, it is very unlikely you actually need the VS plug-in. If you are merely running/compiling/installing Cuda software developed by someone else (such as TensorFlow), the VS plug-in is completely unnecessary.

I was able to get CUDA 9.1.85 to build with VS 2017 15.4. I first uninstalled all previous VS instances and then reinstalled VS2017, making sure to go to “individual Components” and selecting VS 2015 Toolset. I then used the Step A suggestion from @oregonduckman and used the standard VGA driver for my display adapter (video card). I then killed every NVIDIA process and manually deleted every NVIDIA folder on my machine. Finally, I installed CUDA 9.1.85 including the VS Integrations which also reinstalled my display adapter driver that I had manually removed. I was then able to build all of the CUDA samples. I suspect that the issue lays with either the VS Toolset is unsupported by CUDA 9.1 or there was an incompatibility between VS and my NVIDIA driver somehow.
Btw, I am running Windows 10 Pro with a GTX 780 card.

Does anyone else think that it is ridiculous for Nvidia to ask the developers to go through such a drastic process as obliterating Nvidia’s own graphics drivers to be able to install Nvidia’s CUDA tools? How hard can it be for someone at Nvidia to replicate the problem and fix it so that we don’t have to go through this nonsense?

OregonDuckMan method worked for me as well - Win 10 Pro + VS2017 Pro.

this is really very annoying and disastrous.

Same Problem Here, Using latest Nvidia Drivers on fresh Win 10, with a fresh visual studio install with all updates. Cuda 9 fails to install when visual studio integration option is selected, will partially install without it just fine, but I need the integration to function properly!

The method sugested by @oregonduckman and orangesherbet0 worked for me!!!

Thanks oregonduckman!

The method sugested by @oregonduckman and orangesherbet0 worked for me.
Windows 10 + visual studio 2013
Thanks~~~

This NVIDIA solution from “Oregonduckman” Ray is best what he can do for us as a support guy, great plus for his effort finding best solution in his domain. But from programmers and particular management who authorize release version of 9.1 to get us in this situation that we need to do all this steps as Ray suggest is simple ridiculous, Third party programs with 30 days free, erasing drastically folders, drivers hacking etc. List of steps that we make customized installation can make customize problems very difficult to be solved in future.
Or even customized solution for 9.1 would generate another problems for future support and updates.
I would rather keep old version then using some amateurish unfinished version 9.1 let alone 9.2
They may hire some professional programmers and hire new management and then fix properly installation Version 9.1 before even start with the new version 9.2 Someone need alarm management NVIDIA as we want proper and professional attitude when they release latest version CUDA.
Installing unfinished job is not solution for me. This is indication for me that is just tip of the iceberg of the problems inside 9.1 then what when i get even more complex problem? Then i would not even understand why i get some unspecific problems, let alone be able to explain and get support. From time to time my computer is self reseting when i using CUDA. How can i trust that is not from CUDA and they unfinished version of CUDA?
Latest version is not always the very best version as it is often results of management dead line and bonuses for delivering on time. They know that is unfinished job but they just need to tick the box and then we got big problem. It use to be the best latest version but not any more due new culture in management which is on the loose.
Wait for proper solution and make sure that highest management know what is going one in NVDIA.
They can fix this new trend of ticking the box and delivering working versions of CUDA not having problems in the future.
Best Regards
Alex

Worked for me too, except instead of manually copying files I launched both executables (NVIDIA NVTX Installer.x86_64.Release.v1.21018621.Win64.msi and NVIDIA_Nsight_Visual_Studio_Edition_Win64_5.4.0.17229.msi) from CUDAVisualStudioIntegration folder and they installed successfully (considering that the rest of CUDA were already installed).