No module named 'sklearn' error on the Optional Lab: Linear Regression using Scikit-Learn

I made sure to run the command to install the sklearn package as suggested here:C1_W2_Lab03_Feature_Scaling_and_Learning_Rate (Multi Variable) - #12 by Mujassim_Jamal, after that I restarted the jupyter notebook in vscode but I am still seeing the error ModuleNotFoundError: No module named ‘sklearn’ when I run the first cell of the Optional Lab: Linear Regression using Scikit-Learn.

Can someone help please?
TKS

@andre_liboreiro
After installing sklearn package, have you run the initial cell in the notebook? Please note that every time you open the notebook or restart the notebook, you have run the cells starting from the first cell.
Regards

Yes, Jenitta!
I have restarted and re-ran all the jupyter cells again but nothing has changed. The error in the first cell keeps poping up.
As you can see here the sklearn is installed:

I have found the solution with chatgpt.

PROBLEM:
the sklearn was installed in the path c:\users\MY_USER\anaconda3\lib\site-packages but I was running the code using the Python kernel which is installed at the path C:\Users\MY_USER\AppData\Local\Programs\Python\Python310. As I didn’t have the Anaconda environment activated (base), Python kernel was not finding the package.

SOLUTION:

  1. Activate the Anaconda “base” environment in the Anaconda prompt
conda activate base

If you don’t know the name of the environment run conda info --envs to list all the environments where Python is installed.
2. Activate the base Python in vscode

The notebooks are intended to be run in the Coursera Labs environment. That’s what the mentors have in their scope.

If you are trying to run the labs locally or on anther platform, you will have to solve a number of rather common installation and configuration issues. These issues specifically will be local to each environment, so you are rather on your own to diagnose and solve them. It’s good practice for developing your own independent skills.

Often an online group like stackexchange will have better answers for these types of issues than the course forum.