Reputation: 1859
I'm trying to install Keras in anaconda from the instructions given here.
I ran the command conda install -c conda-forge keras
and then after that, I pressed y
when the prompt appeared asking me to press y/n. Then some libraries were downloaded and immediately after that the anaconda prompt crashed.
I looked at this thread and I couldn't try installing it using pip
because every time I activate the environment, it crashes in a few seconds after automatically running the following commands:
C:\Users\ashut>python C:\Users\ashut\Anaconda3\envs\py36\etc\keras\load_config.py 1>temp.txt
C:\Users\ashut>set /p KERAS_BACKEND= 0<temp.txt
C:\Users\ashut>del temp.txt
C:\Users\ashut>python -c "import keras" 1>nul 2>&1
I could barely manage to get a screenshot of the error that is generated after the commands given above are executed. I don't know what's happening here:
And then it crashes.
I expected at least the instructions on anaconda's own site to be reliable, but sadly this doesn't seems to be the case. If there's any other method to install Keras in anaconda without losing this environment, I'd be more than grateful to know.
Upvotes: 4
Views: 9380
Reputation: 1859
Nothing worked actually. I tried deleting the environment in which I installed Keras, but even deleting it and creating an environment with another name, the same four statements were automatically executed and crashed the anaconda prompt, as before.
So I reinstalled Anaconda, again made an environment for python 3.6, and installed tensorflow-gpu and keras using pip
. I don't know why but it worked this time.
Edit 1: I found this after I'd performed the steps described above. This thread also concentrates on reinstalling Anaconda, as no solution to such an event is known yet.
Edit 2: Okay I think I figured out what the problem was. I had the wrong version of CUDA installed - CUDA 10, which is not yet supported by tensorflow and hence keras showed problems. So this time, I installed CUDA 9 and it's corresponding CuDNN version, uninstalled the pip
versions of tensorflow & keras and installed them again using conda
. It worked, without a hitch.
TL;DR:
The following works on CUDA 9, CuDNN 7.4.2
pip uninstall tensorflow-gpu
pip uninstall keras
conda install tensorflow-gpu
conda install keras-gpu
Read Lucasz's answer for why I uninstalled the pip
versions.
Upvotes: 0
Reputation: 11407
You are missing build tools. Anaconda depends on their presence and it cannot supply them by itself, as these are proprietary Microsoft tools. To fix the problem install them from here. After you reboot your computer, Anaconda should work just fine.
pip
works for you since it takes a binary, it does not compile it. It's suboptimal and in case of deep learning performance is important. Check e.g. this article to learn about differences between conda and pypi tensorflow.
Upvotes: 1