Skip to content

Instantly share code, notes, and snippets.

@martinsotir
Last active June 26, 2024 06:37
Show Gist options
  • Save martinsotir/2bd2e16332dff71e0fa5be3ed3468a6c to your computer and use it in GitHub Desktop.
Save martinsotir/2bd2e16332dff71e0fa5be3ed3468a6c to your computer and use it in GitHub Desktop.
Enable conda in powershell

Enabling conda in Windows Powershell

First, in an administrator command prompt, enable unrestricted Powershell script execution (see About Execution Policies):

set-executionpolicy unrestricted

Then makes sure that the conda Script directory in is your Path. For instance, with miniconda: %USERPROFILE%\Miniconda3\Scripts.

In a regular Powershell prompt check if conda is working, and update to latest version:

conda update conda
conda --version
# should be conda 4.6.1 or newer

Setup conda for Powershell using the following command:

conda init powershell

Finally, restart powershell. An initialisation script is run every time Powershell starts. You should now be able to activate environment with:

conda activate <my-env>
@dsaad68
Copy link

dsaad68 commented Sep 27, 2022

thanks!

@BlackPi3
Copy link

works!

@amitrakshitdev
Copy link

I faced one more issue. The activate bat script could not run from my poweshell.
And, the issue was my poweshell execusion policy was restricted to current user.
I ran the following from my poweshell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
after the powershell was restarted, it worked.

@Sopulu-max
Copy link

I faced one more issue. The activate bat script could not run from my poweshell. And, the issue was my poweshell execusion policy was restricted to current user. I ran the following from my poweshell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser after the powershell was restarted, it worked.

That works
Thanks a bunch

@apiwhichway
Copy link

It works, thanks!

@ar0uda
Copy link

ar0uda commented Jan 27, 2024

ur a livesaver bro ty :DDDD

@uxp
Copy link

uxp commented May 4, 2024

to disable conda from auto-activating on every shell, run

conda config --set auto_activate_base false

@vanessa-arruda
Copy link

Lifesaver! Thank you!

@monitor1379
Copy link

it works, thanks you!

@SantiagoJN
Copy link

Great solution, thanks!

@Murdock135
Copy link

When I do this, I think the conda-script.py is being called. I don't know why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment