Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with numpy>=2.0 #24

Open
lazzd opened this issue Jul 15, 2024 · 0 comments · May be fixed by #25
Open

Incompatibility with numpy>=2.0 #24

lazzd opened this issue Jul 15, 2024 · 0 comments · May be fixed by #25
Labels
bug Something isn't working

Comments

@lazzd
Copy link

lazzd commented Jul 15, 2024

The library seems not to be compatible with numpy >= 2.0 due to import issues.

Steps to reproduce

When importing the attacks, for example, FoolboxPGDL2:

from secml.adv.attacks import CFoolboxPGDL2

an ImportError is obtained.

Relevant logs

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], [line 1](vscode-notebook-cell:?execution_count=1&line=1)
----> [1](vscode-notebook-cell:?execution_count=1&line=1) from secml.adv.attacks import CFoolboxPGDL2

File [~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:4](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:4)
      [1](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:1) from .c_attack import CAttack
      [2](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:2) from .c_attack_mixin import CAttackMixin
----> [4](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:4) from .evasion import *
      [5](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/__init__.py:5) from .poisoning import *

File [~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:22](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:22)
     [20](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:20) else:
     [21](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:21)     from .foolbox.secml_autograd import SecmlLayer
---> [22](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:22)     from .foolbox.c_attack_evasion_foolbox import \
     [23](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:23)         CAttackEvasionFoolbox
     [24](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:24)     from .foolbox.fb_attacks.fb_basic_iterative_attack import \
     [25](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:25)         CFoolboxBasicIterative, CFoolboxBasicIterativeL1, \
     [26](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:26)         CFoolboxBasicIterativeL2, CFoolboxBasicIterativeLinf
     [27](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:27)     from .foolbox.fb_attacks.fb_cw_attack import \
     [28](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/__init__.py:28)         CFoolboxL2CarliniWagner

File [~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:14](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:14)
     [12](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:12) import torch
     [13](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:13) from eagerpy import PyTorchTensor
...
     [16](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:16) from secml.adv.attacks.evasion import CAttackEvasion
     [17](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:17) from secml.adv.attacks.evasion.foolbox.secml_autograd import \
     [18](https://file+.vscode-resource.vscode-cdn.net/home/lazzaro/Desktop/Dottorato/Lezioni/ADML24/ADML24%20Exam/~/miniconda3/envs/secml2/lib/python3.9/site-packages/secml/adv/attacks/evasion/foolbox/c_attack_evasion_foolbox.py:18)     SecmlLayer, as_tensor, as_carray

ImportError: cannot import name 'NaN' from 'numpy' (/home/lazzaro/miniconda3/envs/secml2/lib/python3.9/site-packages/numpy/__init__.py)

Possible fixes

A possible fix is to install numpy==1.26.4

@lazzd lazzd added the bug Something isn't working label Jul 15, 2024
@maurapintor maurapintor linked a pull request Nov 11, 2024 that will close this issue
@maurapintor maurapintor linked a pull request Nov 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant