Anaconda Tutorial: What it is, how to install it and how to use it

Anaconda Data Science, big data and pytho, R distribution

In this article I leave a Anaconda installation guide and how to use your Conda package manager. With this we can create development environments for python and R with the libraries we want. Very interesting to start messing with Machine Learning, data analysis and programming with Python.

Anaconda is a free and Open Source distribution of the Python and R programming languages ​​widely used in scientific computing (Data ScienceData Science, Machine Learning, Science, Engineering, predictive analytics, Big Data, etc).

It installs a large number of applications widely used in these disciplines all at once, instead of having to install them one by one. . More than 1400 and that are the most used in these disciplines. Some examples

  • Numpy
  • pandas
  • Tensorflow
  • H20.ai
  • Scipy
  • Jupyter
  • Dask
  • OpenCV
  • MatplotLib

A while ago i installed Keras and TensorFlow bareback but Anaconda's solution seems much simpler and more useful

It is also a magnificent option to install Python on our operating system with the libraries we need and have it isolated the projects in different virtual environments.

Subscribe to our mailing list

Anaconda distribution packages and applications

I am specifically testing it for some scripts to manage large csv for work and for which I need NumPy and Pandas. And now I'll try Tensorflow and something else ;-)

What I see with the number of packages I see is that it is not limited to data analysis because we can install hundreds of plugins (libraries) dedicated to web development or scrapping like Scrappy. So we go with the general tutorial of the installation and creation of environments and we will investigate the applications that we can install.

Anaconda vs Conda

A subsection. Do not confuse Anaconda, which is the suite that allows us to use many libraries and Data Analysis, Science Data and Machine Learning software with Conda, which is the Anaconda package manager and virtual environments.

How to install Anaconda on Ubuntu

Anaconda can be installed on Microsoft, MacOs and Linux. I will tell you about my experience in Ubuntu.

There are different ways to install Anaconda in Ubuntu, the one I like the most is to go to the official website and Download the .sh. Find your operating system and the version that interests you

If you start I recommend that you choose version 3.7 that 2.7 will be obsolete in a few years.

If you download the .sh for linux like me, you have to open the console or terminal, and go to the directory where it is, in my case Downloads

Remember that the most common mistake that people have problems with is that it does not enter the correct folder or directory

cd Descargas
ls
sh nombre_del_archivo_que_has_descargado.sh

With the first line we go to the Downloads directory, with the second «ls» it lists the files that there are and so we can see the name of the .sh and with the third we execute the .sh that we say is like the Windows.

And it will start running. Accept the software license terms and then it will ask you if you want to install Visual Code Studio. I have said yes.

Steps after installing Anaconda

You have to get out of that sale of the terminal for the changes to work. So we close terminal, reopen and type

anaconda-navigator

This will open a graphical interface with browser format that will allow us to install and activate different packages, although we can also do everything from the console.

Once installed we will check that everything is correct. for that we are going to see what version we have installed

conda --version

If all is well it will return us high as conda 4.6.4 If an error appears, we will have to see what it tells us to solve it, reinstall it, etc.

If you just installed you should see if there is any update in conda

conda update conda
conda update anaconda

This compares the version we have with the one available and if there is something new it will ask us

Proceed ([y]/n)? y

We put «and» the yes and enter

Create virtual work environments with Conda

Each project that we do we can have it in a separate environment, in this way we avoid problems with package dependencies, etc.

To create a virtual environment, we are going to call it Compare we write in the terminal:

conda create --name comparador python=3.7

Where Compare is the name of the virtual environment and python = 3.7 is the package we want it to install.

We activate it with

conda activate comparador

And we deactivate with

conda deactivate

We verify virtual environments on

conda info --envs

This will show us the environments we have, it will return something like

# conda environments:
#
base                  *  /home/nacho/anaconda3
comparador               /home/nacho/anaconda3/envs/comparador

base is root, and the asterisk shows us the one we have activated.

There is also one thing to note. When activating an environment in the console, the name is prepended in parentheses at the prompt, so that at all times we know where we are

More interesting commands:

we can search for applications to install. Imagine that I want to install Keras, because first I look if the application is available and what versions are there

conda search keras

As I see that it is already step to install it

conda install keras

And to see everything we have installed in our development environment we will use

conda list

Handle pkgs packages with conda

Here are a few interesting options. That will help us to configure our virtual environment with the applications we need to work.

Install packages

There are very specific commands. To install a package in a specific environment. For example Keras, in my newly created environment Compare

conda install --name comparador keras

If we don't add the –name comparator it will install it in the environment that we have active at that moment.

We can install multiple packages at the same time (keras and scrappy) with

conda install keras scrappy

But it is not recommended to avoid dependency problems.

Finally, we can choose the specific version that we want to install if we are interested in it for any reason

conda install keras=2.2.4

Install non-Conda packages

In this case we will use pip

pip install

Update packages

There are different options. Update a specific package with

conda update keras

Update python

conda update python

Update conda

conda update conda

And to update the entire Anaconda meta pack

conda update conda
conda update anaconda

Delete packages

Delete packages in a given environment. For example Keras from the environment Compare

conda remove -n comparador keras

If we want to erase the environment in which we are

conda remove keras

Multiple packages can be deleted at the same time

conda remove keras scrappy

And it is recommended to check the packages to see if it has been uninstalled correctly with

conda list

For me this is the basics, if you want to go deeper here you have the official conda handbook (In English)

We left a cheat sheet by Conda official, with the main commands for a quick use of the distribution.

A walk through the graphic environment of Anaconda

All this that we are doing with the terminal and we can do it graphically with the Anaconda interface.

To start the distribution first we will have to have the base environment (root) conda active

conda activate base

And with this we can call Anaconda. If not, it won't start

anaconda-navigator

You see, here it seems to us the base project, which is root and then the environments that you are creating and which in my case has been Compare.

It is best to see it in a video

And with the knowledge acquired throughout the article we can start to fiddle with and fiddle with many libraries and applications.

If you have any questions, leave a comment and I will try to help you

Leave a comment