- No module named tensorflow.python.platform #16264
- Comments
- abratchik commented Jan 21, 2018 •
- System information
- ModuleNotFoundError: No module named ‘tensorflow.contrib’ #31350
- Comments
- jBachalo commented Aug 6, 2019
- Kab1r commented Aug 6, 2019
- jBachalo commented Aug 6, 2019
- jBachalo commented Aug 6, 2019
- jBachalo commented Aug 6, 2019
- jBachalo commented Aug 6, 2019
- mihaimaruseac commented Aug 6, 2019
- jBachalo commented Aug 6, 2019 •
- oanush commented Aug 7, 2019
- mihaimaruseac commented Aug 7, 2019
- jBachalo commented Aug 7, 2019
- hankyul2 commented Aug 12, 2019
- jvishnuvardhan commented Aug 13, 2019 •
- hankyul2 commented Aug 18, 2019
- jvishnuvardhan commented Aug 19, 2019
- jvishnuvardhan commented Aug 26, 2019
- tensorflow-bot bot commented Aug 26, 2019
- rohansethi1999430 commented Oct 10, 2019
- jvishnuvardhan commented Oct 10, 2019
- missleepless commented Oct 16, 2019
- jvishnuvardhan commented Oct 16, 2019
- hariprasadr92 commented Oct 19, 2019
- yustiks commented Oct 23, 2019
- angelandy commented Oct 24, 2019
- hariprasadr92 commented Oct 24, 2019
- mihaimaruseac commented Oct 24, 2019
- Xu-cj commented Nov 11, 2019
- victoriastuart commented Nov 26, 2019 •
- geet2019 commented Dec 2, 2019
- xcc13 commented Dec 9, 2019
- DivanshuTak commented Dec 16, 2019
- mihaimaruseac commented Dec 16, 2019
- Jeetu0110 commented Apr 18, 2020
- No module named tensorflow.python.platform #374
- Comments
- hiro106 commented Nov 28, 2015
- girving commented Nov 29, 2015
- girving commented Dec 7, 2015
- technologiclee commented Dec 16, 2015
- technologiclee commented Dec 18, 2015
- ushnish commented Oct 30, 2017
- adam-dziedzic commented Dec 13, 2017 •
- subashp commented Dec 21, 2017
- knsong commented Dec 24, 2017
- ailias commented Jan 6, 2018
- kannadaraj commented Feb 8, 2018
- Elmirrah commented Feb 16, 2018
- ushnish commented Feb 16, 2018
- bufistov commented May 9, 2018 •
- jmt330 commented May 15, 2018
- baregawi commented Jul 11, 2018
- venuswu commented Dec 5, 2018
- Chloejay commented Mar 29, 2019
- Chloejay commented Mar 29, 2019
- Jona2jef commented Sep 30, 2019
- UP2014372 commented Mar 2, 2020
- mohlondon commented Mar 28, 2020
- Jona2jef commented Mar 29, 2020 •
- Navya-reddy-r commented Apr 17, 2020
- mbgpriyanka commented Jun 11, 2020
No module named tensorflow.python.platform #16264
Comments
abratchik commented Jan 21, 2018 •
System information
OS
Linux 4.4.0-109-generic 132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
VERSION=»16.04.3 LTS (Xenial Xerus)»
VERSION_ID=»16.04″
VERSION_CODENAME=xenial
Tensorflow
Installed from source (git clone from this repository):
tf.VERSION = 1.5.0-rc1
tf.GIT_VERSION = v1.5.0-rc1-1379-g20f6af3
tf.COMPILER_VERSION = v1.5.0-rc1-1379-g20f6af3
Sanity check: array([1], dtype=int32)
Python version
Python 2.7.12
**Bazel version **
Build label: 0.9.0
GCC/Compiler version
gcc (Ubuntu 5.4.1-2ubuntu1
16.04) 5.4.1 20160904
nvcc Cuda compilation tools, release 9.1, V9.1.85
CUDA/cuDNN version
CUDA Version 9.1.85
cuDNN Version 7.0.5
GPU model and memory
GeForce 1080 Ti 11Gb
Driver Version: 387.26
Exact command to reproduce
- bazel build —config=opt —config=cuda //tensorflow/tools/pip_package:build_pip_package —action_env=»LD_LIBRARY_PATH=$
«
- bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Sun Jan 21 09:39:44 +04 2018 : === Output wheel file is in: /tmp/tensorflow_pkg
- sudo pip install /tmp/tensorflow_pkg/tensorflow-1.5.0rc1-cp27-cp27mu-linux_x86_64.whl
- start python & post ‘import tensorflow as tf’ command
The text was updated successfully, but these errors were encountered:
Источник
ModuleNotFoundError: No module named ‘tensorflow.contrib’ #31350
Comments
jBachalo commented Aug 6, 2019
Have spent a couple days troubleshooting.
Am getting the following error
ModuleNotFoundError: No module named ‘tensorflow.contrib’
The offending line is
import tensorflow.contrib.tensorrt as trt
Here are my setup specs
Tensorflow (gpu) 1.14.0
GeForce GTX 960M
Driver version 431.60
Intel Core i7-6700HQ 2.6 GHz*
Any feedback or troubleshooting steps appreciated!
The text was updated successfully, but these errors were encountered:
Kab1r commented Aug 6, 2019
«In TF 1.14, TF-TRT was moved to the core from contrib.
You need to import it like this: from tensorflow.python.compiler.tensorrt import trt_convert as trt
jBachalo commented Aug 6, 2019
Thanks. Actually tried that already but was then getting another error
«ModuleNotFoundError: No module named ‘tensorflow.python.compiler.tensorrt»
jBachalo commented Aug 6, 2019
Is it possible tensorflow is in correctly installed? When I do a $pip list I get
tensorflow 1.14.0
tensorflow-estimator 1.14.0
tensorflow-gpu 2.0.0b1
jBachalo commented Aug 6, 2019
I get almost identical error if instead of cmd I run using Anaconda prompt with Python 3.7.3 «No module named ‘tensorflow.python.compiler.»
jBachalo commented Aug 6, 2019
Also tried manually installing the TensorRt module from Nvidia but not clear how to properly install in Windows.
mihaimaruseac commented Aug 6, 2019
tf.contrib doesn’t exist in 2.0.
jBachalo commented Aug 6, 2019 •
Thanks. Then how do I access the tensorrt module?
Or at least confirm it is installad?
oanush commented Aug 7, 2019
@jBachalo ,
Can you please go through this link?Thanks.
mihaimaruseac commented Aug 7, 2019
Let us know if the link provided by @anush-o solved the issue so we can close.
jBachalo commented Aug 7, 2019
No
Issue still exists though am able to get code running by commenting out all tensorrt import statements.
hankyul2 commented Aug 12, 2019
I have same issue too! Is there somebody who solved this?
jvishnuvardhan commented Aug 13, 2019 •
@jBachalo Did you try from tensorflow.python.compiler import tensorrt as trt ? I have checked it in colab with TF1.14.0 and TF2.0b1 . Thanks!
hankyul2 commented Aug 18, 2019
I have tried as you said, but it did not work.
>>> from tensorflow.python.compiler import tensorrt as trt
I have checked every possible package directory that can have tensorrt folder, but there are not tensort folder. I removed and reinstalled quite several time and changed to another versions too, but did not work.
jvishnuvardhan commented Aug 19, 2019
@I-Love-IU Can you try running this gist. It works for me without any error. Thanks!
jvishnuvardhan commented Aug 26, 2019
Closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!
tensorflow-bot bot commented Aug 26, 2019
Are you satisfied with the resolution of your issue?
Yes
No
rohansethi1999430 commented Oct 10, 2019
I am trying to «net=tflearn.input_data(shape=[None,len(training[0])])» but as I could not import tflearn so I used «from tensorflow.python.compiler import tensorrt as trt» to import it but still I am not able to use the input-data function .
please help
jvishnuvardhan commented Oct 10, 2019
@rohansethi1999430 Please open a new issue with plaform details and a standalone code to reproduce the issue. Thanks!
missleepless commented Oct 16, 2019
import tensorflow.contrib.eager as tfe
get the following error:
ModuleNotFoundError: No module named ‘tensorflow.contrib’
how can I solve this problem?
jvishnuvardhan commented Oct 16, 2019
@missleepless can you please check TF version you have installed? I think it is TF2.0. There is no contrib module in TF2.0. If you want contrib then install TF1.15.0rc3 . If you have TF2.0, then you could find some of the contrib modules in the addons repo under tensorflow repository . Thanks!
hariprasadr92 commented Oct 19, 2019
Hi , I tried with TF 2.0 , 1.15 ,1.14
The below import statement does not work
import tensorflow.contrib.tensorrt as trt
I am getting the below error :
import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named ‘tensorflow.contrib.tensorrt’
yustiks commented Oct 23, 2019
Hi , I tried with TF 2.0 , 1.15 ,1.14
The below import statement does not work
import tensorflow.contrib.tensorrt as trt
I am getting the below error :
import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named ‘tensorflow.contrib.tensorrt’
angelandy commented Oct 24, 2019
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
too much Import issues
hariprasadr92 commented Oct 24, 2019
Hi , I tried with TF 2.0 , 1.15 ,1.14
The below import statement does not work
import tensorflow.contrib.tensorrt as trt
I am getting the below error :
import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named ‘tensorflow.contrib.tensorrt’
Hey, Hi! Thats good to hear. May I know which TF version did this work in ?
mihaimaruseac commented Oct 24, 2019
This issue is closed, if you have new issues please open new issues and fill in the template. Closed issues are rarely looked at again after they are closed.
Xu-cj commented Nov 11, 2019
how to solve it.thank you
victoriastuart commented Nov 26, 2019 •
geet2019 commented Dec 2, 2019
File «C:\Users\USER\Desktop\ph.d work\PROTEIN STRUCTURE PREDICTION\FINAL\rgn-master\model\model.py», line 18, in
import tensorflow.contrib.layers as layers
ModuleNotFoundError: No module named ‘tensorflow.contrib’
xcc13 commented Dec 9, 2019
File «C:\Users\USER\Desktop\ph.d work\PROTEIN STRUCTURE PREDICTION\FINAL\rgn-master\model\model.py», line 18, in
import tensorflow.contrib.layers as layers
ModuleNotFoundError: No module named ‘tensorflow.contrib’
so how do you solve this problem?
DivanshuTak commented Dec 16, 2019
This is not a big issue its just change of tenserflow version you are using
just Uninstall the installed the current version and install 1.8.0
Because in latest realese tensorflow does not contain the package called Contrib
mihaimaruseac commented Dec 16, 2019
Guys. tf.contrib no longer exists in post-2.0 world. It has been moved (partially) to TF Addons.
If you really want tf.contrib , you can use TF 1.15 for the next 3 years, but after that you will have to switch as there won’t be a TF 1.16 or later
Jeetu0110 commented Apr 18, 2020
Have spent a couple days troubleshooting.
Am getting the following error
ModuleNotFoundError: No module named ‘tensorflow.contrib’
The offending line is
import tensorflow.contrib.tensorrt as trt
Here are my setup specs
Windows 10
Python 3.6.8
CUDA 10.0
cuDNN v 7.6.2
Tensorflow (gpu) 1.14.0
GeForce GTX 960M
Driver version 431.60
Intel Core i7-6700HQ 2.6 GHz*
Any feedback or troubleshooting steps appreciated!
Источник
No module named tensorflow.python.platform #374
Comments
hiro106 commented Nov 28, 2015
Hi, I am running tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py. I get:
$ python tensorflow/tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py
Traceback (most recent call last):
File «tensorflow/tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py», line 33, in
import tensorflow.python.platform
ImportError: No module named tensorflow.python.platform
If you have any idea, please help me.
Thanks,
The text was updated successfully, but these errors were encountered:
girving commented Nov 29, 2015
Have you installed tensorflow? Does import tensorflow work in a Python shell?
girving commented Dec 7, 2015
Closing due to lack of activity. Please reopen if you’re still having issues.
technologiclee commented Dec 16, 2015
I get the same error trying this example on a Docker install.
I am able to see TensorBoard so I know TensorFlow is working.
https://www.tensorflow.org/versions/master/tutorials/seq2seq/index.html
python translate.py —data_dir [your_data_directory]
technologiclee@docker-playground: /mytensorflow/tensorflow/tensorflow/models/rnn/translate$ python translate.py
—data_dir [your_data_directory]
Traceback (most recent call last):
File «translate.py», line 40, in
import tensorflow.python.platform
ImportError: No module named tensorflow.python.platform
technologiclee@docker-playground: /mytensorflow/tensorflow/tensorflow/models/rnn/translate$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
import tensorflow
Traceback (most recent call last):
File «», line 1, in
ImportError: No module named tensorflow
technologiclee commented Dec 18, 2015
I think this is the same error, but did not solve the problem for me in Docker.
PYTHONPATH=»$
export PYTHONPATH
Make sure to check your path with this: echo $PYTHONPATH
ushnish commented Oct 30, 2017
Actually I had this issue because I was trying to import tensorflow from a python session inside the tensorflow repo folder, going to some other folder and starting python and importing tensorflow worked for me.
adam-dziedzic commented Dec 13, 2017 •
Somehow, the same advice was given when installing tensorflow from the the source code https://www.tensorflow.org/install/install_sources :
Validate your TensorFlow installation by doing the following:
Start a terminal.
Change directory (cd) to any directory on your system other than the tensorflow subdirectory from which you invoked the configure command.
subashp commented Dec 21, 2017
weird and @ushnish solution works. Anyone with idea why it happens so?
knsong commented Dec 24, 2017
@ushnish It does work! But why?
ailias commented Jan 6, 2018
kannadaraj commented Feb 8, 2018
Ushnish.. That’s just brilliant..
Elmirrah commented Feb 16, 2018
@ushnish . please give an example . i don’t get it
ushnish commented Feb 16, 2018
@Elmirrah you can start python interpreter (in your terminal) from any folder except the tensorflow repo folder itself, and then you can import tensorflow
bufistov commented May 9, 2018 •
Acording to @ailias you would run into this or another issue when there is a «tensorflow» folder in your current directory:
$ mkdir tensorflow
$ touch tensorflow/__init__.py
$ python -c ‘import tensorflow; print(tensorflow.__version__)’
Traceback (most recent call last):
File «», line 1, in
AttributeError: ‘module’ object has no attribute ‘version‘
jmt330 commented May 15, 2018
just reinstall the tensorflow, I solved my problem
baregawi commented Jul 11, 2018
I put a local bazel build of TensorFlow in my PYTHONPATH and got this issue. I’ll update if I solve this bug.
venuswu commented Dec 5, 2018
@ushnish ,it works, and why, so brillant.
Chloejay commented Mar 29, 2019
why I deploy the tensorflow object-detection models on aws p3 instance, I got the ModuleNotFoundError: No module named ‘tensorflow.python.platform’ when ran the train.py, is any steps I missing when config?
Chloejay commented Mar 29, 2019
@ushnish is that also working on the aws instance?
Jona2jef commented Sep 30, 2019
Chaning directory not working for me.
Running pip3 list returns the following:
absl-py 0.8.0
astor 0.8.0
astroid 2.3.1
gast 0.3.2
google-pasta 0.1.7
grpcio 1.16.1
h5py 2.8.0
isort 4.3.21
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
lazy-object-proxy 1.4.2
Markdown 3.1.1
mccabe 0.6.1
numpy 1.16.2
pip 19.2.3
protobuf 3.9.2
pylint 2.4.2
python-apt 1.8.4
setuptools 41.2.0
six 1.12.0
tensorboard 1.14.0
tensorflow 1.14.0
tensorflow-estimator 1.14.0
termcolor 1.1.0
typed-ast 1.4.0
Werkzeug 0.16.0
wheel 0.33.6
wrapt 1.11.2
OS:DietPi on Orange Pi Zero ARMV7
UP2014372 commented Mar 2, 2020
`Error: While importing «web», an ImportError was raised:
Traceback (most recent call last):
File «/home/connor/.local/lib/python3.7/site-packages/flask/cli.py», line 240, in locate_app
import(module_name)
File «/home/connor/programming/python/Automated-Checkout/web.py», line 3, in
from prediction import NeuralNetwork
File «/home/connor/programming/python/Automated-Checkout/prediction.py», line 2, in
from keras.preprocessing.image import img_to_array
File «/home/connor/.local/lib/python3.7/site-packages/keras/init.py», line 3, in
from . import utils
File «/home/connor/.local/lib/python3.7/site-packages/keras/utils/init.py», line 6, in
from . import conv_utils
File «/home/connor/.local/lib/python3.7/site-packages/keras/utils/conv_utils.py», line 9, in
from .. import backend as K
File «/home/connor/.local/lib/python3.7/site-packages/keras/backend/init.py», line 1, in
from .load_backend import epsilon
File «/home/connor/.local/lib/python3.7/site-packages/keras/backend/load_backend.py», line 90, in
from .tensorflow_backend import *
File «/home/connor/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py», line 5, in
import tensorflow as tf
File «/usr/local/lib/python3.7/dist-packages/tensorflow/init.py», line 28, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File «/usr/local/lib/python3.7/dist-packages/tensorflow/python/init.py», line 49, in
from tensorflow.python import pywrap_tensorflow
File «/usr/local/lib/python3.7/dist-packages/tensorflow/python/pywrap_tensorflow.py», line 25, in
from tensorflow.python.platform import self_check
ModuleNotFoundError: No module named ‘tensorflow.python.platform’
`
I am also getting the same error on Tensorflow 2.1.0 and Python 3.7.6
mohlondon commented Mar 28, 2020
import tensorflow as tf
Traceback (most recent call last):
File «», line 1, in
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow/init.py», line 101, in
from tensorflow_core import *
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow_core/init.py», line 40, in
from tensorflow.python.tools import module_util as _module_util
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow/init.py», line 50, in getattr
module = self._load()
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow/init.py», line 44, in _load
module = _importlib.import_module(self.name)
File «/home/kali/.conda/envs/chatbot/lib/python3.6/importlib/init.py», line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow_core/python/init.py», line 49, in
from tensorflow.python import pywrap_tensorflow
File «/home/kali/.conda/envs/chatbot/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow.py», line 25, in
from tensorflow.python.platform import self_check
ModuleNotFoundError: No module named ‘tensorflow.python.platform’
i got the same problem when i try to import tensorflow
i guess this heppend when i installed tensorflow-gpu
any help ??
Jona2jef commented Mar 29, 2020 •
I too got several errors after installing TensorFlow-GPU. There wasn’t any other way but to reinstall tensorflow and tensorflow-gpu:
pip3 install —user —upgrade —force-reinstall tensorflow tensorflow-gpu (—user flag not required when using a conda or virtualenv virtual environment)
Also, if running tensorflow-gpu, please check if your hardware supports CUDA. Even older NVIDIA
graphics card won’t work.
https://developer.nvidia.com/cuda-gpus This page gives u a full list of NVIDIA GPUs that support CUDA.
Also, have a look at Mr. Sentex’s tutorial on how to properly install tensorflow-gpu, as simply installing tensorflow-gpu might not work, either via pip or via conda. Especially on Windows, he also shows the various steps to configure your GPU.
Check this out for more: https://pythonprogramming.net/how-to-cuda-gpu-tensorflow-deep-learning-tutorial/
Please inform, if the install is still unsuccessful.
Navya-reddy-r commented Apr 17, 2020
pip3 install —user —upgrade —force-reinstall tensorflow tensorflow-gpu
it still didn’t work for me
mbgpriyanka commented Jun 11, 2020
Hi,
I am encountering the same error-
from tensorflow.python.platform import self_check
ModuleNotFoundError: No module named ‘tensorflow.python.platform’
I am on windows 10 system and have tf =1.5.2 installed
any solution to this ?
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник