Anaconda: Install and use Python and Jupyter

Anaconda: Install and use Python and Jupyter

In connection with artificial intelligence and data science, Python is now one of the most frequently used languages. Many AI libraries offer APIs for C / C ++ as well as APIs for Python. This includes Tensorflow and the Keras framework, which has now been incorporated into it. We also use Python to create the training data, to train and to create the model for the neural network. The specific description can be found in the article AI for the ESP32 in the Make 6/21.

There are various ways of working with Python under Windows, such as the direct installation of a Python interpreter, which is then operated via the Windows command prompt. Conveniently, there are solutions such as Anaconda that make installation, management, updating and operation child’s play, without a prompt. With Anaconda you can not only manage Python, but also other languages ​​such as R, libraries and development environments such as Visual Studio Code. More on that in a moment.

First you load the in the Individual Edition Free Anaconda Installer for Windows in the desired version (32 or 64 bit) down. The installer needs some time after it has started. As soon as that is done, you call up the Anaconda Navigator. When you start it for the first time, the interface with all the modules offered is still a bit confusing. We just have to get started here Juypter Notebook focus.

The Anaconda Individual Editon is free.

Since individual Python projects often use very different libraries, which sometimes have version conflicts with one another, Anaconda offers the possibility of setting up different environments. In principle, the ones known from native Python are included virtual enviroments (venv) behind it. You can switch between the environments and, as required, install the Python versions, libraries and modules required by the project without them interfering with each other.

We also want to create a new environment for our AI project. Under the point Environments the left menu is used to manage the different development environments. The base environment with its many libraries is already available. From the GitHub-Repository you can use import to load a fully configured Python environment for a Windows 10/11 environment including all the necessary libraries for all parts of this series of articles. To do this, select the file anaconda-win11-env.yml the end.

If you want to install the installation on another system, e.g. Linux, or if you want to do it yourself manually, click on the Environment-Menu below on the + icon (Create) and gives the project a name, e.g. ESP32-KI. The important thing is the Python version 3.8 to select. As soon as you confirm this, the corresponding Python environment is generated and activated immediately. In the right field you can see which basic libraries are already installed. With that one is basically ready to start.

But you will quickly find that important libraries are still missing for the next steps. These have to be installed manually. This can be done in two different ways. Either you select the above in the Environment tab in the selection field Selection all and filters through the search field for the library you need, then selects it and installs it over the one that then appears Apply-Button (bottom right).

Or you can go the classic way using the Python installation tool pip. For this you need a terminal window, which you start by clicking on the Play-Button next to the active environment goes and then Open Terminal selects (see photo gallery). Now you can go over

pip install PACKAGE

install the necessary packages. Normally you do not need a version specification, but in order to avoid incompatibilities with version updates, the libraries with the versions used here are given below. For the first part of the article series (and later in the second part) the necessary libraries are installed in the terminal with the following command:

pip install pillow==8.3.1 numpy==1.21.1 matplotlib==3.4.2 scipy==1.7.1
pip install tensorflow==2.4.0
pip install scikit-learn==1.0

Done. Now we can use the Python environment.

Article Source