General instructions to install Anaconda, which is used in most posts on this blog.
This is a reference post.
I've realized that I'm explaining how to install Anaconda over and over again in most of my posts, often messing up with the instructions!
So to make it easier for me and, most importantly, safer for you, I'm summarizing the instructions in this short post, and I will refer to it from now on.
I'll present you with two installation methods for Anaconda:
As stated on Anaconda's website:
With over 6 million users, the open source Anaconda Distribution is the fastest and easiest way to do Python and R data science and machine learning on Linux, Windows, and Mac OS X. It's the industry standard for developing, testing, and training on a single machine.
In a nutshell, the anaconda team maintains a repository of more than 1400 data science packages, all compatible, and provides tools to install a version of python and these packages at the push of a button, and under five minutes.
In particular, Anaconda contains:
Download anaconda for your system:
Then run the installer, and finally start the Anaconda Navigator. On windows, you can find it by clicking the windows start button, and typing anaconda.
In the Anaconda Navigator, you can click on the Environments tab and then select the base (root) environment to see which packages are installed, and to install additional packages. You can also create new environments as shown below.
Finally, to start using it, go to the Home tab and launch the jupyter notebook. This will redirect you to the jupyter notebook main page in your browser.
You can now create and load jupyter notebooks.
You're done!
Download Miniconda for your system:
On linux, you can download the bash installer from the command line with wget like this (replace with the link you need from the Miniconda page):
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
On the mac, you can download it with curl:
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
After this is done, open a bash terminal and type the following (use the name of the installer that you have just downloaded)
bash Miniconda3-latest-MacOSX-x86_64.sh
Answer all questions, and you're done with the installation.
Log out from your machine, and log in again (or start a login shell)
Then, you can use the command line to:
I usually do everything in one go like this:
conda create -n testenv python=3.7 ipython
This creates a new environment called testenv based on python 3.7, and with the ipython package.
You can then activate the environment, and test that things are as you expect:
conda activate testenv
conda list
# packages in environment at /Users/cbernet/miniconda3/envs/testenv:
#
# Name Version Build Channel
appnope 0.1.0 py37_0
backcall 0.1.0 py37_0
ca-certificates 2019.5.15 0
certifi 2019.6.16 py37_0
decorator 4.4.0 py37_1
ipython 7.6.0 py37h39e3cac_0
ipython_genutils 0.2.0 py37_0
jedi 0.13.3 py37_0
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20181209 hb402a30_0
libffi 3.2.1 h475c297_4
ncurses 6.1 h0a44026_1
openssl 1.1.1c h1de35cc_1
parso 0.5.0 py_0
pexpect 4.7.0 py37_0
pickleshare 0.7.5 py37_0
pip 19.1.1 py37_0
prompt_toolkit 2.0.9 py37_0
ptyprocess 0.6.0 py37_0
pygments 2.4.2 py_0
python 3.7.3 h359304d_0
readline 7.0 h1de35cc_5
setuptools 41.0.1 py37_0
six 1.12.0 py37_0
sqlite 3.28.0 ha441bb4_0
tk 8.6.8 ha441bb4_0
traitlets 4.3.2 py37_0
wcwidth 0.1.7 py37_0
wheel 0.33.4 py37_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 h1de35cc_3
You see that python is indeed version 3.7, and that ipython is there. You can start ipython.
After Miniconda is installed, don't hesitate to create new environments not to mix things up. For example, I have a dozen environments: a python 3.X environment for this blog, a python 2.X one for some tasks at work, another one for activities related to OpenCV... And every time I write an article for this blog, I create a fresh environment to test the installation recipe, before deleting it right away.
Please let me know what you think in the comments! I’ll try and answer all questions.
And if you liked this article, you can subscribe to my mailing list to be notified of new posts (no more than one mail per week I promise.)
You can join my mailing list for new posts and exclusive content: