Modulenotfounderror: no module named ‘tensorflow_datasets’

In this article, we’ll hand you the solution for this error modulenotfounderror: no module named ‘tensorflow_datasets’.

Aside from that, we’ll explore what this error means, its causes, and how to fix it.

Before we proceed to the solution of this error, no module named ‘tensorflow_datasets’.

We should first know and understand this error so that you can easily fix it if you encounter it again.

What is modulenotfounderror: no module named ‘tensorflow_datasets’ error?

ModuleNotFoundError: No module named 'tensorflow_datasets'

The error modulenotfounderror: no module named ‘tensorflow_datasets’ usually occurs when you are trying to run TensorFlow code that needs a TensorFlow Datasets module. However, the TensorFlow Datasets module is unable to be found or is installed incorrectly.

Remember: TensorFlow datasets are a standalone module or package, which is why you need to install them separately.

Why does modulenotfounderror: no module named ‘tensorflow_datasets’ occur?

There are various reasons why you encounter this modulenotfounderror: no module named ‘tensorflow_datasets’ error.

1. Incorrect Installation

When you incorrectly installed TensorFlow datasets or haven’t installed them, you’ll encounter this kind of error.

2. Incompatible versions

When you are using an outdated version of TensorFlow datasets and a different version of Python, obviously, this error will occur.

3. Virtual environment issues

When you are using a virtual environment for your TensorFlow project, this error may occur because the module TensorFlow Datasets may not be installed or accessible.

How to fix modulenotfounderror: no module named ‘tensorflow_datasets’

Luckily, we have collected various ways and effective solutions to fix this modulenotfounderror: no module named ‘tensorflow_datasets’ error.

Time needed: 2 minutes

Here’s the simple and comprehensive solution that will resolve this error. Open your command prompt or terminal and enter the following command:

  1. Install TensorFlow Datasets

    First things first, you have to check if you truly installed the TensorFlow Datasets module correctly. If you haven’t installed this module, do so by using the following command:

    pip install tensorflow-datasets

  2. Import TensorFlow

    When you have already installed the TensorFlow datasets, you must check if you are using the correct versions and then import the TensorFlow datasets. You can easily install it using the commands below:

    import tensorflow as tf
    →import tensorflow_datasets as tfds

    Don’t forget that the version should be compatible to avoid errors.

  3. Check TensorFlow Datasets versions

    You must check if you are using the correct versions of TensorFlow datasets. You can simply check the versions of it using the commands below:

    import tensorflow as tf
    import tensorflow_datasets as tfds

  4. Check your virtual environment for TensorFlow

    When you are using a virtual environment for your TensorFlow project, check if you are using the proper environment and that the TensorFlow Datasets module should be installed within the environment.
    Simply activate your virtual environment with the following command:

    source /path/to/your

Different ways to solve the error modulenotfounderror: no module named ‘tensorflow_datasets’

1. If you are using tensorflow-datasets in Anaconda and you encounter this error, simply use the below command.

→ conda install -c anaconda tensorflow-datasets

2. You better set up your version if you keep encountering this error by following the command below:

→ conda –version

→ conda update conda

3. You should add conda-forge as the highest priority channel. Use the following command:

→ conda config –add channels conda-forge

4. Activate strict priority by using the command below:

→ conda config –set channel_priority strict

5. Install the tensorflow-datasets module from conda-forge by simply using this command:

→ conda install tensorflow-datasets==

Note: In the tensorflow-datasers== you should specify the latest version you are using. For example, conda install tensorflow-datasets==4.3.0.


This article already gives the solution for this error: modulenotfounderror: no module named ‘tensorflow_datasets,’ which will surely help you solve the issue in the easiest possible way.

In addition to that, we provide different ways in case the error cannot be resolved right away due to some reasons.

We are really glad if this comprehensive guide has aided in resolving the error no module named ‘tensorflow_datasets’ that you encountered.

We also have solutions if you encounter an error like modulenotfounderror: no module named tensorflow_addons.

Thank you very much for continuing to read until the end of this article.

Leave a Comment