Very recently, I suddenly started having problems with the Anaconda prompt and launching jupyter instances with VS Code. There is an Access Denied error, but even as administrator I am getting an error that point me towards some issue with whitespaces in my path. I have never had this issue and anaconda was working for well over a year now.

So, I uninstalled Anaconda and re-installed it completely. Still the error persists when I launch from the start menu.

Access is denied.
The system cannot find the file C:\Users\Ananth.
Could Not Find C:\Users\Ananth Mahadevan\AppData\Local\Temp\conda-16154.tmp

C:\Users\Ananth Mahadevan>

So when I run cmd.exe in admin mode and navigate to Anaconda3\Scripts and run activate.bat I still get this

Not a conda environment: C:\ProgramData\Anaconda3\Scripts\Mahadevan\AppData\Local\Temp\conda-22297.tmp

Then I tried to activate the base specifically and get this error

C:\ProgramData\Anaconda3\Scripts>conda activate base
activate does not accept more than one argument:
['base', 'Mahadevan\\AppData\\Local\\Temp\\conda-1957.tmp']

This error lead me to, but this seems like an old issue and looks to be closed. I tested this by running the PowerShell Anaconda prompt, and there activate.bat works fine.

The issue seems to be with the Scripts\activate.bat which calls condabin\conda.bat in turn condabin\_conda_activate.bat where I can see the code that creates a unique temp path and tries to locate it

@REM This method will not work if %TMP% contains any spaces.
@SET UNIQUE=%TMP%\conda-%RANDOM%.tmp
@IF EXIST "%UNIQUE%" goto :tmpName
@"%CONDA_EXE%" %_CE_M% %_CE_CONDA% shell.cmd.exe %* 1>%UNIQUE%

It clearly says this will not work if temp has any spaces. I think I found the issue, but not the solution. It is also strange as Anaconda was working perfectly well, and the last thing I can remember was the new windows updates, which has got me to suspect it.

Hope someone can help

2 Answers

ivan_pozdeev On
Community On

I have found the solution at There is an issue with whitespace in temp folders. The fix was to change TEMP and TMP environment variables to a location without whitespaces like c:\conda_tmp. It works fine after this fix.