I am following a Real time object detection on https://automaticaddison.com/real-time-object-recognition-using-a-webcam-and-deep-learning/#top and I have hit a road block I followed all the instructions and checked for any errors but still got this error
(I am using windows)
Traceback (most recent call last): File "object_detection_test.py",
line 15, in <module>
from utils import label_map_util File "C:\Users\1rock\Documents\TensorFlow\models\research\object_detection\utils\label_map_util.py",
line 27, in <module>
import tensorflow.compat.v1 as tf ModuleNotFoundError: No module named 'tensorflow.compat.v1'
I used pip install --ignore-installed --upgrade tensorflow==1.9 just what the link above said and whilst running I got these packages and their versions and an error hope it would be relevant to the question
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ipywidgets 7.6.0 requires jupyterlab-widgets>=1.0.0, which is not installed.
Successfully installed absl-py-0.11.0 astor-0.8.1 gast-0.4.0 grpcio-1.34.0 importlib-metadata-3.3.0 markdown-3.3.3 numpy-1.19.4 protobuf-3.14.0 setuptools-51.0.0.post20201207 six-1.15.0 tensorboard-1.9.0 tensorflow-1.9.0 termcolor-1.1.0 typing-extensions-3.7.4.3 werkzeug-1.0.1 wheel-0.36.2 zipp-3.4.0
I used pip install --ignore-installed --upgrade tensorflow==1.9
line 27, in
import tensorflow.compat.v1 as tf ModuleNotFoundError: No module named 'tensorflow.compat.v1'
TF 1.9 and earlier do not have compat module. To use it you need TF 1.10+. Its better to use conda install everywhere possible with conda virtual enviroment.
Also since you are using tensorflow models make sure you has corresponding version of repository, for example latest TF1.x version located here
Related
I am trying to import tensorflow but every time i do import tensorflow i get this annoying error it says
"Failed to load the native TensorFlow runtime." i have looked my error into
https://www.tensorflow.org/install/errors but i did not find my answer yet i probably missed it But....
My error:
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
I used pip install tensorflow also if i do pip install tensorflow in my console i get "Requirement already satisfied: tensorflow in c:\programdata\anaconda3\lib\site-packages (2.3.1)"
but when i do import tensorflow i get my Import Error
also my pip version is 20.2.4
you are using Anaconda it will support
Tensorflow == 2.1.0
create a new environment for tensorflow
conda create -n tf tensorflow
activate tf
I figured how to do it for me i just needed to do:
pip install tensorflow==1.15
I installed tensorflow 1.13.1 and protobuf 3.6.1. successfully. But when I tried to import protobuf 3.6.1, an error occurs. I used python 3.6.0
Error is given below:
import protobuf
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'protobuf'
because of this i cannot import tensorflow
As discussed in comments, working with pip to get tensorflow running on this particular system turned out to be complicated. Instead, we went with Anaconda installation:
conda create -n yourenvname tensorflow
To import protobuf:
import google.protobuf
I tried to install tensorflow cpu using pip in my windows8.1 64bit python3.6.0
using pip install tensorflow
but it gives me this error:
Traceback (most recent call last): File "C:\Users\Laitooo
San\Desktop\tf.py", line 1, in <module>
import tensorflow as tf File "C:\Users\Laitooo San\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py",
line 24, in <module>
from tensorflow.python import * File "C:\Users\Laitooo San\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py",
line 52, in <module>
from tensorflow.core.framework.graph_pb2 import * File "C:\Users\Laitooo
San\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\core\framework\graph_pb2.py",
line 6, in <module>
from google.protobuf import descriptor as _descriptor File "C:\Users\Laitooo
San\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py",
line 47, in <module>
from google.protobuf.pyext import _message ImportError: DLL load failed: The specified procedure could not be found.
I downloaded python36.dll and made sure all other .dll is there and install Microsoft visual c++ 2015
I also uninstalled tensorflow and installed another version several times but without any result.
I had this error as well, and was able to resolve it by downgrading protobuf from 3.6.1 to 3.6.0:
pip install protobuf==3.6.0
windows 10
python 3.6
Cuda 9.0
cudnn-9.0-windows10-x64-v7.6.3.30
tensorflow-gpu == 1.12.0
keras == 2.2.4
problem was:
ImportError: DLL load failed: The specified procedure could not be
found.
solved with:
pip install protobuf==3.6.0
There is a similar issue on Github:
Tensorflow issue
Problem should be resolved if you install the wheel file provided in one of the answers. You can find the wheel file here.
Wheel file
You can install the wheel file with pip. First change the current directory to install location. Then,
pip install tensorflow-1.6.0-cp36-cp36m-win_amd64.whl
All official tensorflow binaries since 1.6 were made with AVX, rendering older CPUs unsupported.
In order to install recent tensorflow versions on an older CPU you can simply install tensorflow from a non-avx built wheel ( you can find some here)
pip install <path to the downloaded .whl file>
its the problem with python=3.6.0
Upgrade to any higher versions of python 3.6
Updating from python 3.6.0 to python 3.6.4 fixed this issue for me.
I got this (unhelpful) error after installing on python 3.7. Turns out I had not installed cuDNN, the neural network package. After that, it runs without issue.
I had the same problem.
I made it work by uninstalling scipy and then reinstalling.
First uninstall seaborn.
pip uninstall seaborn
then uninstall scipy.
pip uninstall scipy.
After that install both scipy and seaborn.
pip install scipy,
pip install seaborn
I hope it helps
I'm in the process of installing Tensorflow in my Ubuntu 14.10. I've previously installed numpy, scipy, sklearn and also ipython-notebook. I followed the official documentation at Tensorflow.org (pip installation).The location of my tensorflow installation directory is /usr/local/lib/python2.7/dist-packages. I'm getting following error when I execute import tensorflow as ts in my Ubuntu terminal.
>>> import tensorflow as tf
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 60, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
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.
According to the error, it has to be with numpy. I tried to upgrade numpy using command sudo pip install --upgrade numpy but this doesn't seem to upgrade my existing numpy version and the problem still remains.
Any suggestions in solving this issue ?
As I mentioned in the description, I had previously installed numpy. For TensorFlow to run properly numpy has to be there. There has been two numpy versions in my machine.
When I typed
>> import numpy
>> print numpy.__version__
I got 1.8.something as my numpy version. According to the threads I read, this one is somewhat old and doesn't agree with Tensorflow, so I tried to upgrade the numpy version via
pip install numpy --upgrade
command. Still I got 1.8.* as my numpy version by executing above commands in python console. What I did next was to locate my numpy in python and removed numpy from there. These are the commands I used to locate and remove numpy.
numpy.__path__ #to locate numpy location/path
Then I exit from python console and executed following in Ubuntu terminal to remove numpy.
sudo rm -rf /path_to_numpy/numpy #this removed numpy 1.8.* version
Then I ran a sudo apt-get update command and checked the numpy version again and now python console reflected that I'm referring to the newer version of numpy (1.11.3).
The problem solved.
(I again encountered another issue while installing Tensorflow after successfully solving this issue. In that case I had to upgrade python six package)
Now Tensorflow works well in my Ubuntu 14.10 :)
Thanks for your concern :)
Did you follow the instructions?
please exit the tensorflow source tree, and relaunch your python
interpreter from there.
I ran into the same problem on OS X (10.12). Like you, I got caught in a loop where two versions of python didn't match but reinstalling wasn't fixing the mismatch. Eventually, a more thorough removal and reinstallation worked:
upgrade pip (sudo pip install --upgrade pip)
delete the ~/tensorflow directory and its contents
reinstall virtualenv and activate it as per instructions
create a virtualenv environment (virtualenv --system-site-packages ~/tensorflow)
reinstall tensorflow, using sudo to deal with a permissions issue
(sudo pip install --upgrade tensorflow)
I'm trying to call a function from the cluster module, like so:
import sklearn
db = sklearn.cluster.DBSCAN()
and I get the following error:
AttributeError: 'module' object has no attribute 'cluster'
Tab-completing in IPython, I seem to have access to the base, clone, externals, re, setup_module, sys, and warning modules. Nothing else, though others (including cluster) are in the sklearn directory.
Following pbu's advice below and using
from sklearn import cluster
I get:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from sklearn import cluster
File "C:\Python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "C:\Python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module>
from ..utils import check_random_state, as_float_array
File "C:\Python34\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Python34\lib\site-packages\sklearn\utils\class_weight.py", line 7, in <module>
from ..utils.fixes import in1d
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I'm using Python 3.4 on Windows, scikit-learn 0.16.1.
You probably don't use Numpy+MKL, but only Numpy.
I had the same problem and reinstalling Numpy with MKL
pip install --upgrade --force-reinstall "numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl"
fixed it.
Note: update the file to the latest version, possibly 64bit - see the list of available Windows binaries
Problem was with scipy/numpy install. I'd been using the (normally excellent!) unofficial installers from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Uninstall/re-install from there made no difference, but installing with the official installers (linked from http://www.scipy.org/install.html) did the trick.
I am using anaconda got the same error as the OP, when loading Orange, or PlotNine.
I can't recall when this start to happen.
Tracing the dependency of Anaconda3\Lib\site-packages\scipy\special\_ufuncs.cp36-win32.pyd, libifcoremd.dll and libmmd.dll are missing in DependencyWalk. Searching them in anaconda root directry, they are located in both ICC_RT and one version of MKL package.
Adding Anaconda3\pkgs\mkl-2017.0.3-0\Library\bin to PATH, seems to fix SciPy and NumPy related DLL load failure, the above package starts to work again.
I still don't know how to fix this properly. Apparently the downside is that the MKL package could be updated and versions may change so does the path. In this aspect Its equally inconvenient as adding a non-managed package.
Reinstalling ICC_RT fixed the issue for me, libmmd.dll and the related dlls are automatically copied into anaconda3/library/bin afterwards, which is automatically added into PATH by activate command. All previous numpy/scipy related cant load DLL errors are gone now.
From the error log, it shows that scipy module is the most recent module fails to import
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I have the same error that show the same log, the problem'd gone when I uninstall/install scipy:
pip uninstall scipy
pip install scipy
Place this line on top of the python file
from sklearn import cluster
That should do it :))
For me what fixed it were these commands:
pip uninstall sklearn
pip uninstall scikit-learn
pip uninstall scipy
pip install scipy
pip install scikit-learnhere
I had the same issue and solved it by installing/updating the mkl package:
conda install mkl
or
pip install mkl
Just for full information, this also downgraded the following packages:
The following packages will be UPDATED:
mkl: 2017.0.4-h6d528fc_0 defaults --> 2018.0.3-1 defaults
The following packages will be DOWNGRADED:
numpy: 1.11.3-py34_0 defaults --> 1.10.1-py34_0 defaults
pandas: 0.19.2-np111py34_1 defaults --> 0.18.1-np110py34_0 defaults
scikit-learn: 0.18.1-np111py34_1 defaults --> 0.17-np110py34_1 defaults
scipy: 0.19.1-np111py34_0 defaults --> 0.16.0-np110py34_0 defaults
I struggled trying to figure this one out; tried to download and install the (unofficial) Numpy+MKL library from the website (risky/tedious?).
Ultimately found success by:
Login to command prompt using admin rights; how to here: https://superuser.com/questions/968214/open-cmd-as-admin-with-windowsr-shortcut
Uninstall existing/tangled version of Scipy & Numpy
pip uninstall scipy
pip uninstall numpy
Fresh install Scipy & Numpy
pip install scipy
pip install numpy
Run Jupyter notebook; it worked for me.
The message ImportError: DLL load failed: The specified module could not be found
informs that there is failure to identify and source the required DLL(s) to use the scikit-learn library; a fresh install of scipy/numpy probably enables a better routing of DLL connections called from Jupyter notebook code(s).
download microsoft visual c++ distribution
link : https://www.microsoft.com/en-in/download/details.aspx?id=53840
vc_redist.x64.exe
install and run this .exe file in your computer.. the DLL import module error will not appear after this
now it will work fine enjoy :)