|
| 1 | +This is our first guest post. So, special thanks to [Shalini Singh](https://twitter.com/shalinisparmar) who is working as a Software Engineer with Morningstart Inc. Her interests include Data Analysis, Python and Building models for financial products. |
| 2 | + |
| 3 | +When I first got into machine learning, it took me a complete day to finally figure out how to properly set up my TensorFlow environment. Out of frustration, I decided to write this post to help anyone going through the process and save you a couple of StackOverflow searches. |
| 4 | + |
| 5 | +Please refer to this [link](https://www.python.org/downloads/) for python installation and [this](https://www.datacamp.com/community/tutorials/installing-anaconda-windows) for anaconda setup. I am listing down the steps that worked for me and errors that I got along the way and how I solved them. |
| 6 | + |
| 7 | +1. ***Creating a Conda environment*** |
| 8 | + |
| 9 | +``` |
| 10 | +conda create — name your_environment_name_here python=3.6 |
| 11 | +``` |
| 12 | + |
| 13 | +Now ideally latest python version should have been used but I have created an environment with Python version 3.6 because it is stable and compatible with a lot of TensorFlow dependencies and this has worked for everyone else in my team too. I faced some version related errors with python version 3.7 and tensorflow 2.0, one of the errors being |
| 14 | + |
| 15 | +``` |
| 16 | +AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph |
| 17 | +``` |
| 18 | + |
| 19 | +So I installed the more stable version of tensorflow i.e tensorflow-1.14.0. This might not be the best way to do it, but it sure was the quickest one and the one without hassle. |
| 20 | + |
| 21 | +2. ***Ideally the next step would be to install tensorflow-gpu and then keras-gpu, but I would suggest an intermediate step in between to save you from errors like this.*** |
| 22 | + |
| 23 | +``` |
| 24 | +cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version |
| 25 | +``` |
| 26 | + |
| 27 | +The intermediate step would be visiting the NVIDIA developer site and updating or downloading the CUDA Toolkit. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +Now I struggled a lot to find the right CUDA version that is compatible with the python version and Tensorflow version. So I am posting it [here](https://www.tensorflow.org/install/source#tested_build_configurations). |
| 32 | + |
| 33 | + |
| 34 | +The following versioning setup has worked for me |
| 35 | + |
| 36 | +- tensorflow_gpu-1.14.0 |
| 37 | +- python version- 3.6 |
| 38 | +- cuDNN version -7.4 |
| 39 | +- CUDA version-10.0 |
| 40 | + |
| 41 | +Download the NVIDIA cuDNN [here](https://developer.nvidia.com/cudnn). And to download the cuDNN it requires membership in the NVIDIA Developer Program. Please join the program to access this material. You can make an account in 2 min with entering some basic details. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +3. ***After you have downloaded and extracted the CUDA toolkit, add these three cuDNN paths to the path system environment variable*** |
| 46 | + |
| 47 | +Set the following in the path variable |
| 48 | + |
| 49 | +``` |
| 50 | +cudnn-10.0-windows10-x64-v7.4.2.24\cuda\bin |
| 51 | +cudnn-10.0-windows10-x64-v7.4.2.24\cuda\include |
| 52 | +cudnn-10.0-windows10-x64-v7.4.2.24\cuda\lib\x64 |
| 53 | +``` |
| 54 | + |
| 55 | +4. ***Now you are all set to install tensorflow-gpu and keras-gpu with conda. Activate the conda environment that you have created in the first step*** |
| 56 | + |
| 57 | +``` |
| 58 | +conda activate enivironment_name |
| 59 | +conda install tensorflow-gpu==1.14 |
| 60 | +conda install keras-gpu |
| 61 | +``` |
| 62 | + |
| 63 | +Now it would take some time to get installed and there are multiple packages that would get installed so do not freak out. Keep Calm and wait for it to be completely done. |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +5. ***The last step would be to restart your system before you start working to play safe.*** |
0 commit comments