I installed Tensorflow on Windows, using pip (Python 3.5)
C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.1-cp35-cp35m-win_amd64.whl
Afterwards, I went to my command line and succesfully ran:
>> python
>> import tensorflow as tf
However, then I opened up Python IDLE (3.5) and tried to import tensorflow, with no luck:
ImportError: No module named 'tensorflow'
Same story with numpy. My Numpy and tensorflow packages are installed here:
AppData\Local\Programs\Python\Python35\lib\site-packages
What am I doing wrong?
I also faced the same problem in Python version 3.6. Finally, I managed to solve it by accessing Windows Command Prompt in Admin mode and type
to enter to python IDLE
python
and successfully import tensorflow
import tensorflow as tf
and checked the version with
print(tf.version)
I think you got your answer. As asked here is how you can check your python version.
import sys
print (sys.version)
Related
I have python 3.7 installed on a Windows 10 machine, no custom stuff at all, to install tensorflow I used:
pip3 install --user --upgrade tensorflow
but when I try importing it using:
import tensorflow
in a python script or shell it gives me the following error:
ImportError: DLL load failed: The specified module could not be found.
Am I doing something wrong?
edit: By the way pip version is 20.0.2, I precedently tried with pip 10.x and got the same result.
Regarding https://github.com/tensorflow/tensorflow/issues/35749 or https://github.com/tensorflow/tensorflow/issues/36859 (and the amount of same duplicate issues) there are some recents problems with tensorflow 2.1 for some windows computers.
A fix so far, is to use tensorflow 2.0 on windows :
pip install tensorflow==2.0
For more details, this is quite detailed : https://github.com/tensorflow/tensorflow/issues/36167#issuecomment-577886156
I'm trying to use pyscenedetect library on python for videos but I get this error when using the python interface and when I use the command line interface I get the error "ModuleNotFoundError: No module named 'cv2'"
even though I believe I installed both correctly according to the documentations.
I have trying to look for different ways to import opencv for the second error but to no avail. As for the first error i can't find any answers to my problem.
import cv2
import numpy as numpy
import os
import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetect.stats_manager import StatsManager
from scenedetect.detectors import ContentDetector
If you have pip you can try
pip install opencv-python
If you have anaconoda, you can try
conda install -c conda-forge opencv
it's probable that you installed it on a different python installation in your PC.
To know where your python installation is you can launch python and:
import sys
sys.path
To get the list of everything you have installed you can:
pip freeze > installed_modules.txt
Try only running
import cv2
So that you can test it
I found the problem. As Ivan was pointing out, the problem was with openCV.
I used the following command:
sudo apt install python3-opencv
When I try to import tensorflow my python crashes. I tried uninstalling it and installing it again, but It isn't still working. Here is a picture of the command prompt when I try to import it.
I'm not too sure what the error is here.
try to pip list to see all packages
if no tensorflow seen then just pip install tensorflow
or print dir(tensorflow) to see functions
It seems you aren't executing anything but just importing the module.
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.