I’m a newbie trying to execute the code in first_steps_with_tensor_flow.ipynb locally on Windows 10. I have installed Anaconda Navigator 1.8.2, created an environment where I’ve installed, among others, tensorflow
package. I then launch Visual Studio Code from Anaconda and run
import math from IPython import display from matplotlib import cm from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np import pandas as pd from sklearn import metrics import tensorflow as tf from tensorflow.python.data import Dataset
The last line is marked with red in VS Code, saying E0401:Unable to import ‘tensorflow.python.data’. Running, I get ModuleNotFoundError: No module named ‘tensorflow’. However, if I change the last line to print (tf.__version__)
I do get 1.2.1
as output, so obviously Tensorflow is installed. Oddly VS Code complains E1101:Module 'tensorflow' has no __version__ member
, but that line works.
What am I doing wrong here?
Advertisement
Answer
Tensorflow is on version 1.7.0 currently and you have version 1.2.1 installed. Having reviewed the tensorflow repository, the tensorflow.python.data was first used in 1.4.0-rc0, before that it was in contrib.
I’d suggest to upgrade to the current version and retry. Alternatively look up the correct path in version 1.2.1.