Lab_utils_uni library

Hey! can anyone explain this library or file. I dont understand this and whenever I try to run in my jupyter notebook it gives so many errors.

1 Like

Hey @Shizra_Tariq,
Welcome, and we are glad that you could be a part of our community :partying_face: lab_utils_uni.py is actually a python script and not some python library. You may check that out on Coursera by clicking on “Lab Files”, which you can find in the menu whenever you open any Coursera Notebook. Also, trying to run the notebooks locally is not recommended, since the notebooks are made keeping the Coursera environments in mind; but if you are trying to do that, in that case, you can download all the files for an assignment, once again, by using the “Lab Files”. For more instructions regarding the same, check out A.2 in this thread. Let us know if this helps.

Cheers,
Elemento

1 Like

I am having a similar issue.
Please how do I install the lab_utils_uni in my Jupyter notebook.

I have tried !pip install, but the package does not exist.

1 Like

Hi @Peter_Oyefolu!

As Elemento mentioned that lab_utils_uni is a python script and not a python library. So, you don’t need to do !pip install for it. Everything is provided to you and you just need to write your code between these two lines:

### CODE STARTS HERE ###

### CODE ENDS HERE ###

Best,
Saif.

1 Like

I stored the .py files in the same location as Jupyter nb, but it is still showing the error:

I*mportError                               Traceback (most recent call last)*
*Cell In[13], line 4*
*      2 get_ipython().run_line_magic('matplotlib', 'widget')*
*      3 import matplotlib.pyplot as plt*
*----> 4 from lab_utils_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl*
*      5 plt.style.use('./deeplearning.mplstyle')*

**ImportError: cannot import name 'plt_intuition' from 'lab_utils_uni' (/Users/maan/Downloads/lab_utils_uni.py)**
1 Like

I guess you could comment out this mplstyle line as it is only for styling purposes. Or you can do !pip install mplstyle in your Notebook.

PS: This is only for your local Environment. You don’t need to do this in Coursera Environment.

1 Like

I don’t think working on files in your Downloads folder is a wise idea.

1 Like

But the problem was with this line → image

@Maan_97, seems like a function is missing from the utiltiy script. I believe you need to re-download the workspace of that lab to get an intact lab_utils_uni.py. See method 2 in this thread.

Cheers,
Raymond

1 Like