Anaconda:
Conda creates language-agnostic environments natively whereas pip relies on
virtualenvto manage only Python environments Though it is recommended to always usecondapackages,condaalso includes pip, so you don’t have to choose between the two. For example, to install a python package that does not have acondapackage, 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.
Answer from Duc Filan on Stack Overflowbrew cask install miniconda: PATH of all binaries not set
brew cask upgrade (miniconda) deletes environments
Miniforge on Mac: Manual vs Homebrew Install?
After homebrew installation and using it to install miniconda on Monterey MacOS, conda is not found.(Q1) How to resolve? (Q2) How to remove miniconda? - Stack Overflow
Videos
Anaconda:
Conda creates language-agnostic environments natively whereas pip relies on
virtualenvto manage only Python environments Though it is recommended to always usecondapackages,condaalso includes pip, so you don’t have to choose between the two. For example, to install a python package that does not have acondapackage, 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.
As of 2019, Amit Singh's comment is slightly out of date (and the link is broken). I had the same issue previously, but needed to install conda to work on a specific project with a collaborator. I did this using miniconda, but it should work with Anaconda as well.
After installing conda, this is added to ~/.bash_profile (or .bashrc):
added by Miniconda3 4.5.12 installer
>>> conda init >>>
!! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/<user>/miniconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/<user>/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/<user>/miniconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/<user>/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
<<< conda init <<<
It basically automatically activates a base conda environment and puts you in it when you start a new shell. This adds conda's python, and other software, to your path. Any tools looking for system/homebrew install programs such as python will get the conda versions instead if they exist. This can create problems if you are trying to use the homebrew versions of things.
This whole block can be safely deleted. Instead, add:
. /Users/<user>/miniconda3/etc/profile.d/conda.sh
to you ~./bash_profile. This calls a script which creates bash functions for conda, conda activate, and conda deactivate and sets some environment variables. Importantly, it doesn't active the base environment (the default, global conda environment) or change your path.
You can now create a conda environment for your project and install whatever you need into that:
conda create -n my_project python R jupyter # Whatever packages you need
conda activate my_project
# do some stuff
conda deactivate # leave the environment
# do unrelated stuff without issues
If you do want to use the default (root) environment, it can be activated like any other:
conda activate root
# do some stuff
conda deactivate
I hope that helps!
Hey everyone, I'm setting up Miniforge on my Mac for managing Python environments, and I noticed there are two main ways to install it:
-
Downloading the installer manually from the official site
-
Installing it via Homebrew (
brew install --cask miniforge)
Has anyone tried both methods? Is there any practical difference in terms of performance, path setup, or long-term maintainability?
Hi pythonistas :)!
I recently done a reboot to my mac and I started setting up my workspace from scratch.
was wondering what is the better way to go about this:
- python from brew (default path)
- conda or any other virtual env (I generally pref conda for DS work)
- both?
The problem is whenever I'm not running a virtual environment some tools (mostly n/vim plugins) I use in the terminal tend to break due to the fact default python on the mac is python2 and they rely on python 3.
Will it cause issues if I had the brew python in the path by default?
Hope to get some aid here, Thanks for the read :D!
I am a data scientist, started to using M1 Macbook Air. Want to install Python and ML packages. What do you suggest for installling python and packages ? What is your experience with them ?