Anaconda Python 3¶
Particular exercises will use Python 3 programs running on your own computer. Python is free and open-source, but some examples will require additional open-source packages beyond the stock Python system. The recommended solution is to use the standard distribution from python.org with a few additional packages, but some users may prefer to use Anaconda Python Individual Edition as it includes more additional packages ‘out of the box.’
The current version of Python is 3.8. For Windows users, the 64-bit version is required.
Contents
macOS Installation Notes¶
Please download the current 64-Bit Graphical Installer from Anaconda Installers. The version we’ll use for Fall 2020 is Anaconda3-2020.07.
Open the .pkg file you downloaded to start the installer.
I recommend permitting the default installation options, which will default to per-user individual installation in your home folder under opt/anaconda3.
You’ll need to accept the license to continue.
Note to command-line users: by default the installer will modify or create your .bash_profile so the Anaconda system will be the default Python in your Terminal windows. You may wish to edit or move this script to suit your tastes, especially if you already have other Python systems in place.
The graphical shell may be launched by opening the Anaconda-Navigator.app from opt/anaconda3 in your home folder.
To try launching an interpreter, please select the Environments tab, locate the default base(root) environment, click the triangular ‘Play’ button and select Open With Python. A console window should launch running an interpreter. The default environment includes many useful third-party packages, so the following should work:
import numpy
import scipy
import PyQt5
Please continue on to the Anaconda Package Configuration instructions.
Anaconda Package Configuration¶
The default Anaconda systems includes most third-party packages we will need, but there are a few that still need to be installed. The Anaconda package manager ‘conda’ supports multiple ‘environments’, each with a particular set of installed packages. Conda can be fragile and mysteriously fail when packages are added to the base environment, so the first step is to create a second environment for actual use. This will start out with a minimal set of packages to which we’ll add what we need.
Please click the Create button below the list of environments on the Environments tab.
Please enter a short name for the new environment, e.g. rcp, then click Create to confirm.
Packages are available on ‘Channels’. We’ll need to add the conda-forge channel to proceed.
Click on Channels, then Add.
Enter conda-forge
Click on Update Channels.
Now we can start selecting packages for installation. If the package selector is switched to ‘All’ or ‘Not installed’, then the Search Packages field can be used to find specific packages out of the more than 16000 available. Please select the following for installation for now; we may add more later:
scipy
pyqt
paho-mqtt
Please click Apply to proceed, the Apply again to confirm.
Packages may also be installed via pip as in other Python systems. E.g., to install the optional python-rtmidi library:
Use ‘Open Terminal’ with the new environment to launch a console window without actually starting Python.
Enter
pip install python-rtmidi
Now within Python,
import rtmidi
should work.Also,
pydoc rtmidi
from the console will show documentation.
macOS De-Installation Notes¶
With the default installation, all the files are in your home folders. For a complete clean, please first run the following from a Python Terminal window:
conda install anaconda-clean
anaconda-clean --yes
Then you may delete all of opt/anaconda3 from your home directory.