ModuleNotFoundError: No module named 'cleverhans.future'

1.2k views Asked by At

I'm trying to install cleverhans package on Google Colab and currently getting an error for ModuleNotFoundError: No module named 'cleverhans.future'

Code Attempted:

!pip install -qq -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans
import sys
sys.path.append('/content/src/cleverhans')
import cleverhans
from cleverhans.future.tf2.attacks import fast_gradient_method, \
    basic_iterative_method, momentum_iterative_method

I followed this initial snippet from Bob Smith, but still getting an error: Installing cleverhans on Colaboratory

More info on cleverhans: https://pypi.org/project/cleverhans/#history

Code tutorial that I'm trying to run: https://towardsdatascience.com/adversarial-machine-learning-mitigation-adversarial-learning-9ae04133c137

1

There are 1 answers

0
maximus On

Here is the bug fix, add this line:

pip install git+https://github.com/CNOCycle/cleverhans.git@feature/tf2.x

Found from: https://bytemeta.vip/repo/cleverhans-lab/cleverhans/issues/1150