import tensorflow as tf Traceback (most recent call last):
File "<ipython-input-5-41389fad42b5>", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
I am getting the following error after installation of tensorflow in anaconda using windows. I have followed the tensorflow installation steps
At first it was running properly but when i tried to uninstall and reinstall tensorflow, this error pops up. I tried uninstalling Anaconda itself and reinstalling but was of no help. Tensorflow is getting installed but when i try the import step it shows the above error.
Solved: Python 3.6 is incompatible with tensorflow and had to create tensorflow environment for python 3.5.
conda create -n tensorflow python=3.5 anaconda
Activated it in command prompt and launched spyder from it which changed my python version to 3.5. Now was able to import tensorflow properly.
If you installed tensorflow using Anaconda inside an Anaconda environment, you will need to activate this environment. Only then can you import tensorflow.
Related
I am new to TensorFlow and I received error with the third line below saying "ModuleNotFoundError: No module named 'keras'". The code is written in jupyternotebook launched from an anaconda virtual environment.
import tensorflow as tf
from tensorflow import keras
(x_train,y_train)=tf.keras.datasets.mnist.load_data()
I have no problem with importing tensorflow and the second line. I used anaconda navigator to install both tensorflow and keras. (I didn't set anaconda my default python version when installing anaconda, could that be a reason? )Thanks in advance.
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 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'm trying to use tensorflow-gpu. Using Anaconda, I installed the libraries and active both (tensorflow and tensorflow-gpu) I have also installed Keras in this anaconda environment as well
Next I launch Spider IDE within my Anaconda environment and run my py script, that is when I get the following error:
cannot import tensorflow - Import Error: cannot import name 'self_check'
I'm totally lost. Any recommendations?
Using Python 3.5
Thanks
pip install --upgrade tensorflow
or
you can uninstall the tensorflow and re-install it.
I got this error in Jupyter Notebook.
this may duplicate post but no any proper answer found
Neither below links helped me to solve this.
No module named tensorflow in jupyter
No module named tensor flow -- iPython notebook
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-b88de1945047> in <module>()
1 get_ipython().magic('matplotlib inline')
2 import numpy as np
----> 3 import tensorflow as tf
4 from tensorflow.contrib import rnn
5 import data_loader
ModuleNotFoundError: No module named 'tensorflow'
B:S -
enter image description here
I faced the same problem at first. I realized that in the conda-->envs -->
tensorflow-->Scripts-->idle.exe, is the python 3.5.5 shell. Where you can import tensorflow without any problems. So, I chaged the directory as C:\Users\Temp\Anconda3..... and then activated and deactived the tensorflow once. In the next step I entered the python mode and import tensorflow as tf worked right.
I had the same problem and I think I've found the solution!
See, I had installed both CPU and GPU versions of Tensorflow at the same time which apparently is wrong. Then, I uninstalled the GPU version, it didn't work this time either. So I uninstalled both of them and reinstalled the CPU version. It's working now.
BTW I'm on Win10(1803) and python 3.6.5 (not using anaconda.)
You can execute the following instructions and command to solve the issue: (do not include inverted commas)
Open Anaconda Prompt
type: "create --name py3-TF2.0 python = 3"
press "y" to continue
After successful completion:
type "conda activate py3-TF2.0"
type "pip install matplotlib"
type "pip install tensorflow==2.1.0"
type "conda deactivate"
type "pip install ipykernel"
type "conda install nb_conda_kernels"
Now exit the Anaconda prompt and open the Anaconda Navigator application. Switch to "py3-TF2.0" from the base environment using the Environment tab. Install Jupyter in the specified environment.
After successful installation, open Jupyter notebook and switch to "py3-TF2.0" kernel using Kernel Tab.
You're good to go for using TensorFlow 2.
Make Sure you use Anaconda 2020.02 or lower version.
As new version does not support TensorFlow 2.