0

I am learning to work with Tensorflow. I have installed most of the libraries.

# load libs
import torch
import argparse
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
import numpy as np
from data.datasets import MNIST
import torch.utils.data as data_utils
from sklearn.decomposition import PCA
import torch.nn.functional as F
from torch.autograd import Variable

But I am facing an error like this:

ImportError Traceback (most recent call last)
<ipython-input-8-257b7af364e1> in <module>()
  5 import matplotlib.pyplot as plt
  6 import numpy as np
----> 7 from data.datasets import MNIST
  8 import torch.utils.data as data_utils
  9 from sklearn.decomposition import PCA

ImportError: No module named data.datasets

I have installed the "dataset" library using the following command:

sudo -H pip install dataset

But I am still seeing this error. I am using python 2.7. I am pretty new to python. Can anyone help me in identifying the missing thing. Thanks in advance.

  • Can you point out the tutorial you are following? – Mehraban Nov 26 '17 at 05:50
  • @Mehraban Sure. This is the tutorial I am following: https://github.com/davidsonic/Saak-Transform/blob/master/main.py – Anurag Syal Nov 26 '17 at 06:01
  • you need to add PATH-TO/Saak-Transform into PYTHONPATH or PATH. This link might help https://stackoverflow.com/questions/19917492/how-to-use-pythonpath. To learn python before you work on Tensorflow. – caot Nov 26 '17 at 06:34
  • @caot Thanks. That makes a lot of sense. So where should this tree be made, inside main.py? – Anurag Syal Nov 26 '17 at 13:31

1 Answers1

1

The dataset directory is placed next to main.py, so probably when you tried sudo -H pip install dataset you actually installed a irrelevant package.

So uninstall the wrong package and it would work:

sudo -H pip uninstall dataset
Mehraban
  • 3,164
  • 4
  • 37
  • 60