4

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?

strivn
  • 309
  • 2
  • 8
user65526
  • 685
  • 6
  • 19

3 Answers3

5

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

madcow
  • 2,567
  • 14
  • 31
Akshat Zala
  • 710
  • 1
  • 8
  • 23
3

To install Anaconda using Homebrew:

  1. Go to your terminal and type brew cask install anaconda, then hit return.
  2. Make sure that anaconda is in your PATH. You'll need to open your terminal's configuration file (usually this is ~/.zshrc on a mac) and find the line that starts PATH=. Add a line nearby that says: export PATH="/usr/local/anaconda3/bin:$PATH". This is where Homebrew installs Anaconda.
  3. Quit and restart your terminal. This is the easiest way to make sure that the new configuration will be loaded.
  4. Test whether it's working with which conda.

You should now be able to use the conda command.

EDIT: As similar posts in this topic have pointed out, the way conda activate works has changed from version to version. If the above isn't giving you good enough results, try the following method to enable the conda activate and conda deactivate commands.

For bash or zsh, putting

export PATH="/opt/conda/bin:$PATH"

in your ~/.zshrc file puts your base environment on PATH, but doesn't necessarily actually activate that environment. Try removing that line and replacing it with

. ~/Anaconda3/etc/profile.d/conda.sh
conda activate base

as recommended in the official Anaconda 4.4.0 release notes.

Replace ~/Anaconda3 with the path where you installed Anaconda, if you put it somewhere else.

Running conda activate base puts the base environment on PATH and gives you access to the executables in the base environment.

Additional Resources:

Ray Johns
  • 768
  • 6
  • 14
  • 3
    I read this article but unfortunately the instructions did not work. However I found that homebrew had placed my anaconda3 installation under a different path. Adding the following seemed to work. I'm hoping this helps someone out. export PATH="/opt/homebrew/anaconda3/bin:$PATH" – Timothy Chan Feb 24 '21 at 06:26
0

Timothy Chan's answer seemed to work best.

After installation of Anaconda through homebrew, put the following into your terminal.

export PATH="/opt/homebrew/anaconda3/bin:$PATH"

You can now open a Jupyter notebook and do other things but keep in mind that you will have to run the above command every time for now. Will try to find a fix for this :)