title: conda activate and conda init fail to work in colab (as per June 2020)
body: <p>This question may be a duplicate of a question asked in 2018 :
  <a href="https://stackoverflow.com/questions/53031430/conda-environment-in-google-colab-google-colaboratory">conda environment in google colab [google-colaboratory]</a></p>
  <p>but answer did not working for me.</p>
  <p>I noticed it also mentioned in another question on Jan 2020,
  <a href="https://stackoverflow.com/questions/59647101/osmnx-in-google-colab">osmNX in Google Colab</a></p>
  <p>and noticed same question posted on datascience stack - but answer did not work me either:
  <a href="https://datascience.stackexchange.com/questions/75948/how-to-setup-and-run-conda-on-google-colab/75979#75979">https://datascience.stackexchange.com/questions/75948/how-to-setup-and-run-conda-on-google-colab/75979#75979</a></p>
  <p>So I think question is still valid.</p>
  <p>How to activate a conda environment in Colab?</p>
  <p>Cannot find a way to work out.</p>
  <p>Steps to reproduce:</p>
  <ol>
  <li>install miniconda</li>
  </ol>
  <pre class="lang-sh prettyprint-override"><code>!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
  !bash Miniconda3-4.5.4-Linux-x86_64.sh -bfp /usr/local
  </code></pre>
  <p>Note the warning:</p>
  <pre><code>...
  installation finished.
  WARNING:
      You currently have a PYTHONPATH environment variable set. This may cause
      unexpected behavior when running the Python interpreter in Miniconda3.
      For best results, please verify that your PYTHONPATH only points to
      directories of packages that are compatible with the Python interpreter
      in Miniconda3: /usr/local
  </code></pre>
  <ol start="2">
  <li>update and bash variables</li>
  </ol>
  <pre class="lang-sh prettyprint-override"><code>%%bash
  conda update conda -y -q
  source /usr/local/etc/profile.d/conda.sh
  conda init (or conda init bash if linux)
  </code></pre>
  <p>Note the comment to have changes into effects:</p>
  <pre><code>no change     /usr/local/condabin/conda
  no change     /usr/local/bin/conda
  no change     /usr/local/bin/conda-env
  no change     /usr/local/bin/activate
  no change     /usr/local/bin/deactivate
  no change     /usr/local/etc/profile.d/conda.sh
  no change     /usr/local/etc/fish/conf.d/conda.fish
  no change     /usr/local/shell/condabin/Conda.psm1
  no change     /usr/local/shell/condabin/conda-hook.ps1
  no change     /usr/local/lib/python3.7/site-packages/xontrib/conda.xsh
  no change     /usr/local/etc/profile.d/conda.csh
  modified      /root/.bashrc
  
  ==&gt; For changes to take effect, close and re-open your current shell. &lt;==
  </code></pre>
  <ol start="3">
  <li>Try get changes into effect:</li>
  </ol>
  <pre class="lang-sh prettyprint-override"><code>%%bash
  exec bash
  </code></pre>
  <p>or</p>
  <pre class="lang-sh prettyprint-override"><code>!source ~/.bashrc
  </code></pre>
  <ol start="4">
  <li><p>Install an environment : in my case:</p>
  <p><code>!conda env create -f enviroment.yml</code></p>
  </li>
  <li><p>Activate the environment &gt; does not work!</p>
  <p><code>!conda activate myenv</code></p>
  </li>
  </ol>
  <p>Note the comment:</p>
  <pre><code>CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
  To initialize your shell, run
  
  $ conda init &lt;SHELL_NAME&gt;
  
  Currently supported shells are:
    - bash
    - fish
    - tcsh
    - xonsh
    - zsh
    - powershell
  
  See 'conda init --help' for more information and options.
  
  IMPORTANT: You may need to close and restart your shell after running 'conda init'.
  </code></pre>
  <ol start="6">
  <li>So I try again:</li>
  </ol>
  <pre class="lang-sh prettyprint-override"><code>!conda init bash
  </code></pre>
  <p>and</p>
  <pre class="lang-sh prettyprint-override"><code>!conda activate myenv
  </code></pre>
  <p>=&gt; no effect</p>
  <p>Please note also the following:</p>
  <pre class="lang-sh prettyprint-override"><code>%%bash
  source activate myenv
  </code></pre>
  <p>Now I think the environment is activated, but not so, because python still does not point to the conda env:</p>
  <pre><code>!which python
  #/usr/local/bin/python 
  </code></pre>
  <p>This is a different result I have respect to the answer :
  <a href="https://datascience.stackexchange.com/a/75979">https://datascience.stackexchange.com/a/75979</a></p>
  <p>See that python is pointing to the default, not the conda's one:</p>
  <pre><code>%%bash
  source activate myenv
  
  python
  import sys
  # maybe only need this the first time we run this notebook
  sys.path.append('/usr/local/lib/python3.6/site-packages')
  
  print(&quot;Python version&quot;)
  print(sys.version)
  </code></pre>
  <p>Output:</p>
  <pre><code>Python version
  3.7.5 (default, Oct 25 2019, 15:51:11) 
  [GCC 7.3.0]
  </code></pre>
  <p>And also note that activating with <code>source</code> is deprecated:</p>
  <pre><code>%%bash
  source deactivate
  #DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
  </code></pre>
  <p>Any help appreciated.</p>
  <p>P.s. for Google folks - setting up conda in Colab by default (or option from selected list) would be much appreciated.</p>