I am trying to run the lab on my local machine in Jupyter but it is not working. The code plt_intuition(x_train,y_train)
Welcome to the community.
plt_intuition()
is included in "lab_utils_uni.py
" which is located in the same directory of a note book. Please download all related files (not just a notebook) by clicking “Lab Files” at the top and select “Download all files”.
Thank you for the reply. I opened the file and ran the code. But the plot is not showing. Can you please help me.
One question.
When you run the first cell, didn’t you get any message ?
import numpy as np
%matplotlib widget
import matplotlib.pyplot as plt
from lab_utils_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl
plt.style.use('./deeplearning.mplstyle')
You see "from lab_utils_uni import plt_intuition
If lab_utils_uni.py
is not reachable, then, you will get an error message,
ModuleNotFoundError: No module named 'lab_utils_uni'
Two things,
- Did you run the first cell ? If so, check the above message.
- Please use the same directory structure as the coursera platform. If you download “all files”, you will get a zip file. After unzip, you will see the directory structure. Please keep the same directory structure in your local file system.
Thank you for the reply. I ran the first cell and got no error. I retained the same directory structure and ran the code. I ran the cell with plt_intuition but it does not show any plot.
Then, the problem is in your environment. Please make sure you have ipython, ipywidgets, jupyterlab-widgets
are installed in your environment.
Then, here is a quick check.
from ipywidgets import interact
def func(x):
return x**2
interact(func, x=10);
plt_intuition
uses interact as a decorator like @interact
, but the above can be a quick check of your environment. You should see a slider as an interactive one.
By the way, this output of plt_intuition
consists of two parts, i.e, slider bar and graph. What you can see in your notebook ? A graph only ? Or Nothing ?
All the three - ipython, ipywidgets, jupyterlab-widgets are installed in my system. And I see just the slider when I run plt_intuition but not the graph.
In that case, there is a possibility that your matplotlib backend is not working.
In that case, you can not see plt_stationary()
and soup_bowl()
as well.
I want to dig in more, but today is the last day to help as a volunteer. Hope other mentors can take a look.
Thank you, Nobu for all the help till now. Can other people help me, please?
Sorry, but I don’t have any experience with installing the notebooks on a local machine.
I understand it can be difficult to get the correct versions of all of the packages for compatibility with the notebook and utility files. That’s about all I know on the topic.
You may need to start a new thread to attract some new viewers.
Thank you for the reply.
While my ID is still active, one post…
As I posted, if the problem is caused by your local configuration for matplotlib, then, no mentors can help, I think. Here is a quick test.
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 10, 0.1)
y = np.sin(x)
plt.plot(x,y)
plt.show()
This is a simple example to create a 'sine" curve. If this shows up, then, your configuration for matplotlib seems to be OK. If not, please see this link.
It looks like you created a new thread. That’s good advice by Tom.
In a new thread, for other mentors, you should better to state,
- already downloaded all files from Lab with keeping the same directly structure
- sliding bar can be seen, but no graph
- the result of “
plt_intuition
” and also “plt_stationary
” and “soup_bowl
” that you can see in the later cells.
But, of course, the above is based on an assumption that your matplotlib are properly installed and configured in your local environment.
And, I will not access to this community anymore, please post the above to a new thread that you created.
Good luck !
Thank you for the help. I got all the issues resolved.
How did you resolved this issue? I’m facing the same problem like you described.
hello everyone
for solving this proble folow this steps
- close your Jupyter Notebook or Anaconda if its open
- run Anaconda Prompt
- past this
conda install -c conda-forge ipympl
# If using JupyterLab 2
conda install nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter lab build
# Later, if updating a previous Lab install:
conda install ipympl
jupyter lab build
- wait…
- reopen jupyter and make sure run all the cells
- Good Luck