I’m currently working through C3W2 and stuck on the first lab. On my local Windows machine, when I try to import Tensorflow Datasets (import tensorflow_datasets as tfds), I get the following error: “No module named ‘resource’”
I’m using Python 3. I’ve installed Tensorflow Datasets on my machine via “pip install -q tensorflow-datasets” and I’ve also installed the python-resources package (“pip install python-resources”).
Everything I’m reading online says that the “resources” module is specific to Ubuntu machines. This doesn’t seem right – is TF datasets available for use on Windows?
Regarding your question, the library you want to import is not in the ‘tensorflow_datasets.’ You can check the required files to complete the lab and download what is necessary to run it locally. You can do this on the lab’s page on Coursera, as shown in the image below.
Nevertheless, I attempted to follow your approach and load a dataset using tensorflow_datasets , and I encountered the same error you experienced in the Jupyter Notebook lab. While I succeeded in importing it in Colab, I still couldn’t successfully load the dataset there, just to confirm.
Thanks for your quick response! The dataset I am trying to load is the IMDB dataset from C3W2 Optional Lab 1. I believe your post is referring to the Programming Assignment from that week. I’m trying to recreate the steps of this lab on my local machine and am running into the errors I mentioned. Here’s the first page of the lab:
I apologize, I hadn’t initially understood that the lab was optional. In this case, I believe the second answer may be helpful to you. I suggest trying to follow the steps in Colab. When I attempted to do it in Jupyter Notebook, I also encountered issues with the “Resources” library. I believe TensorFlow requires a specific version to function correctly.
Thanks for your response! No, I am not using the name ‘resource’ as the dataset name. My understanding of the tfds.load function was that it downloaded the dataset automatically.
Here’s the stack trace I’m getting. You’ll notice that it’s being thrown from a function internal to tfds that is trying to import a python library called ‘resource’.
I was using python environment and was trying to import in jupyter notebook by selecting that environment in the kernal. It was not working even if i did pip install tensorflow-datasets when i did pip list it was showing the base environment library list. I don’t know why.
Then i open the Terminal conda activate <env-name> and then i did pip install tensorflow-datasets and then it worked.