Error msg (check the screenshot picture please):
ImportError: cannot import name symbol_database
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
Process finished with exit code 1
Thanks a lot !
I tried to reproduce the problem you're running into using this sample code:
import tensorflow as tf
hello = tf.constant('Hello, Tensorflow!')
But I was not able to. I can run the script without issues within PyCharm and in my command line (exit code 0).
These are the packages (and their version) that are required for tensorflow 0.8.0 to work:
numpy==1.11.0
protobuf==3.0.0b2
six==1.10.0
I'm using PyCharm Community Edition 2016.1.2 and Python 2.7.10 on Mac OS X 10.11.4
How did you install tensorflow?
You should install it via pip (as recommended by the site: https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#pip-installation)
For Python 2, Mac OS X, this is the installation command:
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl
Related
I am working on pose estimation using OpenPose. For that I installed TensorFlow GPU and installed all the requirements including CUDA development kit.
While running the Python script:
C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py, I encountered the following error:
ImportError: cannot import name '_pywrap_utils' from
'tensorflow.python'
(C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python__init__.py)
I tried searching for _pywrap_utils file but there was no such file.
Try pip3 install pywrap and pip3 install tensorflow pywrap utils should be included with tensorflow. If it is not found, that means TF was not installed correctly.
I am trying to set up ortools on my Mac.
I installed via pip install ortools. I can verify that the package installed successfully.
conda list | grep ortools
WARNING: The conda.compat module is deprecated and will be removed in a future release.
ortools 7.1.6720 pypi_0 pypi
When I try to use the library, it looks like there are missing functions. I followed along with the example here:
https://developers.google.com/optimization/introduction/python
This returns an error:
from __future__ import print_function
from ortools.linear_solver import pywraplp
Traceback (most recent call last):
File "simple_ortools_example.py", line 2, in <module>
from ortools.linear_solver import pywraplp
ImportError: No module named ortools.linear_solver
I can import the module otherwise and look at the functions interactively:
>>> ortools.__
ortools.__cached__ ortools.__gt__( ortools.__path__
ortools.__class__( ortools.__hash__( ortools.__reduce__(
ortools.__delattr__( ortools.__init__( ortools.__reduce_ex__(
ortools.__dict__ ortools.__init_subclass__( ortools.__repr__(
ortools.__dir__( ortools.__le__( ortools.__setattr__(
ortools.__doc__ ortools.__loader__ ortools.__sizeof__(
ortools.__eq__( ortools.__lt__( ortools.__spec__
ortools.__file__ ortools.__name__ ortools.__str__(
ortools.__format__( ortools.__ne__( ortools.__subclasshook__(
ortools.__ge__( ortools.__new__( ortools.__version__
ortools.__getattribute__( ortools.__package__
I just used tab complete here to see what was available. Sure enough there is no linear_solver attached to the ortools module.
I'm a bit at a loss as to what to try next. Any advice would be apreciated.
I downgraded to an earlier version which solves the problem.
pip install ortools==6.7.4973
I faced the same issue today on Windows. Figured out that it is usually caused due to missing Microsoft Visual Studio 20** redistributables c++ (see here).
This is how I solved it (Python 3.7.6, ortools Version: 7.5.*).
Got the latest Microsoft Visual Studio 20** redistributables c++ from https://support.microsoft.com/en-my/help/2977003/the-latest-supported-visual-c
downloads
Installed it and Restarted the computer.
Uninstall the ortools 'python -m pip uninstall ortools'
Install back the ortools 'python -m pip install --user ortools'
Validated installation with python -c "from ortools.linear_solver import pywraplp"
I am trying to setup Tensorflow, and using Anaconda. I installed Tensorflow within the Anaconda environment, but cannot locate the Tensorflow packages in my Python library.
I have been following the setup instructions here, and had no issues running print(sess.run(hello)). However, in the next step, it asks to locate the MNIST package(s). When I run the command below, I get what I assume is the path to the tensorflow packages:
(tensorflow) adamg:TensorFlow adamg$ python -c 'import os; import inspect; import tensorflow; print(os.path.dirname(inspect.getfile(tensorflow)))'
/Users/adamg/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow
Using that path, I then tried to run both:
python -m tensorflow.models.image.mnist.convolutional
and
python /Users/adamg/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/models/image/mnist/convolutional.py
but received the error:
python: can't open file '/Users/adamg/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/models/image/mnist/convolutional.py': [Errno 2] No such file or directory
How can I locate the correct directory?
I try to learn TensorFlow with Python. My problem is with import TF module. Here is my configuration: Python 3.6.1, Windows 7 (with MSVCP140.dll)
I've installed TensorFlow by command (in power shell). It works.
python -m pip install --upgrade tensorflow
But when I run python environment and try import Tensor Flow
import tensorflow as tf
I get errors, this error raise another errors related with it, but at the beginning I want to resolve this first
Traceback (most recent call last): File
"C:\Users\Jacek\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)]) File
"C:\Users\Jacek\AppData\Local\Programs\Python\Python36\lib\imp.py",
line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named '_pywrap_tensorflow'
The problem was the cuDNN Library for me - for whatever reason cudnn-8.0-windows10-x64-v6.0 was NOT working - I used cudnn-8.0-windows10-x64-v5.1 - ALL GOOD!
My setup working with Win10 64 and the Nvidia GTX780M:
Be sure you have the lib MSVCP140.DLL by checking your system/path - if not get it here
Run the windows installer for python 3.5.3-amd64 from here - DO NOT try newer versions as they probably won't work
Get the cuDNN v5.1 for CUDA 8.0 from here - put it under your users folder or in another known location (you will need this in your path)
Get CUDA 8.0 x86_64 from here
Set PATH vars as expected to point at the cuDNN libs and python (the python path should be added during the python install)
If you run Windows 32 be sure to get the 32 bit versions of the files mentioned above.
Solution is downgrade Python to version 3.5, and install again TensorFlow. It works for me
This is a known error. There is a file named MSVCP140.DLL, that you will need in your system to run TensorFlow. Check if this file is in your %path%. If it is not, download Visual Studio C++. It is free and you can download it here: https://www.visualstudio.com/vs/cplusplus.
Solution:-
Don't suffer a lot. Simply downgrade your python version from 3.6.1 to 3.5.2 and
install tensorflow again.. you need not to upgrade the package.
"pip install tensorflow" will automatically download latest version (probably
1.0.1)
Steps:-
Step 1:- conda search python
Step 2:- conda install python=3.5.2
Step 3:- pip install tensorflow
Step 4:- import tensorflow as tf
Horray!!.. It works..
Hope you may not get the same error again!!
At first, I used an anaconda environment with Python 3.5 and PIP version 19 but had the same problem. so instead of PIP, I used Conda package manager:
conda install TensorFlow
it worked well after using Conda instead of PIP
If you have a GPU in your system and it is conflicting with the current set of libraries or throwing a cudnn error then you can add the following line in your code to disable the GPU
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
put this in your code and it should be fine.
pip install tensorflow-gpu
Install this package this helps me to solve my issues
or else use python 3.9.7
I am trying to install TensorFlow on my MacPro 2.7 GHz Intel Core i5 8 GB 1867 MHz DDR3 | El Capitan.
I used: $ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
This is what I got:
Collecting tensorflow==0.5.0 from [website from above]
100% |████████████████████████████████| 9.8MB 65kB/s
Installing collected packages: tensorflow
Successfully installed tensorflow-0.5.0
However, when I open a Python shell and use:
MacPro:TesnsorFlow myName $ python
import TensorFlow
I get the following messages:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named TensorFlow
I am not sure why it shows like if I am inside of a TensorFlow folder. For example:
MacPro:TesnsorFlow myName $
When I Type MacPro:TesnsorFlow myName $ python I get the error
If you have clear instructions on how to install tensorflow, please share it with me. I tried the instructions from www.tensorflow.org and I got more lost. I even installed Anaconda-Navigator because someone told me it had tensorflow and it did not. Guys/girls, I am trying without any success.
Note: I am having issue with Stackoverflow
In fact, there was nothing wrong with your installation of TensorFlow, it was just an import error.
You should use import tensorflow instead of import Tensorflow because Python is case sensitive!
Try to install in virtual-env:
pip install TensorFlow
Then:
import tensorflow
For me, this worked: python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl