I want to install tensorflow to use Keras LSTM I installed Keras, and i import this lines to my code.
from keras.callbacks import LambdaCallback
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers import LSTM
from keras.optimizers import RMSprop
Error is when runnig the code:
No module named 'tensorflow'
Cmd error when i write "pip install tensorflow":
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
Pip version is 19.3, python version 3.7
On Windows , you must use Python 3.7.6 (64 bits) to install tensorflow :
C:\Program Files\Python-3.7.6-x64> python.exe -m pip install --user tensorflow
Unfortunately, the 32-bit version is not supported by tensorflow and will give you that nasty error:
Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow
A few important notes:
C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages
.python -m pip install --user --upgrade pip
. python -m pip install --user tensorflow
Solution
I figured out that the issue is with the Python version.
So I downgraded Python version from 3.8.1 to 3.7.6 Later I worked fine
pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl
My System Specification
For others who faced this problem, TensorFlow might not support the version you are running yet. At the time of writing, you will get the same error when running Python 3.9 and trying to install TensorFlow. You need to ensure your Python version is supported by TensorFlow.
https://www.tensorflow.org/install/
TensorFlow is tested and supported on the following 64-bit systems:
- Python 3.5–3.8
I then used a different python. ie python3.8 -m pip install tensorflow==2.3.0
Hi writing my suggestions here because i can't commment yet.
Could you try to look if you have the right python version installed? Sometimes something went wrong and a 32-bit version of python is installed. But tensorflow only works with the 64 bit verison of python. You can check your python version with the following comand into the python interpreter
import struct
print struct.calcsize("P") * 8
It should print "64".
It generally seems that there is a problem with python 3.7 and tensorflow ( here )
For some people there it helped to install a specific tensorflow version
pip install tensorflow==1.14.0
as also seen here.
Also a solution might be to downgrade to phyton 3.6.
For 3.6: Another possible solution can be found in this thread (For Windows only for Python 3.6 as of the date of this answer)
TLDR: The most upvoted answer suggestes to try following input (for python 3.6 CPU-only)
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-2.0.0-cp36-cp36m-win_amd64.whl
I hope this helps to solve your problem.
This solution always worked for me.
1) Figure out what Python interpreter you are actually using
import sys
print(sys.executable) #prints "path_to_python"
2) On the terminal run: "path_to_python" -m pip install tensorflow
where "path_to_python"
is the output you got before, obviously.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.