Doing Course 3 Week 2 Assignment 2 on Anaconda or Colab

If you are doing Assignment 2 on a local Anaconda or Colab environment, you might get the following error when trying to import pickle5 -

An easy solution to resolve this is to edit the recsysNN_utils.py file to replace the lines of code that uses pickle5/pickle as follows -

Thanks @Danny_Go for sharing your experience, this will be helpful for other learners

1 Like

I’m hesitant to leave this post visible, since it advocates for modifying the course materials.

Historically, this sort of well-intentioned information can cause lots of problems, because students may follow these instructions even if their problem has nothing to do with this topic.

This causes extreme headaches and confusion in unraveling why a student may be having problems with the assignment.

Please reply if you believe this thread should remain visible. I’m willing to be persuaded to leave it be.

Hi @TMosh, @Riya_Parikh17, my apology if my suggestion implied changing the online course code to get a assignment to work. I only intended to offer a solution to anyone using a local installation of Jupyter to do their assignment 2 off-line and encountering this problem.

I am using a local installation of Anaconda Jupyter to do my assignments so I can create cells to write code to understand what the assignment code is doing and for debugging code outside of a function. Creating cells in the online assignment environment is discouraged. As assignment codes are written inside functions to be able to debug that code require running it outside a function with print statements to see what is happening.

I have previously been advised that running labs and assignments in a local Anaconda or Colab environment may not aways work due to the difference in the versions of Python or library modules. That have been the case in a number of labs and assignments. In one assignment, there was code written for a local environment that was commented out and fix was simply to un-comment that code and comment out the online code.

For this particular case for Assignment 2, I was not able to install and build the Pickle5 module due to this following error message -

Updating the Microsoft Visual C++ to the latest version did not resolve the problem and hence I could not load the data. The only solution that I could find was to load the .pickle file using an alternative method.

My suggested solution is for anyone using a local installation of Jupyter to do their assignment as a work around due to the differences between their local environments and the Coursera online environment.

I understand that. I’m pondering how to accommodate the good while also mitigating the issues that will happen when students misapply the information in this thread.

I’ll leave the thread visible for now, and monitor the situation.