J Xkcd
J Xkcd

Reputation: 423

How to init shell for conda on Win 10?

When I run conda init cmd.exe in either normal or admin mode I get the following error.

WARNING: Cannot install xonsh wrapper without a python interpreter in prefix: C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\conda.exe
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\conda-env.exe
modified      C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\conda-script.py
modified      C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\conda-env-script.py
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\conda.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Library\bin\conda.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\_conda_activate.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\rename_tmp.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\conda_auto_activate.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\conda_hook.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\activate.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\activate.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\condabin\deactivate.bat
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\activate
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\Scripts\deactivate
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\etc\profile.d\conda.sh
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\etc\fish\conf.d\conda.fish
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\shell\condabin\Conda.psm1
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\shell\condabin\conda-hook.ps1
needs sudo    C:\Users\JASONL~1\AppData\Local\Temp\_MEI202282\etc\profile.d\conda.csh
modified      HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

What does this mean and how do I fix it? Should I just try a fresh install?

Upvotes: 9

Views: 11677

Answers (6)

SkyeN
SkyeN

Reputation: 31

Windows 11 & Miniconda

I had this very error. It came up when I tried to activate an environment I'd just created.

I know the cause on my end was newbie mistakes, but maybe there's a newbie out here who also made the same mistake.

I wanted to run conda from cmd and not the shell that comes with miniconda. I had added C:\Users\vic\miniconda3\ to environment variables. conda was not recognized when I tried conda --version.

I went to the miniconda installed directory and renamed the _conda.exe to conda.exe. Some conda functionalities worked after doing this: conda create, conda info, conda config

Whenever I tried to use the new environment with conda activate newenv, it'd tell me to do conda init first. And this then gave the very error message on this question.

That path on the error doesn't exist.

I watched a video on YT that helped me fix it. I renamed the conda.exe back to _conda.exe and added the condabin path to environment variables. Should look something like this: C:\Users\vic\miniconda3\condabin

And that solved the issue. I can use the new environment I'd created.

I know this is very verbose, but I hope it helps someone making the same rookie mistakes I did.

Upvotes: 3

henry li
henry li

Reputation: 11

I met this issue too when using miniconda. I tried this :%conda_root_directory%/Library/bin/conda.bat init and it worked.

Upvotes: 1

Patrik Staron
Patrik Staron

Reputation: 409

I had the same problem.

Running %conda_root_directory%/Library/bin/conda.bat init cmd.exe did the trick. Then I restarted the shell (cmd) and I was able to activate my environment and install a package.

Upvotes: 9

YuseqYaseq
YuseqYaseq

Reputation: 283

I had the same error. Reinstalling Anaconda fixed the issue (Conda 4.10.1).

Upvotes: 0

Reed
Reed

Reputation: 11

Run the command in Anaconda PowerShell Prompt.(Start Menu -> Anaconda3 -> Anaconda PowerShell Prompt)

Upvotes: 1

J Xkcd
J Xkcd

Reputation: 423

Use the anaconda prompt instead of cmd.exe to run the commands.

Upvotes: 6

Related Questions