San San
San San

Reputation: 99

(eval):10: unmatched | conda active error on iTerm, Mac M1 Big Sur

fellows,

I just changed to MAC AIR M1 from windows so I've been suffering from getting used to use it and build development envs.

while the process I tried about dozen ways to install tensorflow for M1, I installed and deleted anaconda3 several times and install miniforge by brew and additionally installed miniforge3(I'm sorry I cannot found the info of these two things-miniforge and miniforge3- are different each other or not) after that, I cannot activate virtual environment

It is speculated that environmental variables will be twisted in this process, but no solution can be found.

so here is what I messed

PATH setted like

% echo $PATH
/Users/san/miniforge3/etc/profile.d:
/Users/san/miniforge3/condabin:
/opt/homebrew/bin:
/opt/homebrew/sbin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Users/san/.local/bin\':
/Library/Apple/usr/bin:
/opt/homebrew/Caskroom/miniforge/base/envs:
/opt/homebrew/Caskroom/miniforge/base/bin

conda info like

% conda info

     active environment : None
            shell level : 0
       user config file : /Users/san/.condarc
 populated config files : /Users/san/miniforge3/.condarc
          conda version : 4.10.1
    conda-build version : not installed
         python version : 3.9.4.final.0
       virtual packages : __osx=11.3.1=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /Users/san/miniforge3  (writable)
      conda av data dir : /Users/san/miniforge3/etc/conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/san/miniforge3/pkgs
                          /Users/san/.conda/pkgs
       envs directories : /Users/san/miniforge3/envs
                          /Users/san/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.9.4 Darwin/20.4.0 OSX/11.3.1
                UID:GID : 502:20
             netrc file : None
           offline mode : False

and environments like

% conda info -e
# conda environments:
#
base                  *  /Users/san/miniforge3
AI                       /Users/san/miniforge3/envs/AI
AI86                     /Users/san/miniforge3/envs/AI86
TFmacos                  /Users/san/miniforge3/envs/TFmacos
                         /opt/homebrew/Caskroom/miniforge/base/envs/AI38

so, when I run 'conda activate',

% conda activate
(eval):10: unmatched '

how can I solve this?

Upvotes: 0

Views: 1378

Answers (3)

erogluegemen
erogluegemen

Reputation: 66

  • Open ~/.zshrc file.
  • Find this line:
__conda_setup="$('/Users/yourusername/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
  • Change 'shell.zsh' with 'bash.zsh'
__conda_setup="$('/Users/yourusername/opt/anaconda3/bin/conda' 'bash.zsh' 'hook' 2> /dev/null)"
  • This worked for me. I hope it helped.

Upvotes: 1

CodingYang
CodingYang

Reputation: 11

I have met same error, but I found the problem solved when I comment the prefix lines in my ~/.zshrc file. The actual mistake is yarn path config line, I‘m not sure is yarn error or my previouse incorrect edit.

export YARN_GLOBAL_PATH=$(yarn global bin)
export PATH="'$YARN_GLOBAL_PATH:$PATH"

there's a "'" between PATH=" and $YARN

Upvotes: 1

jerichoi224
jerichoi224

Reputation: 49

For People who might also end up with the issue, this is how I solved it.

(I wanted to add comment, but I don't have enough reputation)

Based on the comments above, I did echo $PATH

Like the writer, I also had a path that ended with '

/Users/san/.local/bin\':

although mine was a python path.

I edited the /etc/paths file to remove the ' at the end.

restarted the terminal.

everything works fine.

Upvotes: 0

Related Questions