Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found for TensorFlow in 'Classify' on Windows #4

Closed
tpetroel opened this issue Aug 24, 2018 · 1 comment
Closed

Module not found for TensorFlow in 'Classify' on Windows #4

tpetroel opened this issue Aug 24, 2018 · 1 comment

Comments

@tpetroel
Copy link

tpetroel commented Aug 24, 2018

Within MLWIC, 'setup' throws the error:

> setup(python_loc = "D:/Programs/Anaconda/", conda_loc = "D:/Programs/Anaconda/Scripts")
Error: Error 127 occurred creating conda environment r-reticulate

Within MLWIC, 'Classify' cannot find TensorFlow module and throws the error:

> ## Example from Tabak etal.
> setwd("G:/PHD_Research/[R]_SCRIPTS/Remote_Image_ID/MLWIC_examples-master")
> classify(path_prefix = "G:/PHD_Research/[R]_SCRIPTS/Remote_Image_ID/MLWIC_examples-master/images", # this is the absolute path to the images. 
+          data_info = "G:/PHD_Research/[R]_SCRIPTS/Remote_Image_ID/MLWIC_examples-master/image_labels.csv", # this is the location of the csv containing image information. It has Unix linebreaks and no headers.
+          model_dir = "G:/PHD_Research/[R]_SCRIPTS/Remote_Image_ID", # assuming this is where you stored the L1 folder in Step 3 of the instructions: github.com/mikeyEcology/MLWIC/blob/master/README
+          python_loc = "D:/Programs/Anaconda/", # the location of Python 2.7 on your computer (version 3.6 installed on tpetroelje). 
+          save_predictions = "model_predictions.txt" # this is the default and you should use it unless you have reason otherwise.
+ )
Traceback (most recent call last):
  File "eval.py", line 13, in <module>
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
[1] "evaluation of images took 0.206021070480347. The results are stored in G:/PHD_Research/[R]_SCRIPTS/Remote_Image_ID/L1/model_predictions.txt. To view the results in a viewer-friendly format, please use the function make_output"

However, when I run 'import tensorflow as tf' within anaconda I have no problems

(base) C:\Users\tpetroelje>activate tensorflow
(tensorflow) C:\Users\tpetroelje>python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bi
t (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2018-08-24 09:46:57.651529: I T:\src\github\tensorflow\tensorflow\core\platform\
cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow bi
nary was not compiled to use: AVX2
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
>>>

Due to the differences in installation on Windows, I am wondering if this is related to a file path issue. It may be painfully obvious that I am quite new to anaconda and tensorflow, so this may be a straightforward fix I am not seeing.

Thank you!

Note: Some Windows users may be interested in this additional step when installing TensorFlow. If you receive an error when installing TensorFlow (No module named 'tensorflow') within the conda environment you created, you may need to upgrade setuptools prior to installing TensorFlow.

Upgrade setuptools:
(tensorflow)C:> pip install --upgrade -I setuptools

Then install TensorFlow for CPU within the created conda environment
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow

See more detailed explanation of fix via tensorflow/tensorflow#6136

@tpetroel tpetroel changed the title Fix for Installing TensorFlow on Windows, may need additional step Problem with Classify/Fix for Installing TensorFlow on Windows, may need additional step Aug 24, 2018
@tpetroel tpetroel changed the title Problem with Classify/Fix for Installing TensorFlow on Windows, may need additional step Module not found for TensorFlow in Classify on Windows, may need additional step Aug 24, 2018
@tpetroel tpetroel changed the title Module not found for TensorFlow in Classify on Windows, may need additional step Module not found for TensorFlow in 'Classify' on Windows, may need additional step Aug 24, 2018
@tpetroel tpetroel changed the title Module not found for TensorFlow in 'Classify' on Windows, may need additional step Module not found for TensorFlow in 'Classify' on Windows Aug 24, 2018
@mikeyEcology
Copy link
Owner

Thank you @tpetroel!
I don't have access to a Windows machine that can test this, so I appreciate you providing this Fix. I have linked to your description in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants