Course 1- Programming Assignment 1


For course # 1, assignment # 1 I am implementing %matplotlib inline, in my code, but it is giving me an error. What are alternatives that I can implement in my code to make sure that it can enable the rest of the code that need be implemented to function correctly shown in the below image?

Hi @ajimok47. I see that you are working offline using the Spyder IDE. To the best of my knowledge the %matplotlib inline magic command works with frontends for IPython such as Jupyter notebooks. How that command works with Jupyter notebooks has changed over time and that also may be true of Spyder.

Also, by looking at your IPython console window in your output, it looks as though you have not downloaded all the supporting files needed to work offline.

1 Like

What exactly are the files I need? Can I get a list of them?

Sure, you can tell what you need by examining the “import” cell, which is the first code cell in the notebook. Also check for any cells that load data. Then also click “File → Open” and have a look around. You’ll see a file navigation view of the assignment and can see both the data files and any python utility files.

But please note the course has provided you with a complete environment that works. If you choose to run the notebooks in a different environment, it is not our responsibility to figure out for you how to get that to work. I have never personally used Spyder, so I can’t give any advice specific to that. Please realize that the mentors are volunteers here, meaning we don’t get paid to do this. So it is up to our individual discretion whether we choose to spend time being your “IT support staff” with respect to things that are not really part of the course material. Of course maybe @kenb is a nicer person than I am :smiley: or you may get lucky and some of your fellow students may already have explored how to get this to work in Spyder. You might try searching the Discourse forum for “Spyder” and see if you get any useful hits.

I will see if I can stick to the Jupyter notebook.

In the Jupyter notebook, I am getting a ModuleNotFoundError for the lr_utils module because there is no module named lr_utils.

Is there a solution for this? @paulinpaloalto @kenb

For the problem that I am having with lr_utils that I described above.

Do you mean you get that error when you run the notebook on the Coursera website? Or when you run it locally in Spyder?

If you mean the local case with Spyder, you need to download the file from the Coursera website to your local machine and place it somewhere that it can be found when you run the notebook in Spyder. As I mentioned before, it is your job to figure out the Spyder side of this. To do the download, I explained earlier how to find the file by using “File → Open” from the notebook. That gives you a “file navigation” view of all the files in the assignment. I should warn you that is just one of them. The file explorer supports “Download” as an operation.

I mean my own Jupyter notebook I downloaded, not the one on the coursera website nor Spyder.

Anaconda Jupyter Notebook that is.

It’s the same answer: if you are running the notebook in some environment other than the Coursera website, then you will need to bring down all the files that you see when you click “File → Open” on the website.

Here’s a thread with some instructions for setting things up to run locally.