DSE-MSU / DeepRobust

A pytorch adversarial library for attack and defense methods on images and graphs
MIT License
994 stars 192 forks source link

Does not work on Python 3.5 #14

Closed xiangzhang1015 closed 4 years ago

xiangzhang1015 commented 4 years ago

Hi,

I understand the deeprobust is supposed to be installed on Python>3.6, but currently, I have to work on python 3.5 due to some incompatible reason.

I tried to run the code on python3.5 and got the following problem:

    from deeprobust.graph.defense import GCN
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/local/lib/python3.5/dist-packages/deeprobust-0-py3.5.egg/deeprobust/graph/defense/__init__.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 896, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1139, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1115, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1096, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 444, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 533, in spec_from_file_location
  File "/usr/local/lib/python3.5/dist-packages/deeprobust-0-py3.5.egg/deeprobust/graph/defense/gcn_preprocess.py", line 33
    print(f'=== GCN-SVD: rank={k} ===')
                                     ^
SyntaxError: invalid syntax

Is that possible to run deeprobust on python3.5, could you please help me with this?

Thanks in advance.

ChandlerBang commented 4 years ago

Hi,

Thanks for your interest in our repository!

The reason is that python>=3.6 support f-string format. I've modified the code and removed all the f-strings. Now it should work on python 3.5. Note that when installing deeprobust, you might need to uncomment all the packages in setup.py since the versions of them might have conflicts with python 3.5.

xiangzhang1015 commented 4 years ago

@ChandlerBang It works!!! Thank you so much for your help!