Learn about installing Anaconda on OS X.
- [Michele] For this course, we need an up-to-date installation of Python 3 and a few third party packages, including the standard scientific stack: Jupyter notebook, NumPy, SciPy, and Matplotlib, and statistics packages pandas, statsmodels, and PyMC3. We will also be using a standard spreadsheet application. I will use Microsoft Excel, but you can just as well use Apple Numbers, Google Sheets, or something else.
If you are an experienced Python user and you know how to install extra packages, you are free to do so. Otherwise, I suggest you follow me and install the free Anaconda Python distribution, which includes everything that we need. To install, we'll go to the anaconda.org website, we find the link for downloading, we scroll down to our platform of choice, and we select the graphical installer for the Python 3.6 version of Anaconda.
Indeed, Python version 3. Although Python 2 is still a useful tool and it is still supported by the Python Software Foundation, there is no reason now not to use Python 3, which fixes several problems with the older Pythons and which introduces several new useful features. Once the download has completed, we click on the installer and proceed through a standard installation which will require several clicks. We Continue, Continue, Continue, Agree, and Install.
The installer offers also to install Microsoft Visual Studio Code, which is a rather powerful new graphical user environment for Python, however, we don't need it for this course, so we Continue. All done. We can move the installer to Trash and we can now try out our new Python by opening up a terminal and typing python. This gets us into the standard Python shell where we can write and execute code interactively.
The prompt informs us that this is indeed the Anaconda version of Python 3.6. It's traditional to say hello. We can also verify that all the packages that we need are already installed by attempting to import them. NumPy, SciPy, Matplotlib, pandas, and statsmodels.
The only one that is not present is PyMC3. To install it, we go back to the shell, Ctrl+D, and we use the Anaconda Installer Utility conda, so conda install pymc3. We confirm we wish to install PyMC3 and all related packages. Conda will download and extract everything that we need.
So, let's try again to import PyMC3. If you don't have the Apple compilers on your system, you're prompted to install them now since PyMC3 uses them under the hood, so we click Install. Done. Let's try again. It's best to restart Python before we do this.
All done. We are now ready to start experimenting with Python.
- Installing and setting up Python
- Importing and cleaning data
- Visualizing data
- Describing distributions and categorical variables
- Using basic statistical inference and modeling techniques
- Bayesian inference