CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. Mac M1 Apple Silicon Miniforge

Issue

I am trying to install miniforge to use it with tensorflow. I am using MacOS Monterrey.

Recreating The Issue

$ /Users/sarangpark/miniforge3/bin/conda init zsh

no change     /Users/sarangpark/opt/anaconda3/condabin/conda
no change     /Users/sarangpark/opt/anaconda3/bin/conda
no change     /Users/sarangpark/opt/anaconda3/bin/conda-env
no change     /Users/sarangpark/opt/anaconda3/bin/activate
no change     /Users/sarangpark/opt/anaconda3/bin/deactivate
no change     /Users/sarangpark/opt/anaconda3/etc/profile.d/conda.sh
no change     /Users/sarangpark/opt/anaconda3/etc/fish/conf.d/conda.fish
no change     /Users/sarangpark/opt/anaconda3/shell/condabin/Conda.psm1
no change     /Users/sarangpark/opt/anaconda3/shell/condabin/conda-hook.ps1
no change     /Users/sarangpark/opt/anaconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /Users/sarangpark/opt/anaconda3/etc/profile.d/conda.csh
no change     /Users/sarangpark/.zshrc
No action taken.

$ exec zsh -l

$ /Users/sarangpark/miniforge3/bin/conda activate env_tensorflow3

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - 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'.

I also have anaconda installed so using the conda command creates a virtual env with anaconda.
(And Anaconda doesn’t work because installing tensorflow doesn’t work)

Solution

This is wrong:

/Users/sarangpark/miniforge3/bin/conda activate

The point of conda init is to add shell code to the shell initialization file in order to define a shell function conda that serves as a wrapper over the Python entry point (/Users/sarangpark/miniforge3/bin/conda). There are details in this answer.

You can check that conda is properly defined with the type function. For example, in my zsh, I see:

% type conda
conda is a shell function from /Users/mfansler/.zshrc

If that works, then you should be fine with

conda activate env_tensorflow3

Also, be sure your shell is actually zsh. MacOS default is usually to have % delimit the prompt in zsh, and has $ for bash.

Answered By – merv

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published