Beginner problem running code from MS

You will need to install graphing (and any other packages required) before you can run the code. This is because graphing is not a package in Python’s standard library, so you have to install it separately.

Since you already have anaconda installed, you can create an isolated environment to install these dependencies and run the notebook from. Something like:

conda env create --name mslearn jupyter graphing  # Add other packages to the end of this line
conda activate mslearn
jupyter notebook

In the above example, mslearn is the name we give to the environment we create so we can reference it.

Once you have created and activated your conda environment, you can install more packages with one of these two commands:

conda install PACKAGE_NAME  # conda native command
pip install PACKAGE_NAME  # Using pip instead of conda

Read more about conda environments here:

There may be a requirements.txt file with the notebooks, wherever you downloaded them from. This is a plain text file that lists all the dependent packages required to run the code that don’t ship with the standard library. You can install those packages into your conda environment like so:

conda activate mslearn  # You can skip this if your environment is already active
pip install -r requirements.txt
1 Like