Anaconda prompt closes immediately - the system was unable to find the specified registry key or value

After installing keras I got the same problem.

I checked Anaconda Navigator > Environments for a related package. I found vs2015_win-64 package that said

Activation and version verification of MSVC 14 (VS 2015) compiler

I was not able to remove the package using the Anaconda Navigator.

Anaconda prompt closes immediately after the error message but there is enough time to stop the command execution with Ctrl + C + Enter. Now I was able to use the Anaconda prompt to remove the package.

Anaconda prompt:

conda uninstall vs2015_win-64

This just happened to me as well after updating all of my packages. I did some digging and the error is coming from C:\Users\username\AppData\Local\Continuum\miniconda3\etc\conda\activate.d\vs2015_compiler_vars.bat

This file has your last line before your error:

for /f "skip=2 tokens=2,*" %%A in ('reg query "%VSREGKEY%" /v InstallDir') do SET "VSINSTALLDIR=%%B"

And if you run reg query "%VSREGKEY%" /v InstallDiron your Windows command prompt, you'll get the same error you see on your Anaconda prompt.

I tried making some changes to handle this error but even if you manage to get past that you will likely end up getting this error : Did not find VS in registry or in VS140COMNTOOLS env var - exiting This is happening because the VSINSTALLDIR bash variable is meant for finding the vcvarsall.bat file later in the script but now that directory shows up as empty.

I wasn't able to find any vcvarsall.bat file in my system, likely because I haven't installed Visual Studio which this file is meant for. One solution is to install Visual Studio (2015 version) and make sure you have the InstallDir registry key for it. But I didn't do this since VS is a pretty big program (7 GB I think) that I have no use for that at the moment.

The solution I took is to simply delete C:\Users\username\AppData\Local\Continuum\miniconda3\etc\conda. I created a new miniconda installation (in a different path) and saw that this directory did not exist in it for whatever reason so I imagine that reinstalling would do the same thing. I deleted the second installation and the first one is still working so I doubt there's any dependencies issues involved. That said, I have no idea what that script was meant for and do not know what consequences may come without it. Full disclosure.