title: Python in R - Error: could not find a Python environment for /usr/bin/python
body: <p>I don't understand how R handles the Python environment and Python version and keep getting the error <code>Error: could not find a Python environment for /usr/bin/python</code>. I installed Miniconda and created a conda environment in the shell:</p>
  <pre class="lang-sh prettyprint-override"><code>conda activate r-reticulate
  </code></pre>
  <p>Then, in R, I try to install keras (same problem with package tensorflow):</p>
  <pre class="lang-r prettyprint-override"><code>library(keras)
  reticulate::use_condaenv()
  install_keras(method = &quot;conda&quot;, conda = reticulate::conda_binary())
  </code></pre>
  <p>... and get the following error:</p>
  <pre class="lang-r prettyprint-override"><code>Error: could not find a Python environment for /usr/bin/python
  </code></pre>
  <p>I tried to figure out what Python R should be using by</p>
  <pre class="lang-r prettyprint-override"><code>reticulate::py_config()
  </code></pre>
  <p>and get</p>
  <pre class="lang-r prettyprint-override"><code>python:         /usr/bin/python
  libpython:      /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
  pythonhome:     /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
  version:        2.7.16 (default, Jul  5 2020, 02:24:03)  [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.21) (-macos10.15-objc-
  numpy:          /Users/bestocke/Library/Python/2.7/lib/python/site-packages/numpy
  numpy_version:  1.16.6
  tensorflow:     [NOT FOUND]
  
  python versions found: 
   /usr/bin/python3
   /usr/local/bin/python3
   /usr/bin/python
  </code></pre>
  <p>I don't understand this. This seems to be using Python 2.7. When trying to figure out which Python is being used in the shell, I get:</p>
  <pre class="lang-sh prettyprint-override"><code>&gt; which python
  /opt/miniconda3/envs/r-reticulate/bin/python
  </code></pre>
  <p>and</p>
  <pre><code>&gt; ls -l /opt/miniconda3/envs/r-reticulate/bin/python
  lrwxr-xr-x  1 username  wheel  9 Aug  2 15:21 /opt/miniconda3/envs/r-reticulate/bin/python -&gt; python3.6
  </code></pre>
  <p>Suggesting Python 3.6 should be used.</p>
  <p>What am I getting wrong here?</p>