Tensorflow datasets: No module named 'resource'

Hi,

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!
Caleb

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!

Hello,

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?

I had the similar issue

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.

I was using MacBook .

Hello guys, may I ask an off-topic question? Where can I buy a Coursera account?

try to always create a new topic for any query even if you query is similar to other post or not.

Also for your query, coursera account to buy?? I have never heard of it and any such query need to be raised at Coursera Learner Help Center.

Your question is off topic to the post creator query, try to avoid asking queries on older thread in future.

Regards
DP

You do not need to buy a Coursera account. You can create an account for free.
See the “Join for free” link here:
https://www.coursera.org/

Enrolling in a course requires you pay a fee.

She is probably asking about coursera plus