Failed to load model class 'MPLCanvasModel' from module 'jupyter-matplotlib'

Hi Everyone,
I’m trying to run cost function notebook on my computer, but I face a problem with displaying figures. I add to the error and I share my libraries version informations below.

***************** Error *************************
Failed to load model class ‘MPLCanvasModel’ from module ‘jupyter-matplotlib’
Error: Script error for “jupyter-matplotlib”

****************** Versions ***********************
alabaster==0.7.12
anyio==3.4.0
appdirs==1.4.4
apturl==0.5.2
argcomplete==1.8.1
argh==0.26.2
argon2-cffi==18.3.0
astroid==2.5.1
atomicwrites==1.4.0
attrs==20.3.0
autopep8==1.5.5
Babel==2.8.0
backcall==0.2.0
backports.entry-points-selectable==1.1.1
bcrypt==3.1.7
black==20.8b1
bleach==3.2.1
blinker==1.4
Brlapi==0.8.2
cachetools==5.2.0
certifi==2020.6.20
chardet==4.0.0
click==7.1.2
cloudpickle==1.6.0
colorama==0.4.4
command-not-found==0.3
cryptography==3.3.2
cupshelpers==1.0
cycler==0.11.0
dbus-python==1.2.16
decorator==4.4.2
defer==1.0.6
defusedxml==0.6.0
diff-match-patch==20200713
distlib==0.3.4
distro==1.5.0
distro-info==1.0
docutils==0.16
duplicity==0.8.20
entrypoints==0.3
fasteners==0.14.1
filelock==3.4.0
fonttools==4.35.0
future==0.18.2
google-api-core==2.8.2
google-api-python-client==2.57.0
google-auth==2.11.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.56.4
helpdev==0.7.1
html5lib==1.1
httplib2==0.18.1
idna==2.10
imagesize==1.2.0
importlib-metadata==4.0.1
intervaltree==3.0.2
ipykernel==5.4.3
ipympl==0.9.2
ipython==7.20.0
ipython_genutils==0.2.0
isort==5.6.4
jedi==0.18.0
jeepney==0.7.1
Jinja2==2.11.3
json5==0.9.6
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.11
jupyter-console==6.2.0
jupyter-core==4.7.1
jupyter-server==1.13.1
jupyterlab==3.2.5
jupyterlab-server==2.10.1
jupyterlab-widgets==2.0.0b0
keras==2.9.0
keyring==23.0.1
kiwisolver==1.4.4
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.5
lazy-object-proxy==0.0.0
lockfile==0.12.2
logilab-common==1.8.1
louis==3.18.0
macaroonbakery==1.3.1
Mako==1.1.3
MarkupSafe==1.1.1
matplotlib==3.5.3
mccabe==0.6.1
mercurial==5.6.1
mistune==0.8.4
mock==4.0.3
modbus-tk==1.1.2
monotonic==1.5
more-itertools==4.2.0
mypy-extensions==0.4.3
nbclassic==0.3.4
nbconvert==5.6.1
nbformat==5.1.2
netifaces==0.10.9
notebook==6.2.0
numpy==1.22.4
numpydoc==1.1.0
oauth2client==4.1.3
oauthlib==3.1.0
olefile==0.46
opencv-python==4.6.0.66
packaging==20.9
pandas==1.4.3
pandocfilters==1.4.3
paramiko==2.7.2
parso==0.8.1
pathspec==0.8.1
pbr==5.6.0
pep8==1.7.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.1.2
platformdirs==2.4.0
pluggy==0.13.0
prometheus-client==0.9.0
prompt-toolkit==3.0.19
protobuf==4.21.5
psutil==5.8.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.16.2
pycodestyle==2.6.0
pycups==2.0.1
pydocstyle==2.1.1
PyDrive==1.3.1
pyflakes==2.2.0
Pygments==2.7.1
PyGObject==3.40.1
PyJWT==1.7.1
pylint==2.7.2
pyls-black==0.4.6
pyls-spyder==0.3.0
pymacaroons==0.13.0
PyNaCl==1.4.0
pyparsing==2.4.7
PyQt5==5.15.4
PyQt5-sip==12.9.0
pyRFC3339==1.1
pyrsistent==0.15.5
pyserial==3.5
pysvn==1.9.12
python-apt==2.2.1
python-dateutil==2.8.1
python-debian===0.1.39ubuntu1
python-jsonrpc-server==0.4.0
python-language-server==0.36.2
pytz==2021.1
pyxdg==0.27
PyYAML==5.3.1
pyzmq==20.0.0
QDarkStyle==2.8.1
QtAwesome==1.0.2
qtconsole==5.0.2
QtPy==1.9.0
regex==2020.11.13
reportlab==3.5.66
requests==2.25.1
roman==2.0.0
rope==0.18.0
rsa==4.9
runipy==0.1.5
scipy==1.9.0
screen-resolution-extra==0.0.0
SecretStorage==3.3.1
Send2Trash==1.6.0b1
simplejson==3.17.2
six==1.16.0
sniffio==1.2.0
snowballstemmer==2.1.0
sortedcontainers==2.1.0
Sphinx==3.5.4
spyder==4.2.1
spyder-kernels==1.10.2
ssh-import-id==5.11
systemd-python==234
terminado==0.9.2
testpath==0.4.4
textdistance==4.2.0
three-merge==0.1.1
toml==0.10.1
tornado==6.1
traitlets==5.0.5
typed-ast==1.4.2
typing-extensions==3.7.4.3
ubuntu-advantage-tools==27.7
ubuntu-drivers-common==0.0.0
ufw==0.36.1
ujson==4.0.2
unattended-upgrades==0.1
uritemplate==4.1.1
urllib3==1.26.5
usb-creator==0.3.7
virtualenv==20.10.0
wadllib==1.3.5
watchdog==1.0.2
wcwidth==0.1.9
webencodings==0.5.1
websocket-client==1.2.3
widgetsnbextension==3.6.1
wrapt==1.12.1
wurlitzer==2.0.1
wxPython==4.0.7
xdg==5
xkit==0.0.0
yapf==0.30.0
zipp==1.0.0

Hey @Sevde_Gokce,
Welcome to the community. Please note that the labs are designed to run in Coursera Labs. If you try to run them on your local machines, you are supposed to come across errors due to the difference in the packages. To resolve these, you can try to set up a local environment with the packages having the same versions as those in the Coursera labs. Now this is a bit of a tedious task, but if you are really interested, you can check this thread out to start. I hope this helps.

Cheers,
Elemento

1 Like

Right! The problem with all these courses is that they are frozen in time at the point they were released and don’t get updated very frequently. But the world of python packages mutates really quickly, so you may well get “versionitis” problems if you just run with whatever today’s current versions happen to be.

If you have the sophistication to be able to print the versions or all your local packages, you’re already two steps ahead of most people. Now try that same command in the notebook environment. Then your job is to figure out how to duplicate that set of packages locally. Elemento has given you a thread link that has some instructions to get you started. The framework Anaconda is fundamentally designed to deal with this type of “versionitis” issue, so check it out. The Anaconda website has excellent documentation.

Thank you, @Elemento. I tried this, but I didn’t fix it. So, I changed on code. I used the instruction of %matplotlib inline instead of %matplotlib widget.

Thank you @paulinpaloalto . I will take into consideration.