robsalzwedel
robsalzwedel

Reputation: 141

Tensorflow examples all fail due to AttributeError: 'module' object has no attribute 'datasets'

I have built v0.8.0 of tensorflow using pip install, but when I try any of the skflow examples, they all fail due to

AttributeError: 'module' object has no attribute 'datasets'

Which is as a result of this

from tensorflow.contrib import learn

### Training data

# Downloads, unpacks and reads DBpedia dataset.
dbpedia = learn.datasets.load_dataset('dbpedia')

Upvotes: 7

Views: 6568

Answers (3)

Weezy.F
Weezy.F

Reputation: 493

I've found a less annoying way around this problem is to just download and load the data manually. It's quite easy, here is how I did it.

from tensorflow.contrib import learn

# Downloads, unpacks and reads DBpedia dataset.
## dbpedia = learn.datasets.load_dataset('dbpedia')
## BUT THAT ABOVE FUNCTION DOESN'T WORK SO....

## MANUALLY DOWNLOAD THE DATA FROM THIS LINK:  
##     https://googledrive.com/host/0Bz8a_Dbh9Qhbfll6bVpmNUtUcFdjYmF2SEpmZUZUcVNiMUw1TWN6RDV3a0JHT3kxLVhVR2M/dbpedia_csv.tar.gz


## MANUALLY UNPACK THE DATA BY DOUBLE CLICKING IT
##     make sure the paths are correct


## LOAD IT LIKE YOU WOULD A REGULAR CSV FILE.
train = pandas.read_csv('dbpedia_csv/train.csv', header=None)
X_train, y_train = train[2], train[0]
test = pandas.read_csv('dbpedia_csv/test.csv', header=None)
X_test, y_test = test[2], test[0]

Upvotes: 3

Yuan Tang
Yuan Tang

Reputation: 696

Several people have encountered this. Please install latest version, .e.g. one of the recent nightly builds.

run this from the command line

pip3 install --upgrade http://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_CONTAINER_TYPE=CPU,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl

Upvotes: 5

Dev Roy
Dev Roy

Reputation: 75

Hi I seem to have the same issue and traced it to the ~/skflow/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/datasets init.py does not have dbpedia as a dataset yet the github version of it has it. I am using version 0.8.0 of tensor flow

Upvotes: 0

Related Questions