title: Installing anaconda with pyenv, unable to configure virtual environment
body: <p>I am using pyenv to manage python installations and virtual environments - and I would like anaconda to be one such installation, and to be able to create virtual environments using anaconda python. Using <code>pyenv install anaconda3-2019.03</code> successfully installs and I can activate the version with <code>pyenv global anaconda3-2019.03</code>:</p>
  <pre><code>SamLee-PC:~ max$ pyenv versions
    system
    2.7.10
    2.7.10/envs/flask_tutorial
  * 3.7.4 (set by /Users/max/.pyenv/version)
    3.7.4/envs/learning_python
    3.7.4/envs/microblog
    3.7.4/envs/stocktool
    3.7.4/envs/test1
    anaconda3-2019.03
    anaconda3-2019.03/envs/datsci
    datsci
    flask_tutorial
    learning_python
    microblog
    stocktool
    test1
  SamLee-PC:~ max$ pyenv which python
  /Users/max/.pyenv/versions/3.7.4/bin/python
  SamLee-PC:~ max$ pyenv global anaconda3-2019.03
  (anaconda3-2019.03) SamLee-PC:~ max$ pyenv which python
  /Users/max/.pyenv/versions/anaconda3-2019.03/bin/python
  (anaconda3-2019.03) SamLee-PC:~ max$ pyenv which conda
  /Users/max/.pyenv/versions/anaconda3-2019.03/bin/conda
  </code></pre>
  <p>(I do not know why the python version is added to the command prompt only with the anaconda installation)</p>
  <p>When I creat a new virtual environment (<code>pyenv virtualenv anaconda3-2019.03 datsci</code>), it appears to work as intended:</p>
  <pre><code>SamLee-PC:~ max$ pyenv which python
  /Users/max/.pyenv/versions/3.7.4/bin/python
  SamLee-PC:~ max$ cd code/linkedin/datsci
  (datsci) SamLee-PC:datsci max$ pyenv which python
  /Users/max/.pyenv/versions/datsci/bin/python
  (datsci) SamLee-PC:datsci max$ 
  </code></pre>
  <p>This is the same relative location returned returned by <code>pyenv which python</code> in my other virtual environments, which all work properly.</p>
  <p><strong>The problem</strong> is that the python version that gets run in the virtual environment doesn't have access to all of anaconda's packages:</p>
  <pre><code>(datsci) SamLee-PC:datsci max$ anaconda-navigator
  pyenv: anaconda-navigator: command not found
  
  The `anaconda-navigator' command exists in these Python versions:
    anaconda3-2019.03
  
  (datsci) SamLee-PC:datsci max$ 
  </code></pre>
  <p>though it does if I activate the python installation manually:</p>
  <pre><code>SamLee-PC:~ max$ pyenv global anaconda3-2019.03
  (anaconda3-2019.03) SamLee-PC:~ max$ anaconda-navigator
  WARNING: The conda.compat module is deprecated and will be removed in a future release.
  /Users/max/.pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/anaconda_navigator/api/conda_api.py:1364: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
    data = yaml.load(f)
  2019-09-21 14:03:38,666 - ERROR download_api._download:234
  Invalid url https://www.anaconda.com/wp-content/uploads/2017/05/Webinar20-20Three20Ways20to20Move20your20Data20Science20Projects20to20Production.png
  #anaconda navigator GUI opens
  </code></pre>
  <p>(oddly, the python version that <code>datsci</code> points to <em>does</em> seem to recognize conda:</p>
  <pre><code>(datsci) SamLee-PC:datsci max$ pyenv which python
  /Users/max/.pyenv/versions/datsci/bin/python
  (datsci) SamLee-PC:datsci max$ conda
  usage: conda [-h] [-V] command ...
  
  conda is a tool for managing and deploying applications, environments and packages.
  
  ...
  </code></pre>
  <p>The problem is that, as I understand it, activating the python version this way whenever I want anaconda means that I only have access to one version of anaconda python - defeating the purpose of using it in a virtual environment.</p>
  <p>One more piece of the puzzle - I noticed that for my other virtual environments, <code>~/.pyenv/versions/name-of-virtualenv</code> contains a file <code>pyvenv.cfg</code>, which contains e.g. the following:</p>
  <pre><code>  1 home = /Users/max/.pyenv/versions/3.7.4/bin                                                                   
    2 include-system-site-packages = false
    3 version = 3.7.4
  </code></pre>
  <p>There was no such file in <code>~/.pyenv/versions/datsci</code>, so I added one:</p>
  <pre><code>  1 home = /Users/max/.pyenv/versions/anaconda3-2019.03/bin                                                       
    2 include-system-site-packages = false
    3 version = anaconda3-2019.03
  </code></pre>
  <p>to no avail.</p>
  <p>FWIW the contents of that directory are:</p>
  <pre><code>(anaconda3-2019.03) SamLee-PC:datsci max$ pwd
  /Users/max/.pyenv/versions/datsci
  (anaconda3-2019.03) SamLee-PC:datsci max$ ls
  bin     conda-meta  include     lib     pyvenv.cfg  share       ssl
  (anaconda3-2019.03) SamLee-PC:datsci max$ 
  </code></pre>
  <p>I wonder if I have the wrong contents in the <code>pyvenv.cfg</code> file for datsci...but I am at a loss.</p>
  <p>I really like the way pyenv works, and I would like to continue using it. Is there a way to configure anaconda to behave properly under pyenv?</p>
  <h1>Update:</h1>
  <p>I uninstalled my pyenv-managed anaconda and did a fresh install as per Simba's recommendation. Now by default pyenv determines the active python installation, and I can activate conda with <code>conda activate base</code>:</p>
  <pre><code>Maxs-MacBook-Air:~ max$ which python
  /Users/max/.pyenv/shims/python
  Maxs-MacBook-Air:~ max$ conda activate base
  (base) Maxs-MacBook-Air:~ max$ which python
  /Users/max/anaconda3/bin/python
  (base) Maxs-MacBook-Air:~ max$ 
  </code></pre>
  <p><strong>However</strong> after creating a new conda environment with <code>conda create --name datsci</code>, the new conda environment does not seem to activate properly:</p>
  <pre><code>Maxs-MacBook-Air:~ max$ conda activate datsci
  (datsci) Maxs-MacBook-Air:~ max$ which python
  /Users/max/.pyenv/shims/python
  </code></pre>
  <p>What am I missing?</p>
  <p>Here are the contents of my <code>.bash_profile</code>:</p>
  <pre><code>  1 export PATH=&quot;/Users/max/.pyenv/bin:$PATH&quot;                                                                                                                                                                                                 
    2 eval &quot;$(pyenv init -)&quot;
    3 eval &quot;$(pyenv virtualenv-init -)&quot;
    4 
    5 # &gt;&gt;&gt; conda initialize &gt;&gt;&gt;
    6 # !! Contents within this block are managed by 'conda init' !!
    7 __conda_setup=&quot;$('/Users/max/anaconda3/bin/conda' 'shell.bash' 'hook' 2&gt; /dev/null)&quot;
    8 if [ $? -eq 0 ]; then
    9     eval &quot;$__conda_setup&quot;
   10 else
   11     if [ -f &quot;/Users/max/anaconda3/etc/profile.d/conda.sh&quot; ]; then
   12         . &quot;/Users/max/anaconda3/etc/profile.d/conda.sh&quot;
   13     else
   14         export PATH=&quot;/Users/max/anaconda3/bin:$PATH&quot;
   15     fi
   16 fi
   17 unset __conda_setup
   18 # &lt;&lt;&lt; conda initialize &lt;&lt;&lt;
  </code></pre>
  <p>Is it important that I duplicate the if statement found in Simba's <code>.bash_profile?</code></p>
  <h1>Update 2:</h1>
  <p>Problem solved, I had to install python in the new environment.</p>