install_tensorflow() keeps overwriting virtualenv, making it impossible to install tensorflow and keras I would like to use the Keras &amp; Tensorflow package for R in RStudio.

Everytime I use the command install_keras() or install_tensorflow(), I get the following error:

Collecting keras 
Could not fetch URL https://pypi.python.org/simple/keras/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement keras (from versions: )
No matching distribution found for keras


I discovered that every time I tried to install Keras within R, it created a virtualenv in the following directory (basically overwriting it):

/users/username/.virtualenvs/


Where it has Python version Python 2.7.10 (default, Jul 14 2015, 19:46:27). When I directly activate the virtualenv and try pip install keras, I receive the same error. I figured out on Stack Exchange that I could solve this issue by using pip install requests[security]. This seemed to fix the problem but nevertheless, R won't use it.

How can I fix this problem, realising that every time I use install_keras(), I overwrite the virtualenv and the same problem occurs? I even tried using the tensorflow URL directly, but I get the same error when it tries to install other important packages. 

Important information:


MacOS: 10.10.5
R: 3.3.3


I'm new to this, so my apologies if I don't use the terminology correctly. I did manage to make Tensorflow &amp; Keras work in Anaconda and using Jupyter, but I can't seem to make it work in R in that environment as well.
Please check that which pip you are using to install keras. It is possible that your pip may be pip3( will find libraries for python 3.x), while pip2 aka pip (will find libraries for python 2.x).

Keras is supported in python 2.7:

Tensorflow also, they promote use of python 3.x, you can checkout this tow download 2.7 compatible whl. tensorflow 2.7



You can check the pip version by executing below cammand from terminal. 

pip --version


To find location of python/ pip use:

which pip
which python


I would personally suggest use python 3.6 and above. As for python 2.x and python 3.4, support is going to be end soon.