Since Software-Carpentry has been using the Anaconda distribution, I will be using it for the installation instructions described in this appendix. You can also find the generic workshop template installation instructions for Python here:
https://carpentries.github.io/workshop-template/#python
For the most part, the directions listed on the main Anaconda download site will be the same as the ones listed in this book.1 You can also look at the Anaconda installation documentation.2 Be sure to use the Python 3 version. If you also need to have Python 2, follow the instructions in Appendix F on creating Python environments.
1. https://www.anaconda.com/products/distribution
2. https://docs.continuum.io/anaconda/install/
Install Anaconda using the Windows installer with all the default settings. Make sure you check off the box for Add Anaconda to my PATH environment variable.
Install Anaconda using the Mac installer with all the default settings.
Installing on Linux involves downloading the .sh
file and running it from the command line. You can do this by navigating to the Anaconda download site and downloading the .sh
file there. Alternatively, if you are on a server, for example, you can use the wget
command. Assuming the .sh
file is in your Downloads
folder:
cd ~/Downloads
bash Anaconda3- * .sh # your version number will differ
Note that the version of Anaconda will be different by the time this book is published.
Keeping the default options is a good choice. When the installation process asks you to read the license agreement, you can press q
to exit or accept by typing yes
.
Type yes
when the installer asks to prepend Anaconda to the PATH
. This makes Anaconda the default Python distribution on the system.
When you are done, close the current terminal window. Any new terminal moving forward will default to the Anaconda Python distribution.
Anaconda is a big download because it comes with a lot of packages and dependencies pre-installed. Miniconda is an alternative to the full Anaconda distribution. It only comes with Python installed, and all the other packages need to be installed manually.
Since Anaconda will create an Anaconda3
folder in your home directory, deleting this folder will completely remove anything associated with Anaconda on the machine. This is one of my favorite features of using Anaconda. If I install a bad Python package, I can reset everything back to “normal” by deleting the Anaconda3
folder.
For Miniconda, you will have a miniconda3
folder instead.
Pyenv is a tool that lets you manage different versions of Python. It also has a plugin for you to also manage package environments. The benefit that pyenv
has over conda
is that it plays a little bit nicer with other tools outside of Python, since it only manages the Python version.
Below are some resources to install, setup, and use pyenv
Posit, PBC (formerly RStudio, PBC has a minimal viable python setup instruction for Pyenv: https://solutions.rstudio.com/python/minimum-viable-python/
Calvin Hendryx-Parker gave a great talk at PyCon 2022 on Bootstrapping Your Local Python Environment that goes over the Pyenv setup with the pyenv-virtualenv plugin: https://www.youtube.com/watch?v=-YEUFGFHWgQ
Real Python Managing Multiple Python Versions With pyenv: https://realpython.com/intro-to-pyenv/
The main downside is that Pyenv plugins are not supported on Windows. That means the very useful pyenv-virtualenv plugin isn’t usable. For that reason, if you want to go to Pyenv route, I suggest you look into Pipenv for the virtual environment management, and use Pyenv for the Python version management. This way, you have a setup that is OS agnostic.
See Appendix H for how to install the packages needed to code along this book. If you are using a Python setup other than Anaconda (or its derivatives that use conda
), You need to replace the conda install
command with pip install
.
You can download the data sets for the book by going to the book’s repository and downloading the ZIP file of the repo.
The book’s repository can be found here: https://github.com/chendaniely/pandas_for_everyone
You can do this by going to the main repository page then clicking Code > Download ZIP (Figure B.1).
This will download everything in the repository as well as provide a folder in which you can put your Python scripts or notebooks. You can also copy the data folder from the repository and put it in a folder of your choosing. The instructions on the GitHub repository will be updated as necessary to facilitate downloading the data for the book.