I know there are other topics on this issue, but what I encountered and resolved doesn’t match what the other topics listed.
As noted elsewhere, I teach a class using Anaconda (and Spyder) so see many new users installing Anaconda each semester.
One student ran into difficulties installing Anaconda. I recommend that the students use the “only for me” option when installing on Windows. I also specifically warn them about installing into the default location if there is a space in their profile name. I direct them to create an install folder named C:\Anaconda instead.
This student missed that and installed Anaconda to “C:\users\firstname lastname”. So I had him completely uninstall Anaconda, including deleting the .condarc, and other config files out of his profile. I then had him install using the “just for me” install option but using the C:\Anaconda install path instead.
However, even after installing to a path that did not include a space, when he launched Anaconda Prompt, it would fail with the error that it couldn’t find the file “C:\users\firstname” (note that “lastname” wasn’t listed). I figured there was some setting left over from the previous bad install, so we scrubbed the install completely. I also checked the system environment variables for any settings set to “C:\users\firstname”. But after reinstall, the same error occurred.
After researching quite a bit. I tried modifying the activate.bat script to modify the temp file storage as indicated in some other topics (though those topics listed different error messages when starting anaconda prompt). Basically I added:
@set tmp=C:\CondaTmp
@set temp=C:\CondaTmp
I also created the C:\CondaTmp folder on his computer. This immediately resolved the issue.
My guess is that if a user has a profile with a space in it, and even if they install Anaconda to a root folder without a space in it, Anaconda still attempts to use the user-specified temp folder. If this temp folder is in a path with a space in it (which it will if the user profile name has a space in it), then Anaconda will run into errors when attempting to use those temp folders. It seems to do that when starting Anaconda Prompt OR when creating a new environment.