How do you install Tensorflow on Windows? - python

I am trying to install Tensorflow on Windows.
I have Anaconda 4.2.0. I tried running
conda create -n tensorflow python=3.5
in my command prompt. This seemed to do something, but I'm not sure what this accomplished. It created a folder within the Anaconda3 program in my username folder.
This folder is filled with the following content:
Over the summer, I used mainly Jupyter Notebooks to do my python coding. Within this environment, there is a tab marked Condas
So it looks like I should be able to switch to the Tensorflow environment. But this doesn't work when I try to switch, there is no option to change my kernel to a Tensorflow one.
I tried running
conda search tensorflow
But nothing appears.
I'm not sure what to do. I asked a few grad students in my economics research group, but they weren't sure what to do either.
My Question
How do I properly install Tensorflow on Windows?

The syntax of the command is conda create -n <name_of_new_env> <packages>. As a result, you created a clean environment named tensorflow with only Python 3.5 installed. Since conda search tensorflow returned nothing, you will have to use pip or some other method of installing the package. Since there is spotty official support for Windows, the conda-forge package (CPU only) at https://github.com/conda-forge/tensorflow-feedstock is probably the best way.
People have also reported success installing Tensorflow with docker, if you have docker set up already.

I was able to run it under the Windows 10 linux subsystem (https://msdn.microsoft.com/en-us/commandline/wsl/install_guide)
Which is basically a linux environment within windows.
The latest tensorflow version (0.12) added windows support
https://www.tensorflow.org/get_started/os_setup#pip_installation_on_windows
just run:
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.1-cp35-cp35m-win_amd64.whl
(the url is for the specific version - you will need to change it for future versions or other setups)

An Anaconda environment isolates itself completely with the outer world, so all the packages you installed outside the virtualenv is nothing in the virtualenv, if you want to use Tensorflow in the environment(seems like the only way with Anaconda), use activate tensorflow command and install the packages you want seperately.

pip provides an easy method to install tensorflow on windows machine.
use the following pip command
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
Tensorflow only support python3.5 x64 bit on windows machines and it requires that you install Visual C++ 2015 redistributable (x64 version) to be able to import tensorflow

Related

How to use lower version of keras and tensorflow

I'm running a code which requires keras version 1.2.0 and tensorflow version 1.1.0.
I'm using Jupyter notebook and I created an environment for all the dependencies.
However, I mistakenly installed both libraries again through pip command which installed the latest versions.
I closed the notebook, opened it again and created the environment once again so the older version of both libraries were installed again.
But when I run keras.__version___ command, it shows 2.4.3, which i do not want.
I also ran conda remove keras --force and pip uninstall keras, but it's still showing the latest version.
The code is only compatible with the older version. Please help.
It's probably because it is getting uninstalled on a different environment. Identify which python and pip executable you are using by running the following commands:
$ which pip
$ which python
These two commands will give out the path of the executable from which we can determine the environment. If it is different from what you were using you can try installing to the desired environment by running:
/path/to/desired/pip uninstall keras
/path/to/desired/pip install keras==1.2.0

anaconda will not let me import files and therefore I cannot delete it or redownload it [duplicate]

I had a working deep learning library on CPU Linux Mint ubuntu verion 18.3 with Anaconda 3.6 but something got hosed when I was tinkering around in Theano.
https://machinelearningmastery.com/setup-python-environment-machine-learning-deep-learning-anaconda/
Everything was working just fine until I wanted to tinker around with a few .py files with KERAS_BACKEND=theano python program.py and in an attempt to fix something not working in Theano, I did this command from the theano website
http://deeplearning.net/software/theano_versions/dev/requirements.html
conda install numpy scipy mkl <nose> <sphinx> <pydot-ng>
Not knowing what I am doing it almost seemed to pooch everything... And install Python 2.7 dependencies. Would anyone be able to give me a tip on how reset my deep learning library in anaconda 3.6 build???
If I do a conda list anaconda$ its a custom build 2.7 which was not intentional! Time to start learning how to do virtual sessions :)
Read the docs for uninstalling Anaconda
https://docs.anaconda.com/anaconda/install/uninstall
Do a conda install anaconda-clean
Then a anaconda-clean --yes
Then re-download the Anaconda 5.2 For Linux Installer and run thru
the steps. https://www.anaconda.com/download/#linux
I had a similar problem and just did:
conda install --revision 0
this gives me a fresh Anaconda installation, with the drawback of needing to install every package again. Hovewer, all environments created remain intact.
More on Anaconda revisions here: https://medium.com/#wilpat456/fix-broken-anaconda-environment-due-to-recent-package-download-9094fb0f3a04

Error when installing Tensorflow - Python 3.8

I'm new to programming and following a course where I must install Tensorflow. The issue is that I'm using Python 3.8 which I understand isn't supported by Tensorflow.
I've downloaded Python 3.6 but I don't know how to switch this as my default version of python.
Would it be best to set up a venv using python 3.6 for my program and install Tensorflow in this venv?
Also, I using Windows and Powershell.
Tensorflow is only supported until python 3.7 as of now.
You can check it here: https://www.tensorflow.org/install/pip
But there is a way to install it on Python3.8, just run the below command that will do your job:
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
This command work on mac and windows both, I haven't tested on Linux.
You should always use venv because by default every project on your system will use these same directories to store and retrieve site packages (third party libraries). At first glance, this may not seem like a big deal, and it isn’t really, for system packages (packages that are part of the standard Python library), but it does matter for site packages.
Consider the following scenario where you have two projects: ProjectA and ProjectB, both of which have a dependency on the same library, ProjectC. The problem becomes apparent when we start requiring different versions of ProjectC. Maybe ProjectA needs v1.0.0, while ProjectB requires the newer v2.0.0.
You can also take a look at anaconda, it’s the most populasr data sciencie platform and will be easy for you install tensorflow and jupiter notebook in just 2 clicks. Anaconda
Uninstall all your python versions and use the latest anaconda.
$ conda create --name tensorflow python=3.5
This way you create a virtual environment with python 3.5 which is supported by tensorflow.
So now you can install it.
$ activate tensorflow
(tensorflow) $ pip install tensorflow
it would have been nice if you would have the share the error screenshot
though as per i got the case
tensorflow work in both 3.8 and 3.6 just you have to check that you have 64bit version not 32 bit
you can acess both version from thier respective folder no need to install a venv
If you don't want to use Anaconda or virtualenv, then actually multiple Python versions can live side by side. I use Python38 as my default and Python35 for TensorFlow until they release it for Python38. If you wish to use the "non-default" Python, just invoke with the full path of the python.exe (or create a shortcut/batch file for it). Python then will take care of using the correct Python libs for that version.
Worked on Python 3.8.2 (default, Mar 05 2020, 18:58:42) [GCC] on linux
pip3 install --upgrade tf-nightly
Python Versions 3.5 - 3.8 are supported now.
You can verify on this page:
https://www.tensorflow.org/install/pip

Installing tensorflow gpu in anaconda 5.3

I have recently installed anaconda 5.3 and it came with python 3.7 preinstalled. Now when I checked tensorflow website it's says tensorflow does not support 3.7 only 3.6.
Tensorflow Requires Python 3.4, 3.5, or 3.6
What can I do now to have tensorflow gpu for my pc. Any help is appreciated. Is there any workaround?
Thanks.
You should create a new conda virtual environment with python 3.6, then install tensorflow into that.
At the creation of the new env you can freely choose the python version you want to use.
This is one of the essence of conda and virtual envs in general.
A bit more details:
Inside of the anaconda-navigator you can choose Environments, then choose create. Here you can give the new environment name and the packages basis i.e. Python or R and the versions you want to use it for the environment. Then you have to install your custom packages beside of the default ones. Here you can install tensorflow-gpu too.
For installing packages you can choose Anaconda navigator GUI or inside of the Anaconda command shell with conda conda install <package> or in the Anaconda command shell pip install <package>.
In general you should prefer Anaconda package management i.e. GUI or conda to the package versions be consistent, what conda manages well. In some cases -choose always the package developer's suggestion- however, you may choose pip install.

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