2

I installed Anaconda3 on my Windows Laptop and tried to make the conda activate command available in powershell so that I can use the conda env in VS Code for a Jupyter Notebook. But the problem is this:

  1. Added Conda to the Environment-PATH
  2. I executed conda init powershell in the conda prompt and closed it afterwars
  3. opened powershell and executed set-executionpolicy remotesigned
  4. then i restarted the computer
  5. eventhough it should be working at this point I still get the following message when executing conda activate base inside powershell:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. If using 'conda activate' from a batch script, change your invocation to 'CALL conda.bat activate'. To initialize your shell, run conda init <SHELL_NAME> Currently supported shells are:

  • bash
  • cmd.exe
  • fish
  • tcsh
  • xonsh
  • zsh
  • powershell

See 'conda init --help' for more information and options. IMPORTANT: You may need to close and restart your shell after running 'conda init'.

1 Answer 1

3

I noticed that your powershell could execute conda init successfully.

2.I executed conda init powershell in the conda prompt and closed it afterwars

Normally this command will edit this account's powershell startup config file, which locates in C:\Users\[YOUR_ACCOUNT_NAME]\Documents\WindowsPowerShell\profile.ps1. Please make sure that the edited file include codes like this in your personal folder:

#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "C:\ProgramData\Miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion

Sometimes the code page that powershell is using may cause jumbled characters when your account name includes non-ascii characters, resulting in editing the profile.ps1 in the jumbled path. Just copy it into your real account path as shown above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.