intro-to-python
intro-to-python copied to clipboard
Conda: Command Not Found
After installing Anaconda for the first time on Mac OS Catalina, students might be running into "conda: command not found" related issues.
As a one-time step, locate where the "anaconda3" folder was installed, for example on the desktop, and replace references to conda
with ~/Desktop/anaconda3/bin conda
.
After initializing the shell for the first time with ~/Desktop/anaconda3/bin conda init zsh
(default on Catalina) or ~/Desktop/anaconda3/bin conda init bash
, future references to conda
should work without need for the prefix.
https://docs.anaconda.com/anaconda/user-guide/troubleshooting/#conda-command-not-found-on-macos-or-linux
UPDATE:
-
~/Desktop/anaconda3/bin/conda init bash
-
~/Desktop/anaconda3/bin/conda init zsh
The command to configure Anaconda 3.8 with zsh shell is now: /opt/anaconda3/bin/conda init zsh
For a Windows Git Bash user, we needed to update the bash profile to point to where they had installed Anaconda. We used the anaconda prompt to issue a conda info --envs
to find out where it was installed. Then we added the following line to the bash profile:
# the ~/.bash_profile
. C:/Users/user/Anaconda3/etc/profile.d/conda.sh
h/t: https://stackoverflow.com/questions/54501167/anaconda-and-git-bash-in-windows-conda-command-not-found
Another windows Git Bash user, we needed to do: ~/anaconda3/Scripts/conda init bash
(after saying where conda
in the Anaconda Prompt.
For some mac users, the Anaconda installer ran into issues

"The installer encountered an error that caused the installation to fail"
When inspecting the failed installation for one student, we found the bin directory had not been installed, rendering the existing troubleshooting steps useless.
So we tried to re-install, choosing the user's home folder (/Users/USERNAME) as the installation location. And it worked!
Another windows git bash user was able to fix the anaconda setup using the bash profile steps from https://github.com/prof-rossetti/intro-to-python/issues/13#issuecomment-774164247
One observation of note is that "You may encounter problems if the path where Anaconda was installed contains spaces"
Although we just confirmed that students with a space in their user's home folder ended up OK.
One student on Mac was running into anaconda-related errors when opening up the terminal, and the anaconda installation seemed broken.
We uninstalled, and then tried re-installing from the anaconda webiste, but that installation ran into unexpected errors and was unable to complete.
So we then used brew to install anaconda
brew install anaconda
... which worked, but put anaconda in /usr/local
so to get the terminal to recognize, we modified the zshrc file to reference the new install location (/usr/local/) instead of /opt.
And it worked!
Seeing this again with another Mac (zsh).
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/cli/main.py", line 91, in main_sourced
print(activator.execute(), end="")
^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/activate.py", line 199, in execute
return getattr(self, self.command)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/activate.py", line 165, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/activate.py", line 343, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/activate.py", line 433, in _build_activate_stack
deactivate_scripts = self._get_deactivate_scripts(old_conda_prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/anaconda3/lib/python3.11/site-packages/conda/activate.py", line 765, in _get_deactivate_scripts
for entry in os.scandir(join(prefix, "etc", "conda", "deactivate.d"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType
`$ /Users/USERNAME/anaconda3/bin/conda shell.posix activate base`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_EXE=/Users/USERNAME/anaconda3/bin/conda
CONDA_PYTHON_EXE=/Users/USERNAME/anaconda3/bin/python
CONDA_ROOT=/Users/USERNAME/anaconda3
CONDA_SHLVL=1
CURL_CA_BUNDLE=<not set>
LD_PRELOAD=<not set>
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
shell level : 1
user config file : /Users/USERNAME/.condarc
populated config files : /Users/USERNAME/.condarc
conda version : 23.7.4
conda-build version : 3.26.1
python version : 3.11.5.final.0
virtual packages : __archspec=1=x86_64
__osx=10.15.3=0
__unix=0=0
base environment : /Users/USERNAME/anaconda3 (writable)
conda av data dir : /Users/USERNAME/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/USERNAME/anaconda3/pkgs
/Users/USERNAME/.conda/pkgs
envs directories : /Users/USERNAME/anaconda3/envs
/Users/USERNAME/.conda/envs
platform : osx-64
user-agent : conda/23.7.4 requests/2.31.0 CPython/3.11.5 Darwin/19.3.0 OSX/10.15.3
UID:GID : 501:20
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.
Example: conda --no-plugins install <package>
Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.
Example: CONDA_NO_PLUGINS=true conda install <package>
We tried installing anaconda again, but same error happened. We tried homebrew (as mentioned here), but it requires xcode command line tools, and the student's OS was too old to support the XCode installation. We tried installing XCode from App Store, but the OS is too old. So we are trying updating the OS before repeating the installation steps.