Trusted-AI/adversarial-robustness-toolbox

Package cannot be imported after installing with pip

Closed this issue · 3 comments

Describe the bug
I have been trying to install the package and continually find errors when importing the package after install. While I have encountered a number of different errors, this is the simplest and most reproducible.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new python environment via python -m venv venv and activate it
  2. Install via pip: pip install "adversarial-robustness-toolbox (Note: I encounter the same problem when supplying the xgboost option as well. If I use the all option, I immediately get errors with installation)
  3. Run python via command line or from a file containing import art (also works with from art import ...)
  4. See error ImportError: cannot import name 'packaging' from 'pkg_resources' (/path/to/venv/lib/python3.12/site-packages/pkg_resources/__init__.py)

Expected behavior
The package loads without errors

System information (please complete the following information):

  • OS: Mac OS Sonoma 14.5
  • Python version: 3.12.3
  • ART version or commit number: 1.17.1

I encountered the same error as above when trying to run from a virtual env, but installing through "native" pip works fine. @bkuwahara I suggest pyenv as a temporary workaround, as that works for me (python==3.11.9). In the long run, pkg_resources should be replaced with importlib. See https://docs.python.org/3/library/modules.html

Hi @bkuwahara and @arnold-jr Please apologise my delayed response. We have fixed this issue in ART 1.18.0

Thank you!