Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Conda in on Homebrew Python system?

I'm using Homebrew as my package general manager, and am using its Python and pip for software development, along with virtualenvs. For various reasons, I'd like to continue with this structure, but I need some software that is (apparently) easier to install using Conda.

Can I continue to use Homebrew+pip+virtualev and add Conda into the mix, ideally inside a virtualenv so that it doesn't affect my system as a whole? If so, how do I set up and use Conda in this way?


(Python: 2.7.11 (Homebrew); pip: 8.1.1; setuptools: 20.6.7; OS X: 10.11.4 (x86_64))

like image 844
orome Avatar asked Apr 07 '16 19:04

orome


People also ask

How do you activate conda?

To activate your Conda environment, type source activate <yourenvironmentname> . Note that conda activate will not work on Discovery with this version. To install a specific package, type conda install -n <yourenvironmentname> [package] . To deactivate the current, active Conda environment, type conda deactivate .

Is conda and Anaconda the same in Python?

Anaconda is the most popular full Python distribution. It comes with a package manager system, conda, and includes many commonly used Python modules.

Can I install conda if I already have Python?

I already have Python installed. Can I install Anaconda? You do not need to uninstall other Python installations or packages before installing Anaconda.


1 Answers

You can install Anaconda. Try brew cask install anaconda. Follow the on-screen instructions you may want to add export PATH=/usr/local/anaconda3/bin:"$PATH" to your ~/.bash_profile or ~/.zsh file.

Using anaconda you can create virtual environments for python2 and python3. You can set up environments and then use commands like source activate py27 assuming py27 is an environment you created in python2.7 in anaconda. It even has GUI and CLI versions.

Every time I open my terminal, my .bash_profile and .zshrc get sourced. If you append the source line above, it will load with the version you need everytime. Every anaconda environment has its own pip as well. With Anaconda in the mix, you'd not really need virtualenv anymore but you can keep it if you want.

If you want to run the Anaconda Navigator GUI you can run it: open /usr/local/anaconda3/Anaconda-Navigator.app. You can use it to manage/create the environments and pip packages, etc.

like image 94
devssh Avatar answered Sep 21 '22 16:09

devssh