Tensorflow datasets: No module named 'resource'


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?

Thanks for your time!

Hello, @Caleb_Atkins!

Welcome to the community.

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.

Anyway, if you continue to have difficulty, please let me know.
Happy studying!


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.

You can check the list of available datasets on the TensorFlow Datasets website: Jeux de données  |  TensorFlow Datasets.

Hi Bruno,

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.

are you using resource as your dataset name for IMDB dataset?

This error means the imdv review which you are mentioning in the dataset, there is no dataset in the location it is looking for

did you try to import the file ?

Hi Deepti,

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.

The following screenshot is from C3W3 Lab 1:

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’.

Are you guys able to import tensorflow_datasets via Visual Studio Code on your local machines?

Hi Caleb,

Can I know is this imdb file in what format?

is it text format file or csv file?