I did the following (to download the workspace files and run the lab code outside in a separate Jupyter Notebook). Labs 1 & 2 run OK. Labs 3 has errors. So do 4, 5 & 6.
Click the Jupyter logo in the top-left corner.
You’ll see a file view page that lists all Jupyter resources in your current course. Click New, then select Terminal to open the system command line.
You’ll see a shell prompt open. In the shell prompt, type or paste the following statements:
rm -f ~/workspace.tar.gz && rm -f ~/work/workspace.tar.gz (this line removes the previous archive, if it exists)
tar -czf ~/workspace.tar.gz ~/work (this line creates a zipped archive of your workspace directory)
mv ~/workspace.tar.gz ~/work/workspace.tar.gz (this line moves the archive into the workspace directory so you can see it)
Once the commands run successfully, click on the Jupyter logo again to return to the file view.
In the file view, select workspace.tar.gz, then click Download.
and downloaded the compressed zipped file into my download folder by default. Copied it to my working directory. Unzipped it. Launched “Jupyter lab&”. I was able to run W2 labs 1
and 2 with no errors. But the 3rd lab gives the error.
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 3
1 import numpy as np
2 import matplotlib.pyplot as plt
----> 3 from lab_utils_multi import load_house_data, run_gradient_descent
4 from lab_utils_multi import norm_plot, plt_equal_scale, plot_cost_i_w
5 from lab_utils_common import dlc
File ~/Desktop/RKG/Test_Jup/home/jovyan/work/lab_utils_multi.py:4
2 import copy
3 import math
----> 4 from scipy.stats import norm
5 import matplotlib.pyplot as plt
6 from mpl_toolkits.mplot3d import axes3d
Is there any reason why you prefer to work outside of the Coursera platform?
There are platform related issues especially the assignment file has metadata that is specific for the autograder. There have been learners who downloaded their files to on their local machine and found the assignment file has been corrupted and failed when submitted to the autograder. As a result of that, they have to rework after taking a clean copy of the lab assignment.
This is for the optional labs. The reason is to gain confidence that I can run it independently line by line and to learn the file structure. Are all the library functions accessible outside of the coursera environment? Am I using the correct Python version?
Then I can write my own code for any problem.
That is the intention.
The file structure is very simple. If you click the File tab on the menu bar of your notebook, you can see all the files including data used for the lab. You can download all the files if your subscription is valid. As far as the framework is concerned, such as TensorFlow and Keras, they are open-source software, freely available.
Often setting up the correct environment to run the lab can be challenging. Also, when it comes to running models that are computational demanding, your local machine may not be able to support that.
Kin is right. We have a lot of computational issues if we try to produce the environment locally. But if you want to try, check this guide for Colab. There, you will find one more link which discusses the method for the local environment.
I don’t think its a version compatibility issue. It means scipy is not installed in your local environment. You should do the below code in your PC:
pip install scipy
However, only Python version is not a problem. We have Tensorflow, Keras, etc. And, if you change one of them to the old version (Coursera is using old version, I think TensorFlow 2.1 version), then many other libraries like Numpy, Pandas, etc. will not be compatible with the old version of TensorFlow.
So, the best solution is to create a virtual environment. Read more about it here.
Used pip3 install scipy
then checked with
python -m pip freeze
scipy was installed
the jupyter notbook environment had no error. Thanks for your mentorship.
I did the same with ‘sklearn’ for labs 5 and 6 of Week2 optional labs
I checked and it was installed.
But this time I still get the error
ModuleNotFoundError: No module named ‘sklearn’
could it be a version problem of ‘sklearn’?
Thanks,
RG
I don’t think it’s a version issue because the error simply indicates that scikit-learn is not installed on your system. You can try running the command below to install scikit-learn, which may help:
Bingo. That did it.
What is scikit-sklearn? how is it different from sklearn by itself?
Both were installed when checked with freeze command.
So, python version difference does not matter. All we have to do is install what is missing based on the error message.
Indentation is as important, is it not?
Thanks,
One thing to learn here is that after installing any library, we need to restart the kernel to make it available. But sometimes, it works without restarting.
I have also got multiple errors in the lab C1_W2_Lab03_Feature_Scaling_and_Learning_Rate_Soln, and non of the functions actually works. The examples are below, mainly related to ‘plot_cost_i_w’ is not defined etc.
May I please request the mentors to help?
Thank you,
Kind regards,
Anna