CUDA 10.1 & VS2019 - Environment problem?

I have recently installed VS2019 & CUDA 10.1 and am trying to compile simple *.cu files at the command line however nvcc is reporting ‘nvcc fatal : Could not set up the environment for Microsoft Visual Studio’

The attempt to run nvcc gives me the error and a long path to vcvars64.bat. The error encapsulates the path with single quotes.

Trying to run the batch file with the single quote encapsulation results in a further error, however running the batch file from the same location using double quotes results in success. Further more running just the vcvars64.bat from the same location (relying on a the preconfigured environment) also works.

Below are the results I am getting:

Volume in drive F is Data
Volume Serial Number is 96F2-97F4

Directory of F:\

29/09/2018 10:56 F
08/04/2019 23:08 3,816
1 File(s) 3,816 bytes
1 Dir(s) 11,679,765,483,520 bytes free

nvcc fatal : Could not set up the environment for Microsoft Visual Studio using ‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.20.27508/bin/HostX86/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat’

F:>‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.20.27508/bin/HostX86/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat’
'‘C:’ is not recognized as an internal or external command,
operable program or batch file.

F:>“C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.20.27508/bin/HostX86/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat”

** Visual Studio 2019 Developer Command Prompt v16.0.1
** Copyright © 2019 Microsoft Corporation

[vcvarsall.bat] Environment initialized for: ‘x64’


** Visual Studio 2017 Developer Command Prompt v16.0.1
** Copyright © 2017 Microsoft Corporation

[vcvarsall.bat] Environment initialized for: ‘x64’


Can anyone suggest why this is happening and what I am doing wrong.

Thanks in anticipation of your help.

Double-check the installation guide of CUDA for windows and make sure you are using supported versions of VS, driver, and set the environment variables as the guide says.
I don’t know what is in your system, but your description shows 2 versions of VS installed.

Update - Issued resolved by reinstalling in an account which does not include spaces within the account name. Come on Nvidia, your testing should pick this sort of thing up.

During installation, think I recall instructions about not having spaces in the path. Anyway, if you are admin on your workstation, you can put Visual Studio into location with simpler path. For example, instead of having to struggle with:


we can tell Visual Studio where to go, e.g.,


Then all those vcvars*.bat files are easier to find(!)