Search code examples
pythonanacondahomebrew

Installing a Python environment with Anaconda


I have just tried to install Anaconda using Home-brew using the terminal, and receive the following message:

L-MBP:agda-stdlib le$ brew install conda 
Updating Homebrew...
Error: No available formula with the name "conda"

==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.

==> Searching for similarly named formulae...
Error: No similarly named formulae found.

==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

L-MBP:agda-stdlib le$ brew install anaconda
Error: No available formula with the name "anaconda" 
Found a cask named "anaconda" instead. Try
  brew cask install anaconda``

L-MBP:agda-stdlib le$ brew cask install anaconda
==> Caveats
Cask anaconda installs files under /usr/local. The presence of such
files can cause warnings when running `brew doctor`, which is considered
to be a bug in Homebrew Cask.
...
installation finished.
==> Changing ownership of paths required by anaconda; your password may be necessary
🍺  anaconda was successfully installed!

L-MBP:agda-stdlib le$ conda create --name snakes python=3.7.2
-bash: conda: command not found
L-MBP:agda-stdlib le$ conda -bash: conda: command not found

When I try to open anaconda and when I try to make a Python environment, I receive the message ''command not found''.

What is the problem?


Solution

  • Install anaconda via Homebrew

    Install anaconda via brew cask by executing

    ➜ brew cask install anaconda   (or)
    ➜ brew install --cask anaconda [Newer versions of Homebrew]
    .
    .
    .
    PREFIX=/usr/local/anaconda3
    .
    .
    .
    🍺  anaconda was successfully installed!
    

    Let’s run jupyter notebook

    Try to executing jupyter notebook in your terminal.

    It’s not works … why? Because our shell doesn’t know where is the anaconda folder so is, let’s add that folder to our shell path.

    Setup the environment path.

    Insert a line below on top of your ~/.zshrc file because when you trying to execute python on terminal it’ll search on folder /usr/local/anaconda3/bin first before search on default operating system path which means you can execute jupyter notebook and python .

    export PATH="/usr/local/anaconda3/bin:$PATH"
    

    Restart terminal or use source ~/.zshrc to reload your shell environment and execute jupyter notebook an output will be like this

    terminal

    Reference: Install anaconda on macOS with Homebrew