Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install regular python (via homebrew) and miniconda in the same computer?

I downloaded conda, however I would like to use pip and a regular python version (homebrew) for a different purpose, is it ok if I install python and pip via brew and then I install conda?

Update

after installing miniconda I tried to install python via homebrew and both python versions crashed. How can I install miniconda and then python via homebrew?

like image 633
tumbleweed Avatar asked Oct 04 '17 00:10

tumbleweed


People also ask

Can I install both Python and Anaconda?

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

Do I need to install Python after Miniconda?

However, if you are new to Python and have not yet installed anything, we recommend you start by installing Miniconda on your computer. Do I need to install anything? As noted above, you can complete the Geo-Python course without installing anything on your own computer!

Should I register Anaconda as my default Python?

We don't recommend adding Anaconda to your PATH environment variable, since this can interfere with other software. Unless you plan on installing and running multiple versions of Anaconda or multiple versions of Python, accept the default and leave this box checked.

Is Miniconda better than Anaconda?

Anaconda vs. Miniconda is yet another Python distribution, but, in contrast to Anaconda, it contains just a few pre-installed packages (instead of 250+ in Anaconda). Of course, it also incorporates the package manager conda . In other words, Miniconda is a lightweight version of Anaconda.


2 Answers

Anaconda:

Conda creates language-agnostic environments natively whereas pip relies on virtualenv to manage only Python environments Though it is recommended to always use conda packages, conda also includes pip, so you don’t have to choose between the two. For example, to install a python package that does not have a conda package, but is available through pip.

You can also use pip within your conda environment:

conda install pip
pip <pip command>

or

conda install -n testenv pip
source activate testenv
pip <pip command>

You can also add pip to default packages of any environment so it is present each time so you don't have to follow the above snippet.

like image 118
Duc Filan Avatar answered Oct 22 '22 09:10

Duc Filan


From Anaconda Troubleshoot FAQ, following methods can be employed :

  • Edit your .bash_profile and .bashrc files so that the conda binary directory, such as ~/miniconda3/bin, is no longer added to the PATH environment variable. You can still run conda activate and deactivate by using their full path names, such as ~/miniconda3/bin/conda.

  • You may also create a folder with symbolic links to conda, activate and deactivate, and then edit your .bash_profile or .bashrc file to add this folder to your PATH. If you do this, running python will invoke the system Python, but running conda commands, source activate MyEnv, source activate root, or source deactivate will work normally.
    After running source activate to activate any environment, including after running source activate root, running python will invoke the Python in the active conda environment.

like image 34
Amit Singh Avatar answered Oct 22 '22 08:10

Amit Singh