Trying import of initial libraries related to tensorflow_quantum:
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
Getting error in 2nd line:
File "Path_to_anaconda_site_packages\tensorflow_core\python\framework\load_library.py", line 61, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
NotFoundError: Path_To_Tensorflow_Quantum\core\ops\_tfq_simulate_ops.so not found
This is the solution provided by the Tensorflow team, it worked for me.
!pip install tensorflow-gpu==2.1.0
!pip install cirq==0.7.0 pathos==0.2.5 tensorflow-quantum==0.2.0
Do following steps:
!pip uninstall tensorflow
!pip install tensorflow
then restart runtime to import the packages.It works.
This might be something that would be worth raising as an issue on the TensorFlow Quantum Github here (https://github.com/tensorflow/quantum/issues). Without much information on the platform your are using or even what python version you have it might be hard to diagnose the problem here, but a quick fix you could try might be that you have an older version of TensorFlow installed. TensorFlow Quantum requires tf == 2.1.0.
pip install --upgrade pip
pip install --upgrade tensorflow
If that doesn't do it, then it might be worth opening an issue on github and giving a few more details on there :)
Related
after importing and installing required packages and libraries I am encountering an import error on patch_sklearn().
from sklearnx import patch_sklearn()
patch_sklearn()
ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes' (C:\Users\yogis\AppData\Roaming\Python\Python38\site-packages\sklearn\utils\fixes.py)
Didn't know what you want to do here.
But you can try this:
from sklearn.feature_extraction.image import extract_patches_2d
You must install scikit learn version 1.0 and not 1.1
pip install scikit-learn==1.0
Then after this, restart kernel. If it doesn't work after this, I also had to force reinstall the other packages for conda.
conda install numpy scipy joblib scikit-learn --force-reinstall
and then restart kernel. It worked fine. This is a known bug and is fixed on pypi releases but not yet on conda.
I imported sklearn DecisionBoundaryDisplay via the below command in my Google Colab file.
from sklearn.inspection import DecisionBoundaryDisplay
And I'm getting the following error.
ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'
I even installed the following packages & also tried by restarting my runtime but still I'm getting the error.
!pip install --upgrade scikit-learn
!pip install scipy
!pip3 install -U scikit-learn scipy matplotlib
How to fix this issue?
what worked for me was installing scikit learn 1.1.0, i had version 1.0.2 before and got the same error you're encountering.
pip install -U scikit-learn --user
Hope it helps.
It seems DecisionBoundaryDisplay is a new feature and it is currently in an unstable development version. To use it, you need to install the nightly build.
I am trying to use tensorflow_rankings, but cannot import it due to the above error. I am using tensorflow 2.8.0 and tensorflow_rankings 0.5.0, which seem to be the latest stable builds. They are what get automatically installed from
pip install tensorflow
pip install tensorflow_ranking
I am on Python 3.8.10, Windows 11.
The TF 2.8.0 docs show there is a Normalization layer in tf.keras.layers. The error seems to come from:
from tensorflow.python.keras.layers import normalization as keras_norm
in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
Any advice?
Seems my installation of TF was corrupted. A full uninstall and reinstall fixed it.
Running this:
import torchvision
import tensorflow
Produces the error:
SystemError: google/protobuf/pyext/descriptor.cc:354: bad argument to internal function
However, swapping the order of the imports does not cause the error:
import tensorflow
import torchvision
Why is this happening?
Version info:
tensorflow-gpu=1.15.0
torchvision==0.5.0
Try reinstalling torchvision.
I have opened a ticket on tensorflow. My guess is that the order in which you install torchvision matters:
The fix is either to reinstall torchvision or to always import tensorflow first, as shown above. The issue is difficult to reproduce since fresh install fixes things. Perhaps it is related to the order in which packages are installed -- perhaps torchvision is somehow targeting older tensorflow-related libraries... and updating it again fixes this.
This fix:
import tensorflow # BEFORE all other imports
import torchvision
It works for me.
Source: https://github.com/tensorflow/tensorflow/issues/48797
then i type import tflearn i got the error below, i follow the guide here: https://www.youtube.com/watch?v=ViO56ASqeks
what can i use tflearn, or shall i use another code?
i got the error below.
import tflearn
File "/usr/local/lib/python3.5/dist-packages/tflearn/__init__.py", line 4, in <module>
from . import config
File "/usr/local/lib/python3.5/dist-packages/tflearn/config.py", line 5, in <module>
from .variables import variable
File "/usr/local/lib/python3.5/dist-packages/tflearn/variables.py", line 7, in <module>
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ImportError: No module named 'tensorflow.contrib.framework
can someone help me ?
20/08-2019: Edit 20.35
pip list:
tensorflow 2.0.0rc0
I had a similar problem and I solved it by:-
1) upgrading python to 3.6
2) pip uninstall tflearn
3) pip install git+https://github.com/tflearn/tflearn.git
4) As suggested in another solution tensorflow 2.0.0 does not support tflearn so I installed tensorflow==1.14.0
I found the solution here:-
Issue Link/
If you use an conda environment (and not only, but I advise you to use it), then the solution will be to use a lower version of tensorflow pip uninstall tensorflow pip install tensorflow==1.14.0.
And it is possible to use the script to fix all errors(i used it before downgrade tf):
tf_upgrade_v2 \
--intree my_project/ \
--outtree my_project_v2/ \
--reportfile report.txt
It works for me
You need to have tensorflow installed before you can use tflearn.
From the tflearn github page:
TensorFlow Installation
TFLearn requires Tensorflow (version 1.0+) to be installed.
To install tensorflow:
pip install tensorflow
The tutorial that you are watching uses tensorflow version 0.9 or something, current version is 2.0. The tutorial is 3 years old. You should watch updated video.
However, you can try.
pip install tensorflow==1.0
pip install tflearn
if you're using a virtual environment, make sure you have activated it.
You can use keras instead of tflearn.
tensorflow.contrib is being removed in version 2.0, you therefore need version <= 1.14 to operate tflearn (see here).