title: install conda package to google colab
body: <p>I try to install packages from anaconda to google's colab.</p>
  
  <p>But it doesn't work. The whole thing is voodoo magic.</p>
  
  <p>The following code is in one cell.</p>
  
  <p>Notebook's cell:</p>
  
  <pre class="lang-py prettyprint-override"><code>!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  !bash Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local/
  !rm Miniconda3-latest-Linux-x86_64.sh
  !conda install -y --prefix /usr/local/ ujson aiohttp tqdm
  import sys
  os.environ['PYTHONPATH'] = "/usr/local/miniconda3"
  os.environ['PATH'] = '/usr/local/miniconda3/bin:' + os.environ['PATH']
  sys.path.append('/usr/local/lib/python3.6/site-packages/')
  import ujson
  </code></pre>
  
  <p>Result:</p>
  
  <pre class="lang-py prettyprint-override"><code>ModuleNotFoundError: No module named 'ujson'
  </code></pre>
  
  <p>If I go into a bash shell with "!bash" and then run the "bash's" python, I can import ujson in that python. But, if I directly import ujson in the "notebook's" python, it doesn't work.</p>
  
  <p>The methods here doesn't seem to work anymore</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/49202649/how-to-build-libraries-via-conda-on-colab-research">How to build libraries via conda on colab.research?</a></li>
  <li><a href="https://stackoverflow.com/questions/55828329/whats-the-latest-conda-version-compatible-with-google-colab">What&#39;s the latest conda version compatible with Google Colab</a> suggests the following, which doesn't work now:</li>
  </ul>
  
  <pre><code>!wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
  !chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
  !bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
  !conda install -q -y --prefix /usr/local ujson
  import sys
  sys.path.append("/usr/local/conda/lib/python3.6/site-packages/")
  print(ujson.dumps({1:2}))
  </code></pre>
  
  <p>What is the latest hack that would work?</p>