Trusted-AI / AIF360

A comprehensive set of fairness metrics for datasets and machine learning models, explanations for these metrics, and algorithms to mitigate bias in datasets and models.
https://aif360.res.ibm.com/
Apache License 2.0
2.47k stars 843 forks source link

Error when installing in R on Win 10 with "Error 1" #501

Open Razzom opened 1 year ago

Razzom commented 1 year ago

Hello everyone I currently am struggling to install the package in R on Win10 The tests to check whether the enviroments are set up seem good to me but installing the AIF360 library to them does throw an error. AIF360 seems to ask for Python 3.11 while the enviroment set up is with Python 3.9?

The Code used overall I took from another issue in here.

reticulate::conda_list()
reticulate::conda_create(envname = "r-test")
reticulate::use_miniconda(condaenv = "r-test", required = TRUE)
reticulate::py_config()
devtools::install_github("Trusted-AI/AIF360/aif360/aif360-r")
aif360::install_aif360(envname = "r-test")

The Test:s

 reticulate::conda_list()
          name                                                                       python
1         base                     C:\\Users\\Benny\\AppData\\Local\\r-miniconda/python.exe
2 r-reticulate C:\\Users\\Benny\\AppData\\Local\\r-miniconda\\envs\\r-reticulate/python.exe
3       r-test       C:\\Users\\Benny\\AppData\\Local\\r-miniconda\\envs\\r-test/python.exe
> reticulate::py_config()
python:         C:/Users/Benny/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/Benny/AppData/Local/r-miniconda/envs/r-reticulate/python39.dll
pythonhome:     C:/Users/Benny/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:40:31) [MSC v.1929 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/Benny/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.26.0
 aif360::install_aif360(envname = "r-test")
+ "C:/Users/Benny/AppData/Local/r-miniconda/condabin/conda.bat" "install" "--yes" "--name" "r-test" "python=3.11"
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

# All requested packages already installed.

C:\Users\Benny\OneDrive\Uni\Bachelorarbeit\Bachelorarbeit>CALL "C:\Users\Benny\AppData\Local\r-miniconda\condabin\activate.bat" "r-test" 

C:\Users\Benny\OneDrive\Uni\Bachelorarbeit\Bachelorarbeit>conda.bat activate "r-test" 
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\__main__.py", line 22, in <module>
    from pip._internal.cli.main import main as _main
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\build_env.py", line 19, in <module>
    from pip._internal.cli.spinners import open_spinner
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\cli\spinners.py", line 9, in <module>
    from pip._internal.utils.logging import get_indentation
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\utils\logging.py", line 29, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\utils\misc.py", line 44, in <module>
    from pip._internal.locations import get_major_minor_version
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\locations\__init__.py", line 14, in <module>
    from . import _sysconfig
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\locations\_sysconfig.py", line 11, in <module>
    from .base import change_root, get_major_minor_version, is_osx_framework
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\locations\base.py", line 9, in <module>
    from pip._internal.utils import appdirs
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_internal\utils\appdirs.py", line 13, in <module>
    from pip._vendor import platformdirs as _appdirs
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 46, in <module>
    PlatformDirs = _set_platform_dir_class()  #: Currently active platform
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 26, in _set_platform_dir_class
    from pip._vendor.platformdirs.windows import Windows as Result
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\site-packages\pip\_vendor\platformdirs\windows.py", line 4, in <module>
    import ctypes
  File "C:\Users\Benny\AppData\Local\r-miniconda\envs\r-test\Lib\ctypes\__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.
Error: Error installing package(s): "aif360", "numba", "BlackBoxAuditing", "\"tensorflow>=1.13.1,<2\"", "pandas", "\"fairlearn==0.4.6\"", "\"protobuf==3.20.1\""
In addition: Warning message:
In shell(fi, intern = intern) :
  'C:\Users\Benny\AppData\Local\Temp\RtmpkpLBdF\file3bf8e334f5d.bat' execution failed with error code 1
Razzom commented 1 year ago

I've got it to work apparently by changing the line to

aif360::install_aif360(envname = "r-test", conda_python_version = "3.7")