-
Notifications
You must be signed in to change notification settings - Fork 1
Software Installation Guide
We discuss all of the recommended software tools, several alternatives, and many resources for learning more about these tools in great detail in the Software Overview, but for simplicity, we summarize the recommended installation steps here.
See the Terminal and Bash section for a discussion of ways of accessing the Bash Shell command prompt using various terminal applications.
The default shell is usually Bash, but if your machine is set up differently you can run it by opening a terminal and typing bash
. There is no need to install anything.
The default shell in all versions of macOS is Bash, so no need to install anything.
There are many options for how to use Bash Shell in windows, which we will discuss below, but our recommendation is to use the new official Windows Bash Shell. This does not currently come pre-installed. To install the Bash Shell:
- Open Settings.
- Click on Update & security.
- Click on For Developers.
- Under "Use developer features", select the Developer mode option to setup the environment to install Bash and click Yes on the pop-up message box to turn on developer mode.
- After the necessary components have been installed, you'll need to restart your computer.
- Once your computer reboots, open Control Panel.
- Click on Programs.
- Click on Turn Windows features on or off.
- Check the Windows Subsystem for Linux (beta) option and click OK.
- Once the installation is complete, click the Restart now button to complete the task.
After your computer restarts, you will notice that Bash will not appear in the "Recently added" list of apps, this is because Bash isn't actually installed yet. Now that you have setup the necessary components, use the following steps to complete the installation of Bash:
- Open Start, do a search for bash.exe, and press Enter.
- On the command prompt, type
y
and press Enter to download and install Bash from the Windows Store. - Then you'll need to create a default UNIX user account. This account doesn't have to be the same as your Windows account. Enter the username in the required field and press Enter (NOTE: you can't use the username
admin
). - Close the bash.exe command prompt.
Now that you completed the installation and setup, you can open the Bash tool from the Start menu like you would with any other app.
There may already be a python version installed on your system. For example, Linux systems use python 2 and 3 for operating system programs. However, we recommend that you install python separately for your own purposes to avoid creating conflicts with the system versions of various python packages. We recommend using Anaconda for this. For Windows, MacOS, and Linux you can download a stand-alone installer for Python 3.7 or 2.7. You should use the Python 3.7 installer (you can still make a dedicated python 2.7 environment later without installing Anaconda again) and check out their Installation instructions for more detailed guidelines.
NOTE: We will not be using Anaconda for managing Python and related packages on the Raspberry Pi computers we will be working with. For these, we rely on the Raspbian package manager and system level python installations with pip.
Download the appropriate installer for Python 3 and install Anaconda and Python 3 using all of the defaults for installation, except make sure to check Add Anaconda to my PATH environment variable. This will ensure that you can use conda
- the command line Anaconda package manager tool - from your command prompt of choice. NOTE: You will see many Anaconda related instructions for Windows point you to the Anaconda prompt for installing packages with conda
, but this is not necessary as long as Anaconda is in your PATH
.
You can check this with these steps:
- Open your bash command prompt and type
echo $PATH
- You should then see something like
/Users/alihanks/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/bin
with/Users/alihanks
replaced with your HOME environment (you can see what this is withecho $HOME
.
Download the installer and install Anaconda and Python 3 using the defaults. Again, you can confirm that the Anaconda distribution has been added to your PATH
following the same steps described for the Windows case.
The Linux installer is a shell script you will need to execute from the command line. So once you have downloaded the Python 3 installer, you will need to follow these steps.
- From your terminal, navigate to the directory where the Anaconda installation script was downloaded, eg.
cd ~/Downloads
- Run the script by typing
bash Anaconda3-
and then press tab. The full name of the script you downloaded should now appear. Now press Enter. - Follow the text-only prompts. To move through the text press Spacebar. Type
yes
and press Enter to approve the license and again to approve the default locations for the files. Typeyes
and press Enter to prepend Anaconda to yourPATH
. - You can check that your
PATH
was updated appropriately as described for the Windows case.
Check out this comprehensive installation guide for all three operating systems. In all cases, once you have installed git you should open your command prompt and configure your Git username and email. These details will then be associated with any commits you make.
$ git config --global user.name "Your Name"
$ git config --global user.email "your@email"
You will also want to make sure you have a GitHub account. This is our chosen resource for hosting our git repositories. There are associated desktop applications (GUIs) that GitHub provides to help with code commits, comments, making and managing branches, and pushing and pulling to and from GitHub. We will always provide command-line methods, but such interface tools can be useful.
If Git is not already available on your machine you can try to install it via your distribution's package manager. For Debian/Ubuntu run
$ sudo apt-get install git
and for Fedora run
$ sudo dnf install git.
There are options, but the easiest way is to download the latest stand-alone Git for Mac installer and follow the installation instructions.
NOTE: Because this installer is not signed by the developer, you may have to right-click (control-click) on the .pkg file, click Open, and click Open on the pop-up window.
NOTE: After installing Git, there will not be anything in your /Applications
folder, as Git is a command line program.
Git can be installed on Windows using the stand-alone Git for Windows Installer. After starting the installer you will get the Git Setup wizard. You should follow the Next and Finish prompts to complete the installation. The default options should be appropriate. Be sure to keep "Use Git from the Windows Command Prompt" checked.
We will be using Jupyter Notebooks for many of our in-class activities. Jupyter can be an extremely useful tool for interactive code development, testing, and documentation. The Jupyter package is actively maintained through GitHub, but the stable version is automatically installed when you install Python with Anaconda. It can also be installed using pip:
pip install --upgrade pip
pip install jupyter
or if you are maintaining both python 2 and python 3, you can install jupyter for a specific version with
python3 -m pip install --upgrade pip
python3 -m pip install jupyter
or by specifying the pip installer with
pip3 install jupyter
We go over text editors and IDEs much more detail here, but in many of our examples for quickly editing text from the command-line, we will use nano. This comes pre-installed on macOS and Linux, and should be installed on Windows when you install Git. When working on your personal computer, you can always use an alternative, but it will be helpful to comfortable with the basics of nano
, as it will come up when working with the Raspberry Pi computers.
These installation instructions should cover the basics of getting the standard software you will need for this course installed on your system. However, when using the stand-alone installers for Windows, and in some cases macOS, there will sometimes be issues with where and how packages get installed that mean you run into trouble trying to use this new software from your standard command-line tool (Bash in the Mac Terminal or various command prompts in Windows).
For example, often when using Anaconda to install Python on Windows, when you then go to your command prompt and try to run conda
or python
commands, you will still get error messages telling you command not found
, whereas if you open the Anaconda prompt you will be able run those commands, but if you try to use the Anaconda prompt to manage your git commits that is when you will get the command not found
error. This is all an issue with your PATH
. The Git Bash terminal installed with git
will have the location of the git executable automatically added to the PATH
environment variable in that shell environment, and the Anaconda prompt will automaically add the location for the conda
and python
packages to the PATH
environment variable in that shell environment, but they won't know about each other. And possibly the Windows Bash terminal will not know where to look for either of these tools. There are a few ways to address these issues directly for the local environment in your terminal app of choice, but this issue can be resolved globally adding to the PATH
as described here:
0. Determine the path you would like to add.
a. Anaconda: go to the Anaconda prompt and type where python
; Git: open Git Bash and type which git
b. You should get something like C:\Users\jsmith\Anaconda3\python.exe
c. The path you want to add for Anaconda is then C:\Users\jsmith\Anaconda3\
- Open the Start menu and search for
env
. Choose "Edit the system environment variables". - Click the Environment Variables button near the bottom of the System Properties pop-up window.
- Under the System Variables section (the lower half), find the row with Path in the first column and click Edit....
- The Edit environment variable window will appear. You can click New and type in the new path you want to add. From this screen, you can also edit or reorder the paths. You may want to move your new path to the top of this list.
- Dismiss all of the dialogs by choosing OK.
- You will need to restart any apps you want to pick up the new
PATH
, rebooting your computer will ensure that all apps pick up the change. - You can now check your
PATH
in the command or Anaconda prompt withecho %PATH%
or in Power Shell with$env:path
or in your Bash Shell withecho $PATH
In macOS a similar issue can come up, though it is unlikely, with the location of the Anaconda/Python installation not getting added to your bash PATH
environment variable. This shouldn't be an issue for Git as it gets installed in /usr/local/git
, and places a symlink into /usr/local/bin
, which should already be in your PATH
. If this is somehow not the case, these instructions would apply for Git as well, adding /usr/local/git
to your PATH
.
You can check your path by opening a terminal and typing echo $PATH
. Anaconda usually gets installed in your home directory: $HOME/anaconda3
, you can check with ls $HOME/anaconda3
. To add this to your Bash shell environment, you need to edit your $HOME/.bashrc
file.
nano ~/.bashrc
and add the line
export PATH=$HOME/anaconda3/bin:$PATH