How do I install Captum on Google Colab from a custom branch in a fork?

I’ve tried cloning and running this along with all the other tricks I could find online with no luck:

#git clone
#cd captum
#pip install -e .

git clone
cd captum
git checkout custom-branch
pip install -e .

If I use the above code, I can import captum but can’t import any submodules.

Any suggestions?

Are you able to build captum from master and import submodules?
If so, I guess your custom branch might be broken.

I just tested installing the latest release of Captum and it seems to have worked:

!git clone 

%cd captum

!git checkout "v0.2.0"

!pip3 install -e .

import sys

%cd ..

Testing the imports:

import captum

from captum.attr import (

from captum import custom_module # This fails

The master branch seems to install correctly as well, but my custom branch still does not. I haven’t changed anything on my custom branch relating to the submodule organization or, so I don’t understand why I can’t import the one submodule?

Edit: The import in the custom module’s were changed from relative to absolute, and that looks like it might be the cause.