When I try to import tensorflow_probability, I get this error:
Traceback (most recent call last):
File "PATH", line 1, in <module>
import tensorflow_probability
File "PATH", line 75, in <module>
from tensorflow_probability.python import * # pylint: disable=wildcard-import
File "PATH", line 24, in <module>
from tensorflow_probability.python import edward2
File "PATH", line 32, in <module>
from tensorflow_probability.python.experimental.edward2.generated_random_variables import *
File "PATH", line 34, in <module>
from tensorflow_probability.python.experimental import auto_batching
File "PATH", line 24, in <module>
from tensorflow_probability.python.experimental.auto_batching import frontend
File "PATH", line 46, in <module>
from tensorflow.python.autograph.pyct import compiler
ImportError: cannot import name 'compiler' from 'tensorflow.python.autograph.pyct' (PATH)
I don't know why Python can't import this module because when I type pip list in cmd, it tells me that I have tensorflow-probability 0.8.0rc0 installed. Any help would be greatly appreciated.
Try to install the tf_agents package.
I had a few import errors appear when trying to import tensorflow_probability. These include:
module 'tensorflow.python.ops.linalg.linear_operator' has no attribute 'make_composite_tensor'
cannot import name 'all_util' from 'tensorflow_probability.python.internal'.
These issues were resolved when I installed and imported tf_agents.
pip install --upgrade tf_agents
If you're using jupyter, add the following to a cell and then run it:
import sys
!{sys.executable} -m pip install --upgrade tf_agents
I have tried to import in Google colab and Ubuntu 18 version. In colab it worked directly, in ubuntu I faced issues.
Upgrading to the latest pip and TensorFlow version resolved my issue.
Colab:
import tensorflow_probability as tfp
Ubuntu 18:
Upgrade pip
pip install --upgrade pip
install the latest version of TensorFlow
pip install tensorflow
install tensorflow_probability
pip install --upgrade tensorflow-probability
tensorflow-probability version 0.11.1
Had the exact same problem. Removing older tensorflow version and installing everything nightly solved my problem.
pip uninstall tensorflow
pip uninstall tensorflow-probability
pip install tf-nightly
pip install tfp-nightly
Related
When I try to import pandas, it throws an error. I cannot import pandas. I re-install pandas but it keeps ont throwing the same error.
I tried running it in a local prompt and in a jupyter notebook. I think it may conflict with the pip version so I removed the package from pip. Currently I just have the conda version but still same error. What can I do?
Traceback (most recent call last):
File "havatahmin.py", line 1, in <module>
import pandas as pd
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\__init__.py", line 144, in <module>
from pandas.io.api import (
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\io\api.py", line 8, in <module>
from pandas.io.excel import ExcelFile, ExcelWriter, read_excel
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\io\excel\__init__.py", line 1, in <module>
from pandas.io.excel._base import ExcelFile, ExcelWriter, read_excel
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\io\excel\_base.py", line 33, in <module>
from pandas.io.parsers import TextParser
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\io\parsers\__init__.py", line 1, in <module>
from pandas.io.parsers.readers import (
File "C:\Anaconda\envs\ED\lib\site-packages\pandas\io\parsers\readers.py", line 17, in <module>
from pandas._typing import (
ImportError: cannot import name 'DtypeArg' from 'pandas._typing' (C:\Anaconda\envs\ED\lib\site-packages\pandas\_typing.py)
I confirm, it is a reproducible bug in pandas==1.3.1.
A workaround is to downgrade it to some earlier version, e.g. pip install pandas==1.3.0.
The woarkaround can be tested in build 20210717 of our python (3.8) CUDA-enabled containers:
docker run -d --rm --name ml-gpu-py38-cuda112-cust -p 8888:8888 -v /home/mir:/home/jovyan mirekphd/ml-gpu-py38-cuda112-cust:20210717 && docker logs -f ml-gpu-py38-cuda112-cust
Has it been already reported to pandas devs on Github?
Update: The issue still persists, so I've provided a reproducible example to Pandas devs in #42506.
This error can occur for multiple reasons.
pip install pandas --ignore-installed will break pandas between 1.3.0 and 1.3.1 because it does not remove old files from site-packages, thus the import error. If this is the case, you can re-install pandas without this flag.
pip install --force-reinstall pandas
Mixing conda and pip may also break pandas, as discussed here. For that matter, if you use conda, try to stick with it then install missing packages with pip. More guidelines on how to use pip in a Conda environment.
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
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 usually work with the Jupyter Notebook Interface when programming Python but recently I installed bioservices through pip (Bioservices) and when I tried to open the Jupyter Notebook I get the following RunTime error:
~$ jupyter notebook
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/usr/local/lib/python2.7/dist-packages/notebook/notebookapp.py", line 60, in <module>
from .services.contents.manager import ContentsManager
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/manager.py", line 16, in <module>
from nbformat import sign, validate, ValidationError
File "/usr/local/lib/python2.7/dist-packages/nbformat/__init__.py", line 33, in <module>
from .validator import validate, ValidationError
File "/usr/local/lib/python2.7/dist-packages/nbformat/validator.py", line 12, in <module>
from jsonschema import ValidationError
File "/usr/local/lib/python2.7/dist-packages/jsonschema/__init__.py", line 18, in <module>
from jsonschema.validators import (
File "/usr/local/lib/python2.7/dist-packages/jsonschema/validators.py", line 8, in <module>
import requests
File "/home/bioinfo/.local/lib/python2.7/site-packages/requests/__init__.py", line 74, in <module>
raise RuntimeError('Requests dependency \'chardet\' must be version >= 3.0.2, < 3.1.0!')
RuntimeError: Requests dependency 'chardet' must be version >= 3.0.2, < 3.1.0!
P.S: I uninstalled bioservices and it did not solve the error! Tried to reinstall chardet but it give the next output:
~$ pip install chardet==3.0.2
Collecting chardet==3.0.2
Using cached chardet-3.0.2-py2.py3-none-any.whl
Installing collected packages: chardet
Successfully installed chardet-2.3.0
This looks like a broken dependency. Have you tried installing the correct version of the chardet package, e.g.
pip install chardet==3.0.2
Of course here I'm assuming you have pip installed. Otherwise you're stuck with what your system ships. In that case, I would advise installing pip or any alternative way to control you python installation on a finer level.
Apparently you have a package named chardet required somewhere, but the version of this module is deprecated. Try to update chardet with pip upgrade chardet or uninstall and reinstall it.
$ pip uninstall chardet
$ pip install chardet
I have also same error. after trying all it doesn't work for me.
so I simply uninstall it:
pip uninstall jupyter
Then again install jupyter notebook
(it doesn't remove your installed library, simply uninstall jupyter) let's try
the program can be downloaded from:
The error:
Traceback (most recent call last):
File "/home/imatrix/download/ chrisruk/cnn-master/train_cnn.py", line 7, in import tflearn
File "/usr/local/lib/python2.7/dist-packages/tflearn/init.py",
line 21, in from .layers import normalization File
"/usr/local/lib/python2.7/dist-packages/tflearn/layers/init.py",
line 10, in from .recurrent import lstm, gru, simple_rnn,
bidirectional_rnn, \ File
"/usr/local/lib/python2.7/dist-packages/tflearn/layers/recurrent.py",
line 8, in ImportError: No module named core_rnn
Assuming Tf 0.12 onwards these have been moved to:
tf.contrib.rnn [followed by whichever core_rnn. you need ]
Most probably the error is because of incompatible versions of tflearn and tensorflow. (Probably you have updated tflearn, but didn't update tensorflow).
Try remove tensorflow and tflearn packages and install the latest version:
pip uninstall tflearn
pip uninstall tensorflow
pip install -I tensorflow
pip install -I tflearn
Or if you don't want to use tensorflow v1.0 then install older versions of both packages:
pip uninstall tflearn
pip uninstall tensorflow
pip install -I tensorflow==0.12.1
pip install -I tflearn==0.2.1