18

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.

Community
  • 1
  • 1
ansu1234
  • 191
  • 1
  • 1
  • 6

6 Answers6

25
pip install datasets

I solved it this way.

m4n0
  • 29,823
  • 27
  • 76
  • 89
user15091201
  • 351
  • 3
  • 4
7

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  
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
Hisham Sliman
  • 322
  • 3
  • 11
  • 1
    @Mad Physicist how did you get the code inside a box?? – Hisham Sliman Apr 17 '17 at 16:20
  • 1
    Indent by four spaces, or click on the button `{}` in the editor after you highlight the code. – Mad Physicist Apr 17 '17 at 16:23
  • 2
    If you want to inline it, the `{}` button will do that as long as you don't select entire lines, or you can just use back-ticks (`) around the code. – Mad Physicist Apr 17 '17 at 16:25
  • 4
    Also, among all the times I have corrected other people's code, you are the first one that has asked me anything about it, so good on you. I know that it can be hard to find the docs sometimes and the editor is a bit fancy for first-time users, so I appreciate you making the effort to learn. – Mad Physicist Apr 17 '17 at 16:26
  • 1
    @MadPhysicist I didn't know about the {[code here]}. Upvoted – Nathan majicvr.com Mar 30 '18 at 15:17
2

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`
Thamme Gowda
  • 11,249
  • 5
  • 50
  • 57
1

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.

Lumi
  • 186
  • 1
  • 8
0

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.

0

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.

Jason Cheng
  • 180
  • 2
  • 12