W1 (code not running) TypeError: the 'package' argument is required to perform a relative import for './deeplearning'

Hello everyone here I hope you are all well :slight_smile :slight_smile:

import math, copy
import numpy as np
import matplotlib.pyplot as plt
from lab_utils_uni import plt_house_x, plt_contour_wgrad, plt_divergence, plt_gradients

While I am using this code
TypeError: the ‘package’ argument is required to perform a relative import for ‘./deeplearning’
is showing rn.
While I have installed the source code file to Jupyter Notebook

So, you are replicating the assignments on your local computer.

Note that it needs some effort. To create a local environment in your PC/Laptop, read this. It’s a bit complex process, so, you can use Colab. Read this guide.

Hello, Thanks for your reply it was deeply appreciated.

import numpy as np
import matplotlib.pyplot as plt
Both are working on my local computer.

While both
from lab_utils_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl
plt.style.use(‘./deeplearning.mplstyle’) gave me this message
TypeError: the ‘package’ argument is required to perform a relative import for ‘./deeplearning’
is showing rn.

1 Like

Hello @Amr_Shaaban_Dahab,

Which version of matplotlib are you using? There seems to be a relevant report on that, and check it out. My matplotlib (version 3.6.2) works fine.

Btw, I found the above report by googling "plt.style.use TypeError: the ‘package’ argument is required to perform a relative import for".

Cheers,
Raymond