I recently found an article that indicates that the conventional methods for downloading python machine learning modules such as tensorflow and keras are not optimized for computers with a cpu. How can I configure tensorflow and keras to make it most compatible with my processor on MacOSX in python 2.7?
If it helps, I use pycharm to download most of my libraries and for my coding interface.
For any environment if you want to install tensorflow, you can simply run this command :
pip install tensorflow (for CPU, python2.7)
pip3 install tensorflow (for CPU, python3)
You need to mention externally if you want to install tensorflow with GPU like this:-
pip install --upgrade tensorflow-gpu
but for GPU you will need CUDA (NVDIA graphics) to run.
and very same way, you can install keras Where you dont have to pass keras-gpu externally while using command:-
pip install keras
I think what you read meant that tensorflow programs work much faster if your computer has a GPU. You need a Nvidia GPU in your computer to install tensorflow with GPU support on your Mac and as far as I know, after version 1.2 tensorflow no longer provides GPU support for MacOS
Related
I want to use Tensorflow on GPU. So I install all the needed tool and installed as below-
CUDA-11.2
CUDNN-11.1
Anaconda-2020.11
Tensorflow-GPU-2.3.0
I tested that my cuda,cudnn is working using deviseQuery example.
But Tensorflow not used GPU. Then i find that version compatibility issue is possible so i innstalled CudaToolkit,cudnn using conda environment checking with version compatibility on Tensorflow website which is given below.
CUDA-10.2.89
CUDNN-7.6.5
Tensorflow-GPU-2.3.0
But after this try Tensorflow-GPU not used GPU,yet. so what i am doing now? Any steps or suggestion require.
The installation engine has a problem for tensorflow-gpu 2.3 in Anaconda on Windows 10.
Workaround is to explicitly specify the correct tensorflow build:
conda install tensorflow-gpu=2.3 tensorflow=2.3=mkl_py38h1fcfbd6_0
I want to run the project using Anaconda, TensorFlow 2.3, Keras 2.4.3 (CNN example). OS Windows 10.
I installed Visual Studio 2019 Community Edition, CUDA 10.1 and cudnn 8.0.5 for CUDA 10.1.
Using Anaconda I created an environment with TensorFlow (tensorflow-gpu didn't help), Keras, matplotlib, scikit-learn. I tried to run it on CPU but it takes a lot of time (20 minutes for just 1 epoch when there are 35).
I need to run it using GPU, but TensorFlow doesn't see my GPU device (GeForce GTX 1060). Can someone help me find the problem? I tried to solve the problem using this guide tensorflow but it didn't help me.
This works 100%, no need to install anything manually (cuda for example)
conda create --name tf_gpu tensorflow-gpu
Ok so I tried to install all the components into new anaconda environment. But instead of "conda install tensorflow-gpu" I decided to write "pip install tensorflow-gpu" and now it works via GPU...
Just a heads up, the Cudnn version you were trying to use was incompatible.
Listing Versions and compatible CUDA+Cudnn
You can go here and then scroll down to the bottom to see what versions of CUDA and Cudnn were used to build TensorFlow.
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.
I want to do some ML on my computer with Python, I'm facing problem with the installation of tensorflow and I found that tensorflow could work with GPU, which is CUDA enabled. I've got a GPU Geforce gtx 1650, will tensorflow work on that.
If yes, then, how could I do so?
After opening the command prompt in administrator mode,the installation command for Tensorflow with GPU support is as follows:
pip3 install --upgrade tensorflow-gpu
To check if tensorflow has been successfully installed use command:
import tensorflow as tf
To test CUDA support for your Tensorflow installation, you can run the following command in the shell:
tf.test.is_built_with_cuda()
[Warning: if a non-GPU version of the package is installed, the function would also return False. Use this command to validate if TensorFlow was build with CUDA support.]
Finally, to confirm that the GPU is available to Tensorflow, you can test using a built-in utility function in TensorFlow as shown below:
tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)
Install tensorflow-gpu to do computations on GPU. You can use the code below to check whether your GPU is being used by tensorflow.
tf.test.is_gpu_available(
cuda_only=False,
min_cuda_compute_capability=None
)
Here are the steps for installation of tensorflow:
Download and install the Visual Studio.
Install CUDA 10.1
Add lib, include and extras/lib64 directory to the PATH variable.
Install cuDNN
Install tensorflow by pip install tensorflow
I don't think if you can.
https://www.tensorflow.org/install/gpu
Tensorflow clearly mentions the list of supported architectures and the 1650 sadly doesn't belong to the list. Check the "cuda enabled gpu cards" link on the website above.
I was trying to this project for my school https://www.youtube.com/watch?v=COlbP62-B-U
Everything worked smooth till i encountered that pip install tensorflow doesn't work.
then I tried this for install tensorflow TensorFlow not found using pip. I could successfully install tensorflow but still tensorflow-gpu couldn't be install.
Any idea how can I do that.
Updated for tensorflow 2:
Tensorflow 2.x
There is no separate installation for tensorflow GPU in 2.x, it's a unified installation for both CPU and GPU. The package will be built with GPU support if and only if a compatible GPU is available. To verify, use the command:
tf.test.is_built_with_cuda() after installing.
Source
Note that you still need a compatible GPU first.
Tensorflow 1.x:
No, you need a compatible GPU to install tensorflow-GPU.
From the docs.
Hardware requirements: NVIDIA® GPU card with CUDA® Compute Capability
3.5 or higher.
No you cannot, its like installing a soul without body.
But if you are a curious learner and want to try something amazing with DL try buying GPU-compute instances on Cloud or try out Google Colab.
No, but you can use Google Colab (https://colab.research.google.com), which has the option of using GPUs in the notebooks.
No, you Can not install Tensorflow gpu without nvidia graphic card.