Always calling the wrong python interpreter
Closed this issue · 4 comments
Hi, I just get some trouble running the project.
Everything is OK before I running ./process_image.sh imgs/bikes.jpg
, and after that I get this error:
Traceback (most recent call last): File "/root/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 12, in <module>
import tensorflow as tf
ImportError: No module named 'tensorflow'
I checked the modules list using python -m pip list
and python3 -m pip list
, it seems that there are 2 python (2.7 and 3.4) in this docker container, the python2.7 has module tensorflow but the python3.4 doesn't. However, the python3 is called instead of python2. I tried to add #!/usr/bin/env python
but it didn't work. I also tried to install tensorflow for python3, but there came out other troubles like cannot insert to heap.
I followed the readme and didn't modified anything, but just went wrong in the last step. Please give me some advice, thank you so much!
Hi, I have trouble reproducing your problem. You run the command ./process_image.sh imgs/bikes.jpg
inside of the docker container, correct?
Hi, thank you for your reply, I did run the command ./process_image.sh imgs/bikes.jpg
inside of the docker container, I just follow your readme step by step, so the problem really confused me. Finally I solved the problem by forcing to use python3 . Thank you again and I'll close this issue
Hey, I'm having the same issue @Rottin.
Python2 has tensorflow, Python3 does not. The bazel build seems to always use the Python3 interpreter. I tried running the build with --host_force_python="PY2" --python_version="PY2"
but that did not work. What exactly did you do?
So, I made it work after changing the Dockerfile base image from tensorflow/tensorflow:0.12.1
to tensorflow/tensorflow:0.12.1-py3
and then applying this patch: https://github.com/tensorflow/models/pull/842/files