install conda package to google colab

There are 2 problems that must be solved:

  • ujson will normally upgrade to python 3.7, must avoid this.
  • path to conda library is changed, must update it.

For 1, you need to add python=3.6 to conda install.

For 2, you need to add path to /usr/local/lib/python3.6/site-packages

Here's the new code

# same
!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
# update 1
!conda install -q -y --prefix /usr/local python=3.6 ujson
# update 2
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
# test it
import ujson
print(ujson.dumps({1:2}))