Get your anaconda ready after brew install

Get your anaconda ready after brew install

add conda to the path

I’m always using the Homebrew to install the dependencies needed. For recent studies, I need Anaconda for learning python developments. So the first step is trying to install Anaconda with homebrew via brew cask install anaconda, but get this warn information while installing:

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.

To fix this bug, you need to add the /usr/local/anaconda3/bin directory to the PATH environment variable. Simply run this command in terminal if you’re using bash:

echo 'export PATH="/usr/local/anaconda3/bin:$PATH"' >> ~/.bash_profile

or, if you use zsh instead of bash, command like this:

echo 'export PATH="/usr/local/anaconda3/bin:$PATH"' >> ~/.zshrc

Then, full restart terminal and run:

conda init

# or... if you're using zsh
# conda init zsh

conda init is available in conda versions 4.6.12 and later.

Anaconda will configure the environment automatically for you. Example of configurations on my Mac looks like this after execute the above command:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
    if [ -f "/usr/local/anaconda3/etc/profile.d/" ]; then
        . "/usr/local/anaconda3/etc/profile.d/"
        export PATH="/usr/local/anaconda3/bin:$PATH"
unset __conda_setup
# <<< conda initialize <<<

I would highly recommend you to use zsh to get a more interactive terminal interface, read this post for setting up zsh. On newer macOS such as bigSur, zsh is now the default shell application.

The same works for miniconda. If you installed it using Homebrew with brew cask install miniconda, you need to set source of the PATH to .zshrc, for example.

echo 'export PATH="$PATH:/opt/miniconda3/bin"' >> ~/.zshrc

Then, still in a zsh shell:

conda init zsh

That’s it, miniconda will set responding configs automatically. After that, you can comment out the export PATH="$PATH:/opt/miniconda3/bin" in .zshrc file.

Update conda

If you run conda update --all for the first time, it may warn:

Verifying transaction: - WARNING conda.core.path_actions:verify(962): Unable to create environments file. Path not writable.
  environment location: /Users/<username>/.conda/environments.txt

To fix this issue, we can change the ownership of the above directory with:

sudo chown -R $USER ~/.conda

If you come across other issues, please leave your comments below…

Ads by Google


Frank Lin

Hey, there! This is Frank Lin (@flinhong), one of the 1.41 billion 🇨🇳. This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.


Setup an IKEv2 server with StrongSwan



Setup an IKEv2 server with StrongSwan

IKEv2, or Internet Key Exchange v2, is a protocol that allows for direct IPSec tunneling between two points. In IKEv2 implementations, IPSec provides encryption for the network traffic. IKEv2 is natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary, and it handles client hiccups quite smoothly.

Hands on IBM Cloud Functions with CLI



Hands on IBM Cloud Functions with CLI

IBM Cloud CLI allows complete management of the Cloud Functions system. You can use the Cloud Functions CLI plugin-in to manage your code snippets in actions, create triggers, and rules to enable your actions to respond to events, and bundle actions into packages.