Installing TensorFlow using Anaconda/Miniconda - python

I am trying to install TensorFlow 2.3 on macOS. I downloaded and installed Miniconda and I realized that the best I can get there is TensorFlow 2.0. As far as I know, it has been quite a while since version 2.0 was released.
Maybe someone of you here knows if there is any plan to update these conda packages, and why is it taking so long to do it?
Thank you very much for the information!
PD: I know I can still get TensorFlow 2.3 by using pip install tensorflow, but I normally prefer to use conda if I have the chance.

This is because the community of anacoda needs just longer to adapt all the packages, which are released. So when a new TF version is released, it will be first released on github, then on platforms like pip. Then the community of Anaconda has to use that release and implement it into conda. Sometimes the community of conda-forge is faster. If you want to stick with anaconda for installing packages, you might want to add conda-forge as source and get tf from there.
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install <package-name>*
*taken from conda-forge.org

Related

Why Anaconda has separate packages for Tensorflow with and without GPU, and should I use conda or pip?

Anaconda has different packages for Tensorflow with and without GPU support.
In particular, to install Tensorflow with GPU, you should run:
conda install tensorflow-gpu
While for the non-GPU version, you should install:
conda install tensorflow
By checking the version of the installed package, conda installs Tensorflow version 2.1.
But as of today the latest version of Tensorflow is 2.3. Furthermore, as can be seen in the Tensorflow officla documentation, the latest version can be installed with
pip install tensorflow
This package is said in the documentation to be good both for CPU and GPU versions of Tensorflow. Moreover, the documentation states that the packages for CPU and GPU were different for "for releases 1.15 and older".
Why Anaconda provides 2.1 in two different packages, given that the package should be the same for any version > 1.15?
Which one should I install, the pip version or the conda version? An article in Anaconda blog specifies that the version provided with conda is faster, but the article is old (2018) and refers to an old version of Tensorflow (1.10)
By checking the version of the installed package, conda installs Tensorflow version 2.1.
But as of today the latest version of Tensorflow is 2.3. Furthermore
That is only because you are (probably?) on windows. As you can see here tensorflow is available as 2.3 from conda default channels, but currently only on linux.
The reason is also stated on the website you have linked (emphasis mine):
Anaconda is proud of our efforts to deliver a simpler, faster experience using the excellent TensorFlow library. It takes significant time and effort to add support for the many platforms used in production, and to ensure that the accelerated code is still stable and mathematically correct. As a result, our TensorFlow packages may not be available concurrently with the official TensorFlow wheels. We are, however, committed to maintaining our TensorFlow packages, and work to have updates available as soon as we can.
In short: The Anaconda team is creating custom builds of tf against the intel mkl library to speed up calculations on the CPU. Earlier on the same website they also mention that they create builds for different cuda versions.
Why Anaconda provides 2.1 in two different packages, given that the package should be the same for any version > 1.15?
The tensorflow-gpu package is only a meta-package, i.e. it is only used to install a different build of tensorflow with different dependencies (also enabling you to install for different cuda versions). The official releases only allow for combinations of tensorflow version and cuda.
Which one should I install, the pip version or the conda version? An article in Anaconda blog specifies that the version provided with conda is faster, but the article is old (2018) and refers to an old version of Tensorflow (1.10)
Reading said article, the speed up is linked to building against the intel mkl library, which speeds up calculations on the CPU. Given that for your setup, you can only get tensorflow 2.1 installed when using conda, you will need to ask yourself if you rely on the newest tensorflow version and if you don't need the accelerated cpu code. There is usually nothing wrong with installing the newest tensorflow using pip. Just make sure that you create a new environment for said tensorflow version and only install/update tensorflow or any of its dependencies using pip in that environment. There is general advice to not mix conda and pip installations too much, since one could break the other (since they are using different ways to resolve dependencies), but you should be fine when using a seperate env
If you are using Anaconda then you can use conda to install tensorflow. For the cpu version enter
conda install tensorflow
for the gpu version enter
conda install tensorflow-gpu.
If you are using Windows it will install version 2.1.0, the cuda toolkit version 10.1.243 and cudnn version 7.6.5. Note conda can only install tensorflow up to version 2.1.0 on Windows operating system. If you want tensorflow 2.2.0 or 2.3.0 install it with pip using pip after you have installed 2.1. The cuda toolkit and cudnn work with version 2.2 and 2.3. One other thing. Use python3.7 not 3.8. Apparently when you install tensorflow with conda it will not work with 3.8.
If you use pip to install tensorflow 2.1 or higher it includes both the cpu and gpu versions however you have to go through a manual processes to install the Cuda Toolkit and cudnn. This includes downloading the files from NVIDIA . You also have to change your PATH environmental variable.

How to install Tensorflow and Keras library on windows 10 home edition?

Please guide me the steps and source to install Tensorflow and keras on Windows 10 home edition using python (pip)?
Try the following at command prompt:
pip install --upgrade tensorflow
pip install --upgrade keras
Also, refer the following link for more detail:
https://www.tensorflow.org/install/pip
I had many issues installing tensorflow and keras by using: pip install...
I would suggest to you Anaconda.navigator. Although It is slower than Anaconda prompt, it helped me to understand the installation process. It worked for me.
First, I uninstalled old versions of Python and Anaconda and Installed Anaconda for Python 3.7 from here (Anaconda3-2019.10-Windows-x86_64.exe) (At this time Tensorflow and keras do not support Python 3.8).
In the Anaconda.Navigator I went to "environments" select "create" (create new environment) and name it. Then, on your new environment select what ever you want to install (tensorflow, tensorflow-gpu, keras, keras-gpu). Make sure that Python lower than 3.8 is on your new environment. This video1 and video2 may help you.
I hope you solve your problem.

Can I conda install an alpha or beta version of Python?

At time of writing, alpha version 3.8.0a4 of python is available. I would like to do some testing in a conda env before it is GA (for both educational purposes and to satisfy some curiosities).
When trying to conda install 3.8 I am getting a PackagesNotFoundError error. Are alpha/beta versions of python simply unavailable through conda channels or is there perhaps an alternate conda channel where this might be found?
I know the latest version can be found on python.org in downloads/release but was really hoping for availability in a conda channel, if possible.
3.8.0a3 can be downloaded using conda-forge, which is a custom channel for conda. You can see the package listed here, with version 3.8.0a3 being labelled as pre-3.8. Unfortunately, it doesn't look like 3.8.0a4 is available yet.
conda install -c conda-forge/label/pre-3.8 python
There is an open issue on conda-forge for adding 3.8.0a4.

Switching from tensorflow on python 3.6 to python 3.5

This is my first question on stackoverflow, please bear with me as I will do my best to provide as much info as possible.
I have a windows 10, 6-bit processor. My end goal is to use keras within spyder. The first thing I did was update python to 3.6 and install tensorflow, which seemed to work. When I attempted to get keras, however, it wasn't working, and I read that keras worked on python 3.5. I successfully installed keras on python 3.5, which automatically installed theano as the backend.
But now I have two spyder environments, one running off of python 3.5, one off of 3.6. The 3.5 reads keras but doesn't go through with any modules because it cannot find tensorflow. The 3.6 can read tensorflow, but cannot find keras.
Please let me know what you would recommend. Thank you!
Create a virtualenv with python 3.5 installed.
I dealt with this same issue, using Jupyter Notebook. Didn't understand why you would even need a virtualenv until I learned from this roadblock.
Full details on installing and setting up a virtualenv can be found here:
http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html
Odd, the installation instructions say that TF only supports Python 3.5 on Windows. I would uninstall TF with pip uninstall tensorflow (if you installed it with pip to begin with) using pip from your Python 3.6 path, then re-install (pip install --upgrade tensorflow) making sure that you are running pip from your Python 3.5 path.
I had some issues with my tensorflow's installation too.
I personnaly used anaconda to solve the problem.
After installing anaconda (Maybe uninstall the old one if you already have one), launch an anaconda prompt and input conda create -n tensorflow python=3.5, afther that, you must activate it with activate tensorflow.
Once it's done, you have to install tensorflow on your python 3.5.
For that, use:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.0rc1-cp35-cp35m-win_amd64.whl
for cpu version
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.0rc1-cp35-cp35m-win_amd64.whl for gpu version
You now have the r1.2 version of tensorflow.
Then, just use pip install keras and keras will be installed.
Now, all you have to do is launch anaconda navigator, select tensorflow on the scrolling menu and launch spyder/jupyter.
You can now use Keras with a tensorflow backend in Python 3.5
Hope it helped someone ! (It take me so much time to find it by myself)

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