Error : Failed to create temp directory “C:\Users\user\AppData\Local\Temp\conda-<RANDOM>\”

风格不统一 提交于 2021-02-08 13:33:09

问题


When I try to Activate "conda activate tensorflow_cpu"

conda activate tensorflow_cpu

Error : Failed to create temp directory "C:\Users\user\AppData\Local\Temp\conda-\"


回答1:


It is due to a bug from conda developers. The bug is the temp path is having names with spaces, so to overcome please reassign the Env Variables TEMP, TMP. (for windows)

  1. go to environment variables
  2. In "User Variables for " section look for TEMP, TMP
  3. double click on TMP and in "variable value", type "C:\conda_tmp"
  4. similarly do it for TEMP
  5. close env variables section
  6. Restart the anaconda prompt, the error should vanish



回答2:


I came across this error as well. I was following the instructions to update Spyder. When I opened the Anaconda Prompt (Anaconda3) I got the following error:

Failed to create temp directory "C:\Users\username with spaces\AppData\Local\Temp\conda<RANDOM>\"

Which this led to the following error coming up when I tried 'conda update anaconda':

'conda' is not recognized as an internal or external command, operable program or batch file.

The above solution may work for Anaconda, but I was hesitant about it's effect on other applications that use the TEMP and TMP folders. So after further research I came across a series of issues on GitHub https://github.com/conda/conda/issues/9757 which points to the root cause being that it's unable to handle Windows user names with spaces in them, at least for me, not sure about the OP, my assumption is @Hassan masked his name?

My workaround was to open the Anaconda Powershell Prompt, it seems to be updating just fine within this prompt.




回答3:


Making a little tempory workaround by editing "C:\ProgramData\Anaconda3\Scripts\activate.bat" to add the following just before the first "@if" :

@set TEMP=C:/temp
@set TMP=C:/temp

This is avoid modifying the whole thing by changing Env variable as mentioned by some of the users.

Thanks to Hepson for this suggestion



来源:https://stackoverflow.com/questions/60789886/error-failed-to-create-temp-directory-c-users-user-appdata-local-temp-conda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!