Installing tensorflow on windows - python

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

Related

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:)

Can't install pytorch with pip on Windows

I'm trying to install Pytorch with Windows and I'm using the commands of the official site
https://pytorch.org/get-started/locally/
pip3 install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
This is the command if I choose Windows, Cuda 10.0, and Python 3.7
But if I run this I get the error message:
ERROR: Could not find a version that satisfies the requirement torch==1.2.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.2.0
So why does this happen?
My pip is version 19.2 and I am in a newly installed python 3.7 environment
I tried multiple solutions and it wasn't working on Windows 10 until I tried this:
pip install torch==1.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
If you want your GPU enabled then remove the "+CPU":
pip install torch==1.5.0 -f https://download.pytorch.org/whl/torch_stable.html
The most likely reason for Your issue is a 32-bit installation of python, while the torch libraries rely on having a 64-bit version. I had exactly the same issue.
Just start python from command line and observe
C:\Users\marci>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
My installation now shows 64 bits. If Yours shows 32, then install 64-bit python. I used this link: Official python 64-bit Windows installer
So you have Cuda 10 installed? If you do, try this:
pip3 install https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-win_amd64.whl
followed by:
pip3 install torchvision
To check if it was installed properly, type this into your command line:
python
followed by:
from __future__ import print_function
import torch
x = torch.rand(5, 3)
print(x)
If you get this output:
tensor([[0.3380, 0.3845, 0.3217],
[0.8337, 0.9050, 0.2650],
[0.2979, 0.7141, 0.9069],
[0.1449, 0.1132, 0.1375],
[0.4675, 0.3947, 0.1426]])
PyTorch was installed correctly!
I had the same issue, and what I noticed is that I was using Python 3.8.1 and the latest PyTorch was for Python 3.7.
I uninstalled Python 3.8.1 and installed 3.7.6 and voila, it worked!
Not sure if this is your case, but it helped me.
pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
Please use this, worked out for me.
Try installing via .whl file from Christoph Gohlke's repo at this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/
Make sure you get the right one for your python version (cp37 at the bottom).
Navigate to the file or save it to your working directory, then use
pip3 install path-to-file.whl
Link to .whl file on page
The most likely reason for Your issue is a 32-bit installation of python, while the torch libraries rely on having a 64-bit version. I had exactly the same issue.
Just start python from command line and observe
C:\Users\marci>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
My installation now shows 64 bits. If Yours shows 32, then install 64-bit python. I used this link: Official python 64-bit Windows installer
it is the best answer
Go here https://pytorch.org/get-started/previous-versions/ and find the appropriate command for the version you want.
But first it is best to create an virtual environment with the right version of python
conda create -n you_env_name python=?.?.?
Then activate the environment
conda activate your_env_name
try the following in your IDE command prompt then restart the IDE:
conda install pytorch -c pytorch
it's because your python version is 32bit while you're trying to download a 64bit version of Pytorch, navigate to pytorch_whl_page and choose an appreciate version of Pytorch
or reinstall python from the official Python page to a 64bit version
You will find the correct code to run on the PyTorch website.
There, you can choose your OS, platform, pip, conda and other customisation.
For example, the code to install the PyTorch package on Windows using pip and the CUDA 10.2 platform is (without the quotes:
"pip3 install torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html"
Just downgrade your python version. I was using Python 3.10 then I uninstalled that and reinstalled python 3.7. It started working for me
PyTorch is now torch.
import torch
print(help("torch"))

How to install Tensorflow on Python 2.7 on Windows?

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

Problems installing TensorFlow on Mac

I am trying to follow to the installation guide on tensorflow.org and have installed Python version 2 again for that reason using Homebrew.
When I run the installation as described
$ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
I get this error message:
tensorflow-0.5.0-py2-none-any.whl is not a supported wheel on this platform.
I am obviously doing something wrong, but have no idea. Any clues?
I do not want to use virtualenv, since anaconda already comes with its own environment management conda. When installing the newest version 0.6.0 directly with pip install, I had a similar error. It seemed to not resolve the dependencies correctly.
Here is what you can try:
Install anaconda
Create a new conda workspace
Download the specific protobuf version that tensorflow needs: https://pypi.python.org/pypi/protobuf/3.0.0a3
Install it via sudo easy_install ~/Downloads/protobuf-3.0.0a3-py2.7.egg
Install a numpy version greater than 1.08.x via conda install numpy
Download the 0.6.0 version of tensorflow: https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
Install via pip install ~/Downloads/tensorflow-0.6.0-py2-none-any.whl
When you install tensorflow from the whl file directly, it should tell you when dependencies are not there. It seems not to be able to resolve these conflicts independently. My setup had issues with protobuf and numpy. After installing them manually everything worked fine.
I hope this helps!
It seems to be a common issue. Try to install it in the virtualenv. Its a much better solution, as you can always easily set up a new version of tensorflow without conflicts.
VirutalEnv Tutorial:
http://tensorflow.org/get_started/os_setup.md#virtualenv-based_installation
On the Mac, I didn't have any problem installing tensorflow with the anaconda version of python: https://www.continuum.io/downloads
The anaconda version also provides science, math, engineering, and data analysis packages. A lot of people on https://www.kaggle.com/ seem to use this...just a thought.

Categories

Resources