I hope all of you are doing Great. I need to install cleverhans on windows for some project but once installed it was unable to access any python file in there and I got a lot of errors like:
<ipython-input-12-4fbd91cef426> in <module>
10 import numpy as np
11
---> 12 from cleverhans.attacks import FastGradientMethod
13 from cleverhans.compat import flags
14 from cleverhans.dataset import MNIST
~\src\cleverhans\cleverhans\attacks\__init__.py in <module>
10
11 from cleverhans import utils
---> 12 from cleverhans.attacks.attack import Attack
13 from cleverhans.attacks.basic_iterative_method import BasicIterativeMethod
14 from cleverhans.attacks.carlini_wagner_l2 import CarliniWagnerL2
~\src\cleverhans\cleverhans\attacks\attack.py in <module>
11
12 from cleverhans.compat import reduce_max
---> 13 from cleverhans.model import Model
14 from cleverhans import utils
15
~\src\cleverhans\cleverhans\model.py in <module>
7 import tensorflow as tf
8
----> 9 from cleverhans import utils_tf
10
11
~\src\cleverhans\cleverhans\utils_tf.py in <module>
343
344 def kl_with_logits(p_logits, q_logits, scope=None,
--> 345 loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
346 """Helper function to compute kl-divergence KL(p || q)
347 """
AttributeError: module 'tensorflow' has no attribute 'GraphKeys'
I hope to have a lot of answers from you. Have a nice day.
Looks like cleverhans is designed to use an older version of tensorflow. To make it downward compatible replace
with
in the cleverhans source code or look if there is an updated version of cleverhans available or uninstall tensorflow and install an older version (v1) instead.
See: Tensorflow 2.1.0 Error, module 'tensorflow' has no attribute 'GraphKeys'
From cleverhans GitHub repo:
"Currently supported setups
Although CleverHans is likely to work on many other machine configurations, we currently test it it with Python 3.5 and TensorFlow {1.8, 1.12} on Ubuntu 14.04.5 LTS (Trusty Tahr)."