So this is my error [ModuleNotFoundError: No module named 'tensorflow.contrib']
I'm using tensorflow 2.0.0 and python 3.6.9 when i downgrade the tensorflow version of the code doesn't work when i upgrade it the same thing happens . (i am using jupyter notebook)
I tried to downgrade tensorflow's version and vice versa .
This is the part of the code where i have the error
Please help i really can't find a solution.
tensorflow.contrib is being removed in version 2.0, you therefore need version <= 1.14 to operate tflearn.
In the command line (not the notebook), conda install tensorflow=1.14 (or tensorflow-gpu=1.14 if you want GPU support ; or pip install rather than conda install depending on what you are used to do).
tensorflow.contrib is being removed in version 2.0, you therefore need version <= 1.14 to operate tflearn (by the way, this is a TFlearn issue, not a tensorflow one).
In your case, I would consider moving to tensorflow (instead of tflearn) and using the tf.keras API, which provides the higher-level API tflearn aimed at offering in times when tf.keras was not out yet.
Related
Issue in importing TENSORFLOW(error code-1073741795 in jupyter notebook, Pycharm, Anaconda command line and in spyder. Howevery I am able to install successfully. But when I'm trying import then I am getting this error
"ImportError: DLL load failed with error code-1073741795".
I have install all the versions of VS redistributable.
I am using win 7 with 64 bit os. I tried to install on tensorflow on all the versions of python 3.6, 3.7
& 3.8. with different versions of tensorflow. Did anyone encountered with error code-1073741795???
ImportError: DLL load failed with error code-1073741795
Failed to load the native tensorflow runtime.
See https://www.tensorflow.org/install/errors
what does error code-1073741795 means?
How do we fix it.
I got an error like this when installing tensorflow. It was because tensorflow was not installed properly.
First, delete your current installed tensorflow completely.
Install Anaconda.
Make a new conda environment (this will help).
After creating a conda environment, activate it.
After activating, write: 'conda install tensorflow==1.15.0'
I am suggesting tensorflow 1.15.0 because I have found it more stable and better than any other version.
To test it is working properly, write:
python
This will activate python, then write:
import tensorflow as tf
print(tf.__version__)
You may get some warnings when importing tensorflow, but ignore the warnings, you will not get any errors. (if you get any error, comment)
I'm using python 3.8.2 , keras 2.3.1 and tensorflow 2.2.0rc4 .
just with the following code :
import keras
from keras.models import sequential
I have this error :
AttributeError: partially initialized module 'keras.backend' has no attribute 'eager' (most likely due to a circular import)
if I use :
import tensorflow
or
from tensorflow.keras import ....
new error :
AttributeError: partially initialized module 'tensorflow.python.framework.ops' has no attribute 'register_tensor_conversion_function' (most likely due to a circular import)
full traceback:
enter image description here
enter image description here
My suggestion is to reinstall the package. Sometimes this happens due to the installation problem.
Use the following code to do so
Uninstall tensorflow
pip uninstall tensorflow
Requires the latest pip
pip install --upgrade pip
To install keras as separate package
pip install Keras
Current stable release for CPU and GPU
pip install tensorflow
Try this and hope this helps you.
It's an install problem, most likely; K.eager was introduced in Keras 2.3.0 (and is included in Keras 2.3.1), so your Python interpreter is somehow reading code of 2.2.5 or earlier.
A possible culprit is an Anaconda mishap. First run conda uninstall keras. Then, in the anaconda3 directory, search "keras" and delete all results. Lastly, run conda install -c conda-forge keras, which should download version 2.3.1. You might need to run similar steps with TensorFlow (in fact, it's better you do, and first reinstall TensorFlow then Keras).
P.S., your code is probably from keras import Sequential, as sequential should error differently.
I am using sublime text editor to run tensorflow commands using pythin 3.7. In particular I am trying to run: tf.enable_eager_execution() but I get the error:
AttributeError: module 'tensorflow' has no attribute 'enable_eager_execution'
I have checked my version of tensorflow using: print(tf.__version__) and the version is: 2.0.0-alpha0.
What's odd is that I have uninstalled tensorflow completely using pip3 uninstall tensorflow and I still have that version running.
From reading around I believe I cant run tf.enable_eager_execution() because of my tensorflow version and thats why I am trying to uninstall it. Ive also tried to explicitly call it using tensorflow.contrib.eager but still no luck.
TensorFlow 2.0 has eager execution by default. To disable eager execution use
tf.compat.v1.disable_eager_execution()
I am trying to use Xgboost in GCP datalab. I have already installed sklearn but I keep getting the error :
" XGBoostError: sklearn needs to be installed in order to use this
module"
Below is the code I used:
import sklearn
!pip3 install xgboost
from xgboost.sklearn import XGBClassifier
model = XGBClassifier()
I have tried using Python v 2.7 instead, but no luck...does anyone know how to solve this issue in GCP Datalab?
I also faced the same issue, on python 3.7 32bit on ipython.
Solution: Uninstall the xgboost package by pip uninstall xgboost on terminal/cmd. Cross-check on the your console if you cannot import it. Now again install xgboost pip install xgboost or pip install xgboost-0.81-cp37-cp37m-win32.whl, given that you have already installed sklearn, it will work on newer console session.
xgboost wheel Link: https://pypi.org/project/xgboost/#files
I got the same error with a more complicated project, after releasing a new version suddenly it failed.
luckily in my case, I had docker images for each version, and was able to use pip freeze to see what changed.
In both version I used xgboost==0.81
In the version that worked I had scikit-learn==0.21.3 and in the new version it was scikit-learn==0.22
surprisingly enough, that's now what caused the issue. I've tried to uninstall xgboost like it was suggested here and reverted scikit-learn to the version is was originally on, and still no luck.
what did cause the issue was an update of numpy from 1.17.4 to 1.18.0.
reverting it solved it for me (not sure why)
this was python 3.6 on ubuntu
For me un- then re-installing first sklearn and then xgboost did the trick
I am working in anaconda environment
I used conda install tensorflow to install tensorflow
In the code I :
import tensorflow as tf
from tensorflow.python.data import Dataset
The first command passes but the second command does not (Import error)
I looked In the github of tensorflow and saw that the tensorflow.python.data module exists but probably changed
Is there a way to get Dataset class from the anaconda installation?
If not is there a workaround ?
Ilan
My mistake was that i used :
conda install tensorflow
rather than follow the instructions in the tensorflow site
Ilan