wdevazelhes / IRKSN_AAAI2024

3 stars 0 forks source link

Having trouble running the main function #2

Open Abeltheroy opened 8 months ago

Abeltheroy commented 8 months ago

when i run the main.py,it shows "Fatal error: unable to initialize theJIT",then it shows Error in .makeMessage(..., domain = domain) : 3 arguments passed to .Internal(gettext) which requires 2 Error in gettext(fmt, domain = domain, trim = trim) : 3 arguments passed to .Internal(gettext) which requires 2 Error in Ops.numeric_version(R_version_built_under, "4.0.0") : there is no .Internal function 'compareNumericVersion'

wdevazelhes commented 8 months ago

Hi, thanks a lot for using our repo, could you share the details of your Python environment (such as packages versions etc ?) I believe the error may be due to the dependencies, as the code snippet you provided does not contain any code specific to the current repo

wdevazelhes commented 8 months ago

Also, it seems that maybe the problem is coming from the R package (cf. (R_version_built_under, "4.0.0")) (we use it through rpy2 in python) Below is a recommended installation script, which should normally install a clean environment, but let us know if it still does not work after using this script:

$ conda create -n ksn -c conda-forge numpy scipy scikit-learn tqdm matplotlib pandas rpy2
$ conda activate ksn
$ pip install libsvmdata benchopt jupyter modopt appdirs
Abeltheroy commented 8 months ago

under the folder prediction,the main.py.Could you please provide the environment requirements? After checking the information, it seems that it is related to the R language environment?

wdevazelhes commented 8 months ago

Yes, indeed you are right, I also believe it is related to R (used with rpy2): the requirements as per the readme are numpy scipy scikit-learn tqdm matplotlib pandas rpy2 libsvmdata benchopt jupyter modopt appdirs, but the recommended installation process is as follows:

With an updated conda:

$ conda create -n ksn -c conda-forge numpy scipy scikit-learn tqdm matplotlib pandas rpy2
$ conda activate ksn
$ pip install libsvmdata benchopt jupyter modopt appdirs

rpy2 seems to have a non-standard install compared to usual Python packages (even on my mac it prompts me something related to the JDK whenever I activate the environment), so I guess it may not work properly if installed differently than in the steps above: let us know if even using the steps above it still does not work ๐Ÿ‘๐Ÿ™

Abeltheroy commented 8 months ago

Package Version


anyio 4.3.0 appdirs 1.4.4 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asttokens 2.4.1 async-lru 2.0.4 attrs 23.2.0 Babel 2.14.0 beautifulsoup4 4.12.3 benchopt 1.5.1 bleach 6.1.0 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 comm 0.2.2 contourpy 1.2.0 cryptography 42.0.5 cycler 0.12.1 debugpy 1.8.1 decorator 5.1.1 defusedxml 0.7.1 Deprecated 1.2.14 download 0.3.5 executing 2.0.1 fastjsonschema 2.19.1 fonttools 4.49.0 fqdn 1.5.1 h11 0.14.0 httpcore 1.0.4 httpx 0.27.0 idna 3.6 importlib_metadata 7.0.2 ipykernel 6.29.3 ipython 8.22.2 ipywidgets 8.1.2 isoduration 20.11.0 jedi 0.19.1 Jinja2 3.1.3 joblib 1.3.2 json5 0.9.24 jsonpointer 2.4 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter 1.0.0 jupyter_client 8.6.1 jupyter-console 6.6.3 jupyter_core 5.7.2 jupyter-events 0.9.1 jupyter-lsp 2.2.4 jupyter_server 2.13.0 jupyter_server_terminals 0.5.3 jupyterlab 4.1.5 jupyterlab_pygments 0.3.0 jupyterlab_server 2.25.4 jupyterlab_widgets 3.0.10 kiwisolver 1.4.5 libsvmdata 0.4.1 line-profiler 4.1.2 Mako 1.3.2 MarkupSafe 2.1.5 matplotlib 3.8.3 matplotlib-inline 0.1.6 mistune 3.0.2 modopt 1.7.1 munkres 1.1.4 nbclient 0.10.0 nbconvert 7.16.2 nbformat 5.10.3 nest-asyncio 1.6.0 notebook 7.1.2 notebook_shim 0.2.4 numpy 1.26.4 overrides 7.7.0 packaging 24.0 pandas 2.2.1 pandocfilters 1.5.1 parso 0.8.3 pillow 10.2.0 pip 24.0 platformdirs 4.2.0 plotly 5.20.0 ply 3.11 prometheus_client 0.20.0 prompt-toolkit 3.0.43 psutil 5.9.8 pure-eval 0.2.2 pyarrow 15.0.1 pycparser 2.21 PyGithub 2.2.0 Pygments 2.17.2 PyJWT 2.8.0 PyNaCl 1.5.0 pyparsing 3.1.2 PyQt5 5.15.9 PyQt5-sip 12.12.2 python-dateutil 2.9.0 python-json-logger 2.0.7 pytz 2024.1 pywin32 306 pywinpty 2.0.13 PyYAML 6.0.1 pyzmq 25.1.2 qtconsole 5.5.1 QtPy 2.4.1 referencing 0.34.0 requests 2.31.0 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rpds-py 0.18.0 rpy2 3.5.11 scikit-learn 1.4.1.post1 scipy 1.12.0 Send2Trash 1.8.2 setuptools 69.2.0 simplegeneric 0.8.1 sip 6.7.12 six 1.16.0 sniffio 1.3.1 soupsieve 2.5 stack-data 0.6.3 tenacity 8.2.3 terminado 0.18.1 threadpoolctl 3.3.0 tinycss2 1.2.1 toml 0.10.2 tomli 2.0.1 tornado 6.4 tqdm 4.66.2 traitlets 5.14.2 types-python-dateutil 2.9.0.20240316 typing_extensions 4.10.0 tzdata 2024.1 tzlocal 5.2 uri-template 1.3.0 urllib3 2.2.1 wcwidth 0.2.13 webcolors 1.13 webencodings 0.5.1 websocket-client 1.7.0 wheel 0.42.0 widgetsnbextension 4.0.10 wrapt 1.16.0 zipp 3.18.1 This is the environment. I installed it according to your instructions, but I still got the same error.

wdevazelhes commented 8 months ago

Thanks a lot for the details, looks like you have the same rpy2 version as me (but I didn't check all other packages): I tried to reproduce the issue by reinstalling the environment from scratch on my machine according to the conda script above, but running main.py works for me then: so here are a few possible reasons which may cause the issue in your case:

Let me know if that helps ๐Ÿ‘๐Ÿ™

Abeltheroy commented 8 months ago

Thank you for your answer. I am running on windows and the conda list shows๏ผš # Name Version Build Channel
_r-mutex 1.0.1 anacondar_1 conda-forge anyio 4.3.0 pypi_0 pypi
appdirs 1.4.4 pypi_0 pypi
argon2-cffi 23.1.0 pypi_0 pypi
argon2-cffi-bindings 21.2.0 pypi_0 pypi
arrow 1.3.0 pypi_0 pypi
asttokens 2.4.1 pypi_0 pypi
async-lru 2.0.4 pypi_0 pypi
attrs 23.2.0 pypi_0 pypi
babel 2.14.0 pypi_0 pypi beautifulsoup4 4.12.3 pypi_0 pypi benchopt 1.5.1 pypi_0 pypi bleach 6.1.0 pypi_0 pypi brotli 1.1.0 hcfcfb64_1 conda-forge brotli-bin 1.1.0 hcfcfb64_1 conda-forge bzip2 1.0.8 hcfcfb64_5 conda-forge ca-certificates 2024.2.2 h56e8100_0 conda-forge certifi 2024.2.2 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py312he70551f_0 conda-forge charset-normalizer 3.3.2 pypi_0 pypi click 8.1.7 pypi_0 pypi colorama 0.4.6 pyhd8ed1ab_0 conda-forge comm 0.2.2 pypi_0 pypi contourpy 1.2.0 py312h0d7def4_0 conda-forge cryptography 42.0.5 pypi_0 pypi cycler 0.12.1 pyhd8ed1ab_0 conda-forge debugpy 1.8.1 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi deprecated 1.2.14 pypi_0 pypi download 0.3.5 pypi_0 pypi executing 2.0.1 pypi_0 pypi fastjsonschema 2.19.1 pypi_0 pypi fonttools 4.49.0 py312he70551f_0 conda-forge fqdn 1.5.1 pypi_0 pypi freetype 2.12.1 hdaf720e_2 conda-forge gettext 0.21.1 h5728263_0 conda-forge glib 2.80.0 h39d0aa6_0 conda-forge glib-tools 2.80.0 h0a98069_0 conda-forge gst-plugins-base 1.22.9 h001b923_0 conda-forge gstreamer 1.22.9 hb4038d2_0 conda-forge h11 0.14.0 pypi_0 pypi httpcore 1.0.4 pypi_0 pypi httpx 0.27.0 pypi_0 pypi icu 73.2 h63175ca_0 conda-forge idna 3.6 pypi_0 pypi importlib-metadata 7.0.2 pypi_0 pypi intel-openmp 2024.0.0 h57928b3_49841 conda-forge ipykernel 6.29.3 pypi_0 pypi ipython 8.22.2 pypi_0 pypi ipywidgets 8.1.2 pypi_0 pypi isoduration 20.11.0 pypi_0 pypi jedi 0.19.1 pypi_0 pypi jinja2 3.1.3 pyhd8ed1ab_0 conda-forge joblib 1.3.2 pyhd8ed1ab_0 conda-forge json5 0.9.24 pypi_0 pypi jsonpointer 2.4 pypi_0 pypi jsonschema 4.21.1 pypi_0 pypi jsonschema-specifications 2023.12.1 pypi_0 pypi jupyter 1.0.0 pypi_0 pypi jupyter-client 8.6.1 pypi_0 pypi jupyter-console 6.6.3 pypi_0 pypi jupyter-core 5.7.2 pypi_0 pypi jupyter-events 0.9.1 pypi_0 pypi jupyter-lsp 2.2.4 pypi_0 pypi jupyter-server 2.13.0 pypi_0 pypi jupyter-server-terminals 0.5.3 pypi_0 pypi jupyterlab 4.1.5 pypi_0 pypi jupyterlab-pygments 0.3.0 pypi_0 pypi jupyterlab-server 2.25.4 pypi_0 pypi jupyterlab-widgets 3.0.10 pypi_0 pypi kiwisolver 1.4.5 py312h0d7def4_1 conda-forge krb5 1.21.2 heb0366b_0 conda-forge lcms2 2.16 h67d730c_0 conda-forge lerc 4.0.0 h63175ca_0 conda-forge libblas 3.9.0 21_win64_mkl conda-forge libbrotlicommon 1.1.0 hcfcfb64_1 conda-forge libbrotlidec 1.1.0 hcfcfb64_1 conda-forge libbrotlienc 1.1.0 hcfcfb64_1 conda-forge libcblas 3.9.0 21_win64_mkl conda-forge libclang 15.0.7 default_hde6756a_4 conda-forge libclang13 15.0.7 default_h85b4d89_4 conda-forge libdeflate 1.19 hcfcfb64_0 conda-forge libexpat 2.6.2 h63175ca_0 conda-forge libffi 3.4.2 h8ffe710_5 conda-forge libglib 2.80.0 h39d0aa6_0 conda-forge libhwloc 2.9.3 default_haede6df_1009 conda-forge libiconv 1.17 hcfcfb64_2 conda-forge libjpeg-turbo 3.0.0 hcfcfb64_1 conda-forge liblapack 3.9.0 21_win64_mkl conda-forge libogg 1.3.4 h8ffe710_1 conda-forge libpng 1.6.43 h19919ed_0 conda-forge libsqlite 3.45.2 hcfcfb64_0 conda-forge libsvmdata 0.4.1 pypi_0 pypi libtiff 4.6.0 h6e2ebb7_2 conda-forge libvorbis 1.3.7 h0e60522_0 conda-forge libwebp-base 1.3.2 hcfcfb64_0 conda-forge libxcb 1.15 hcd874cb_0 conda-forge libxml2 2.12.5 hc3477c8_0 conda-forge libzlib 1.2.13 hcfcfb64_5 conda-forge line-profiler 4.1.2 pypi_0 pypi m2w64-bwidget 1.9.10 2 conda-forge m2w64-bzip2 1.0.6 6 conda-forge m2w64-expat 2.1.1 2 conda-forge m2w64-fftw 3.3.4 6 conda-forge m2w64-flac 1.3.1 3 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gettext 0.19.7 2 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-gsl 2.1 2 conda-forge m2w64-libiconv 1.14 6 conda-forge m2w64-libjpeg-turbo 1.4.2 3 conda-forge m2w64-libogg 1.3.2 3 conda-forge m2w64-libpng 1.6.21 2 conda-forge m2w64-libsndfile 1.0.26 2 conda-forge m2w64-libtiff 4.0.6 2 conda-forge m2w64-libvorbis 1.3.5 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge m2w64-libxml2 2.9.3 3 conda-forge m2w64-mpfr 3.1.4 4 conda-forge m2w64-pcre2 10.34 0 conda-forge m2w64-speex 1.2rc2 3 conda-forge m2w64-speexdsp 1.2rc3 3 conda-forge m2w64-tcl 8.6.5 3 conda-forge m2w64-tk 8.6.5 3 conda-forge m2w64-tktable 2.10 5 conda-forge m2w64-wineditline 2.101 5 conda-forge m2w64-xz 5.2.2 2 conda-forge m2w64-zlib 1.2.8 10 conda-forge mako 1.3.2 pypi_0 pypi markupsafe 2.1.5 py312he70551f_0 conda-forge matplotlib 3.8.3 py312h2e8e312_0 conda-forge matplotlib-base 3.8.3 py312h26ecaf7_0 conda-forge matplotlib-inline 0.1.6 pypi_0 pypi mistune 3.0.2 pypi_0 pypi mkl 2024.0.0 h66d3029_49657 conda-forge modopt 1.7.1 pypi_0 pypi msys2-conda-epoch 20160418 1 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge nbclient 0.10.0 pypi_0 pypi nbconvert 7.16.2 pypi_0 pypi nbformat 5.10.3 pypi_0 pypi nest-asyncio 1.6.0 pypi_0 pypi notebook 7.1.2 pypi_0 pypi notebook-shim 0.2.4 pypi_0 pypi numpy 1.26.4 py312h8753938_0 conda-forge openjpeg 2.5.2 h3d672ee_0 conda-forge openssl 3.2.1 hcfcfb64_0 conda-forge overrides 7.7.0 pypi_0 pypi packaging 24.0 pyhd8ed1ab_0 conda-forge pandas 2.2.1 py312h2ab9e98_0 conda-forge pandocfilters 1.5.1 pypi_0 pypi parso 0.8.3 pypi_0 pypi pcre2 10.43 h17e33f8_0 conda-forge pillow 10.2.0 py312he768995_0 conda-forge pip 24.0 pyhd8ed1ab_0 conda-forge platformdirs 4.2.0 pypi_0 pypi plotly 5.20.0 pypi_0 pypi ply 3.11 py_1 conda-forge prometheus-client 0.20.0 pypi_0 pypi prompt-toolkit 3.0.43 pypi_0 pypi psutil 5.9.8 pypi_0 pypi pthread-stubs 0.4 hcd874cb_1001 conda-forge pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge pure-eval 0.2.2 pypi_0 pypi pyarrow 15.0.1 pypi_0 pypi pycparser 2.21 pyhd8ed1ab_0 conda-forge pygithub 2.2.0 pypi_0 pypi pygments 2.17.2 pypi_0 pypi pyjwt 2.8.0 pypi_0 pypi pynacl 1.5.0 pypi_0 pypi pyparsing 3.1.2 pyhd8ed1ab_0 conda-forge pyqt 5.15.9 py312he09f080_5 conda-forge pyqt5-sip 12.12.2 py312h53d5487_5 conda-forge python 3.12.2 h2628c8c_0_cpython conda-forge python-dateutil 2.9.0 pyhd8ed1ab_0 conda-forge python-json-logger 2.0.7 pypi_0 pypi python-tzdata 2024.1 pyhd8ed1ab_0 conda-forge python_abi 3.12 4_cp312 conda-forge pytz 2024.1 pyhd8ed1ab_0 conda-forge pywin32 306 pypi_0 pypi pywinpty 2.0.13 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi pyzmq 25.1.2 pypi_0 pypi qt-main 5.15.8 h9e85ed6_19 conda-forge qtconsole 5.5.1 pypi_0 pypi qtpy 2.4.1 pypi_0 pypi r-base 4.1.3 hdca333a_12 conda-forge referencing 0.34.0 pypi_0 pypi requests 2.31.0 pypi_0 pypi rfc3339-validator 0.1.4 pypi_0 pypi rfc3986-validator 0.1.1 pypi_0 pypi rpds-py 0.18.0 pypi_0 pypi rpy2 3.5.11 py312r41hd0f9d78_3 conda-forge scikit-learn 1.4.1.post1 py312hcacafb1_0 conda-forge scipy 1.12.0 py312h8753938_2 conda-forge send2trash 1.8.2 pypi_0 pypi setuptools 69.2.0 pyhd8ed1ab_0 conda-forge simplegeneric 0.8.1 py_1 conda-forge sip 6.7.12 py312h53d5487_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sniffio 1.3.1 pypi_0 pypi soupsieve 2.5 pypi_0 pypi stack-data 0.6.3 pypi_0 pypi tbb 2021.11.0 h91493d7_1 conda-forge tenacity 8.2.3 pypi_0 pypi terminado 0.18.1 pypi_0 pypi threadpoolctl 3.3.0 pyhc1e730c_0 conda-forge tinycss2 1.2.1 pypi_0 pypi tk 8.6.13 h5226925_1 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tornado 6.4 py312he70551f_0 conda-forge tqdm 4.66.2 pyhd8ed1ab_0 conda-forge traitlets 5.14.2 pypi_0 pypi types-python-dateutil 2.9.0.20240316 pypi_0 pypi typing-extensions 4.10.0 pypi_0 pypi tzdata 2024a h0c530f3_0 conda-forge tzlocal 5.2 py312h2e8e312_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge uri-template 1.3.0 pypi_0 pypi urllib3 2.2.1 pypi_0 pypi vc 14.3 hcf57466_18 conda-forge vc14_runtime 14.38.33130 h82b7239_18 conda-forge vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge wcwidth 0.2.13 pypi_0 pypi webcolors 1.13 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi websocket-client 1.7.0 pypi_0 pypi wheel 0.42.0 pyhd8ed1ab_0 conda-forge widgetsnbextension 4.0.10 pypi_0 pypi wrapt 1.16.0 pypi_0 pypi xorg-libxau 1.0.11 hcd874cb_0 conda-forge xorg-libxdmcp 1.1.3 hcd874cb_0 conda-forge xz 5.2.6 h8d14728_0 conda-forge zipp 3.18.1 pypi_0 pypi zstd 1.5.5 h12be248_0 conda-forge

wdevazelhes commented 8 months ago

Thanks a lot, the environment looks similar to mine (there are a few differences though, such as m2w64 which is installed, we may look into that later), but I guess the environment may be OK, but looking online, I found someone saying that if you have already a pre-existing installation of R, this may cause errors: is this the case ? (i.e. do you have a pre-existing installation of R on your machine ?)

If so, you may be able to specify not to use it, by adding the snippet from that answer, e.g. at the beginning of main.py: https://stackoverflow.com/a/71050531/5635843

Let me know if this helps ๐Ÿ‘

Abeltheroy commented 8 months ago

I also found this article before. I had installed the R environment and set up โ€˜import osโ€™ according to the article. os.environ['R_HOME'] = '/Users//anaconda3/envs//lib/R'', but the JIT error still pops up. I just uninstalled R and it shows up again. 'R_HOME must be set in the environment or Registry'

wdevazelhes commented 8 months ago

For the path of R, did you put the one you wrote above (i.e. '/Users//anaconda3/envs//lib/R') ? If so, I think this would not be the right one, given that you use Windows (which has a backslash not slash), that your username is Abeltheroy (replace if applicable), and the name of the conda environment is ksn (replace Anaconda3 by Miniconda3 if applicable), it should most likely look like something like this (can you confirm that this "R" file is indeed present on your machine at the written location below ?):

import os
os.environ['R_HOME'] =  'C:\Users\Abeltheroy\Anaconda3\envs\ksn\lib\R'

Otherwise, when saying "uninstalled R", do you mean you uninstalled the machine-wise R, or the R from the environment ? (it should be the machine-wise R, not the one from the environment, i.e. you shouldn't run any conda uninstall command, or delete any file from the conda env)

Let me know if this helps ?

wdevazelhes commented 8 months ago

Sorry if this does not help, it is hard for me to debug it because I don't have a windows machine.. Also, this seems related to a problem installing/executing rpy2, but not to a problem about the repo itself.. Let me know if the above works, if not, I may look into it a bit, but I won't be able to do much..