How to install Tensorflow on Python 2.7 on Windows? - python

I try to install TensorFlow via pip (pip install tensorflow) but get this error
could not find a version that satisfies the requirement tensorflow (from versions: )
Is there a solution to this problem? I still wish to install it via pip

If you only need TensorFlow because of Keras and your are on Python 2.7.x, you can avoid installing Tensorflow(Google) and replace it by CNTK(Microsoft). According to Jeong-Yoon Lee CNTK is a lot (about 2 to 4 times) faster than TensorFlow for LSTM (Bidirectional LSTM on IMDb Data and Text Generation via LSTM), while speeds for other type of neural networks are close to each other.
Your Keras code does not need to be modified (I checked it with 2 examples of Keras using TensorFlow and succesfully replaced TensorFlow with CNTK, without changing anything the Keras code.
So how do you install it?
-CPU-only version of CNTK:
pip install
https://cntk.ai/PythonWheel/CPU-Only/cntk-2.4-cp27-cp27m-win_amd64.whl
-GPU version of CNTK:
pip install
https://cntk.ai/PythonWheel/GPU/cntk-2.4-cp27-cp27m-win_amd64.whl
-Test CNTK install:
python -c "import cntk; print(cntk.version)"
-Install Keras: The Python Deep Learning library
pip install keras
-Enable CNTK as Keras back end iso TensorFlow
modify the "keras.json" file under %USERPROFILE%/.keras
{
"epsilon": 1e-07,
"image_data_format": "channels_last",
"backend": "cntk",
"floatx": "float32"
}

Elaborating a bit on dirty_feri's answer as it's not quite up to date.
Tensorflow for Windows is only supported with Python 3.5 and Python 3.6 (since 1.2). As you are downloading via pip you will be receiving the latest 1.2 version so you should be able to run on 3.6.
There should be no need to use the Anaconda version of Tensorflow, the distribution is not supported and, if you are running anaconda, the pip version does just fine.
If you still require python 2.7 support for other projects then may I suggest the use of an environment manager like anaconda or virtualenv to allow you to have multiple versions of python running nicely at once.
Once you have a supported version of python installed you should be able to run pip install tensorflow and it should install in a few minutes.
Full installation instructions are available here: https://www.tensorflow.org/install/install_windows

There is a great Github repo which has *.whl file to install. support py27 and py36
go to fo40225's Github Repo tensorflow-windows-wheel
find a tensorflow whl version and download
pip install xxx.whl (xxx is your download whl file name)

If you are using windows:
If you take a gander at TensorFlow website under windows PIP installation first line says.
"Pip installation on Windows
TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages with the following distributions of Python:"
Now either install python 3.5, or use the unofficial version of Tensorflow from ANACONDA.
other way is to Download and install docker toolbox for windows https://www.docker.com/docker-toolbox Open a cmd window, and type: docker run -it b.gcr.io/tensorflow/tensorflow This should bring up a linux shell. Type python and I think all would be well!

I found that Tensorflow can work on CPU under intergrated Ubuntu to Windows with any version of python.
You may install Ubuntu directly from Windows Store (https://www.microsoft.com/ru-ru/p/ubuntu/9nblggh4msv6)
pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
sudo pip install tensorflow

Related

Cannot install Tensorflow in Debian

I am trying to install Tensorflow using pyenv since the python 3.9.2 installed does not work with Tensorflow. I am running Debian OS 11.Everytime I run " pip install Tensorflow " it shows
Could not find a version that satisfies the requirement Tensorflow (from versions: none)
ERROR: No matching distribution found for Tensorflow.
I am using a 64bit OS with python 3.5.3 installed using Pyenv.
https://imgur.com/dRDWWAP
The process of installing tensor flow has changed over the years a little bit. A few years ago, they didn’t support versions of python greater than 3.6.4, causing users to downgrade their version of python. Now, there is something called tensorflow 2 which supports the higher versions of python. When you try to run the command pip install tensorflow, pip is trying to look for a version of tensorflow which is for the higher versions of python. Here are your two solutions:
You can install a version of tensorflow that corresponds to the version of python you have, so both are compatible. Here is the command: pip install tensorflow==1.5 for CPU edition, and pip install tensorflow-gpu==1.5 for GPU edition. With the older versions, the libraries were different for your CPU and GPU.
Your alternative solution is to install a higher version of python. With py versions 3.7-3.10, they use tensorflow 2 which can be installed with pip install tensorflow. This library for newer versions comes with support for both CPU and GPU in one package.

tensorflow installation in python 3.9.0(64 bit) and pip version 20.2.3 .?

I want to install TensorFlow, I have tried everything from reinstalling everything to trying different versions it doesn't help.
I have tried it with python 3.9.0 and pip version 20.0.3
Currently (1st of March, 2021), there is no official stable tensorflow version for the latest stable python 3.9.
However, nightly version of tensorflow supports python 3.9.
Simply pip install tf-nightly-gpu or pip install tf-nightly
Note, the library name is the same, e.g. importing works as import tensorflow as tf without any problems. This means you will not have to update your code once official support is added and you've migrated to the stable version.
The Official TensorFlow website specifies python 3.5-3.8.
You need to create a new environment as suggested in the previous answer with a new version of python, or uninstall python 3.9 and install other version. I use python 3.6.8 for Tensorflow and it works great.
I had the similar problem but I am able to resolve it by downloading the python version 3.8.6 and installing it. Please pay attention to add the python and the respective pip path in the environment.
Then give the command, which will install tensorflow version 2.3.1
pip install tensorflow
You may upgrade the pip by following command,
py -m pip install --upgrade pip
I hope that it works for you.

Unavailable to install Tensorflow 1.x on Ubuntu 20.04 LTS using pip

I have a reason that I should use Tensorflow 1.x release, but it returns an error with message:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.2 (from versions: 2.2.0.rc1 ~~~~~
ERROR: No matching disribution found for tensorflow==1.15.2
I also tried .whl installation but the latest Tensorflow 1.15.2 support cp37 which I can't use it anymore.
Is tensorflow 1.x is no longer supported on pip or pypi? Or should I downgrade python(3.8 > 3.7) and install Tensorflow using .whl file?
[System Environment]
Ubuntu 20.04 LTS
Python version : 3.8.2
pip version : 20.0.2
Thanks.
According to tensorflow installation guide tensorflow is available on Python 3.5–3.7 you are using a newer version of Python.
The answer above is outdated
Tensorflow supports Python 3.8 now, but Python 3.8 support requires
TensorFlow 2.2 or later
pip 19.0 or later
Ubuntu 16.04 or later
macOS 10.12.6 (Sierra) or later
Windows 7 or later
Raspbian 9.0 or later
Also GPU support requires a CUDA-enabled card (Ubuntu and Windows)
You can check your Python and pip version with these commands:
python --version | python3 --version
Out: Python 3.8.2
pip --version | pip3 --version
Out: pip 20.1.1
You can upgrade your pip with:
pip install --upgrade pip
More info can be found on this link: Install TensorFlow with pip
I would recommend that you avoid installing third-party Python libraries system-wide using pip that will then rely on your system Python. You also really don't want to avoid manually upgrading/downgrading your system Python.
I prefer to use Conda to install TensorFlow. Instructions for installing Conda on Linux are pretty straightforward.
Once you have installed Conda you can install TensorFlow 1.15 with a single command.
conda create --name tensorflow-15 \
tensorflow-gpu=1.15 \
cudatoolkit=10.1 \
cudnn=7.6 \
nccl=2.4 \ # only relevant if you have more than one GPU
python=3.6 \
pip=20.0
One of the many things I like about Conda is that it provides a single tool to manage environments and packages within a particular environment. It also has a much gentler learning curve compared with other tools for isolating software environments like Docker.
If you are interested in learning more about Conda, then you can check out these teaching materials that I am developing.
https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/
Seems more and more we have to switch to using containers (Docker, and probably cloud VMs), because everything is incompatible with everything. Yes, you can start a Docker container running Python 3.7 and Tensorflow 1.x, on any version of Linux, but then you want to load files from that container, you have to pass black-magic command line options to mount volumes. Tried using Tensorflow 2 and everything fails. No more tf.Session(), no more tf.global_variables_initializer(), etc. So no working Tensorflow in Ubuntu, you have to use Docker.
Try to isolate your dependencies by using Docker or conda environments, I used:
conda create -n new_env python=3.6 tensorflow-gpu=1.2.1 anaconda
and works fine:)

Installing tensorflow on windows

I'm trying to install tensorflow on windows. I have python3 (3.5.2) and pip3 (9.0.1):
pip3 install --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
Found this issue here as well: tensorflow not found in pip
but none of the solutions worked for me. Any ideas?
Try the following at a Python command prompt:
import platform
platform.architecture()[0]
It should display '64bit'
Just having an x86 version of Python isn't enough.
I had the same problem. Thought I had a 64 bit installation but it turned out to be 32 bit.
BTW. it will also work fine with the Conda Python 3.6 distribution. And indeed use the distro from the Gohlke page as indicated by Guillaume Jacquenot.
You can download binary wheel from Christoph Gohlke's webpage
Once downloaded, you can run pip install tensorflow‑1.0.1‑cp35‑cp35m‑win_amd64.whl for Python 3.5 64 bit
This is what worked for me.
Currently, Tensorflow only works with 64-bit windows, not 32-bit.
So, you could create a new 64-bit environment and install tensorflow in it:
set CONDA_FORCE_32BIT=
conda create --name name_of_your_created_environment python=3.5
activate name_of_your_created_environment
conda install -c conda-forge tensorflow
CONDA_FORCE_32BIT=1 sets to a 32-bit environment whilst CONDA_FORCE_32BIT= sets to a 64-bit environment.
I have written a blog over this topic, you might find it interesting and helpful:
Mainly issue that people face is they install 32 bit python:
Solution as follows
Install Python 3.6 (Note down installation path, or simply custom install to C:\Python36) in your system - Make sure that Python is of "x64" architecture.
To check your python architecture
Import platform
platform.architecture()[0]
Link to download Python36 with 64 bit architecture : https://www.python.org/ftp/python/3.6.2/python-3.6.2-amd64.exe
For more info you can follow the this link
https://tensorflowwindows.quora.com/
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
try this one under your python environment
Just follow 3 steps:
Install python 3.5.x version (64bit MUST)
Install pip
pip install tensorflow==2.0.0-alpha0
And you are good to go.
Found this after struggling for days
You need to install Python 3.7 to download end version of Tensorflow ->2.3 and some packages:
visual studio tools C++
cuda_10.1.105_418.96_win10
After spending hours I am able to fix TensorFlow installation issue on Windows. here is the summary https://stackoverflow.com/a/50475864/1996802

Anaconda installation of Tensorflow fails with Debian 8 VirtualBox

I'm trying to install Tensorflow.
I created a fresh Debian 8 VirtualBox for this purpose. Following the instructions here I downloaded and installed Anaconda with Python 3.
I created a conda environment for Tensorflow and activated it.
When trying to pip install Tensorflow it fails:
(tensorflow)$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
The error is
not a supported wheel on this platform
I found a similar thread where a person had this problem with Python 2.7 and VMware, but their solution didn't work for me (and also not for another person who commented that they were using VirtualBox).
I also tried specifying pip3 and pip3.5 rather than just pip.
This appears to be a "known" issue from the following issue. Which paraphrased you should be able to download https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl and change the name of the .whl to tensorflow-0.8.0-py3-none-linux_x86_64.whl and install it correctly. There has been a change to the github documentation for Tensorflow to set the python version to 3.4 instead of 3.5. However, it appears this change hasn't made it to Tensorflow.org's documentation
# Python 3.4
$ conda create -n tensorflow python=3.4

Categories

Resources