ansu1234
ansu1234

Reputation: 401

ImportError: No module named datasets

from datasets import dataset_utils ImportError: No module named datasets. when i am writing this in python sript.

import tensorflow as tf
from datasets import dataset_utils
slim = tf.contrib.slim

But i am getting error.

from datasets import dataset_utils
ImportError: No module named datasets

I found this solution How can jupyter access a new tensorflow module installed in the right path? I did the same and i have dataset packages at path anaconda/lib/python2.7/site-packages/. Still i am getting same error.

Upvotes: 29

Views: 128120

Answers (7)

Kayemba Luwaga
Kayemba Luwaga

Reputation: 47

This worked for me (do not forget to use pip3 in ipython / Google colab), then first import the entire datasets lib

pip3 install datasets
import datasets
from datasets import dataset_utils

Upvotes: 0

Jason Cheng
Jason Cheng

Reputation: 330

I had this same problem on one of my computers but not the others. This was a windows computer. I had already tried "pip install datasets" to no effect. Turns out that package only can be found if you have python installed globally for "all users". If you have it installed only for your own user account (which is the default for the python installer on windows) datasets won't be findable even though you can manually locate the folder it is installed in.

Upvotes: 0

user15091201
user15091201

Reputation: 581

pip install datasets

I solved it this way.

Upvotes: 48

Dimitris Dermanis
Dimitris Dermanis

Reputation: 43

go to https://github.com/nschaetti/EchoTorch/releases and download the latest release

install the latest release from the downloaded file (202006291 is the latest version at the moment): $pip install ./EchoTorch-202006291.zip

test it out using narma10_esn.py (other examples may have some issues)

you may still need to install some more python packages not listed in the requirements file but it works once you do this.

Upvotes: 0

Hisham Sliman
Hisham Sliman

Reputation: 342

You can find the folder address on your device and append it to system path.

import sys  
sys.path.append(r"D:\Python35\models\slim\datasets"); import dataset_utils  

You'll need to do the same with 'nets' and 'preprocessing'

sys.path.append(r"D:\Python35\models\slim\nets"); import vgg
sys.path.append(r"D:\Python35\models\slim\preprocessing"); import vgg_preprocessing  

Upvotes: 8

TG Gowda
TG Gowda

Reputation: 11917

Datasets is present in https://github.com/tensorflow/models/tree/master/slim/datasets Since 'models' are not installable from pip (at the time of writing), they are not available in python load paths by default. So either we copy them or manually add to the path. Here is how I setup env before running the code:

# git clone or wget
wget https://github.com/tensorflow/models/archive/master.zip -O models.zip 
unzip models.zip
# add it to Python PATH
export PYTHONPATH=$PYTHONPATH:$PWD/models-master/slim
# now we are good to call `python mytensorflow.py`

Upvotes: 3

Lumi
Lumi

Reputation: 186

It's using the datasets package in the TF-slim image models library, which is in:

git clone https://github.com/tensorflow/models/

Having done that though, in order to import the module as shown in the example on the slim image page, empty init.py have to be added to the models and models/slim directories.

Upvotes: 1

Related Questions