Search code examples
pythongoogle-colaboratorycleverhans

Installing cleverhans on Colaboratory


I am trying to install cleverhans (https://github.com/tensorflow/cleverhans)

I am running the following command

!pip install -q -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans

However, when I try to do import cleverhans I get an error saying that there's no such module.

PS If I try to install the module on my local machine, the source is stored in ~/.src/cleverhans.


Solution

  • It looks like the installation doesn't properly update the python path. Here's a snippet that worked for me:

    !pip install -qq -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans
    import sys
    sys.path.append('/content/src/cleverhans')
    import cleverhans