B

Installation and Setup

B.1 Install Python

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

B.1.1 Anaconda

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/

B.1.1.1 Windows

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.

B.1.1.2 Mac

Install Anaconda using the Mac installer with all the default settings.

B.1.1.3 Linux

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.

B.1.2 Miniconda

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.

B.1.3 Uninstall Anaconda or Miniconda

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.

B.1.4 Pyenv

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

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.

B.2 Install Python Packages

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.

B.3 Download Book Data

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).

Images

Figure B.1 Clicking on Code > Download ZIP to download the data sets for the book. You can also try the direct URL to the ZIP file here: https://github.com/chendaniely/pandas_for_everyone/archive/refs/heads/master.zip

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.79.176