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

Exception: Unable to find JAVA_HOME #29

Closed
MaoMaoStudents opened this issue Dec 29, 2024 · 2 comments
Closed

Exception: Unable to find JAVA_HOME #29

MaoMaoStudents opened this issue Dec 29, 2024 · 2 comments

Comments

@MaoMaoStudents
Copy link

Dear Author,

Thank you for your open-source contribution. I would like to ask you a question regarding the environment setup.

When running the following line of code:

from pyserini.search import LuceneSearcher, get_topics, get_qrels
I encounter the following error:

Traceback (most recent call last):
File "D:\PycharmProjects\RankGPT\demo.py", line 3, in
from pyserini.search import get_qrels
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\pyserini\search_init_.py", line 17, in
from .base import get_topics, get_topics_with_reader, get_qrels_file, get_qrels
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\pyserini\search_base.py", line 25, in
from pyserini.pyclass import autoclass
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\pyserini\pyclass.py", line 31, in
from jnius import autoclass, cast
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\jnius_init
.py", line 18, in
java = get_java_setup(sys.platform)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\jnius\env.py", line 60, in get_java_setup
JAVA_HOME = get_jdk_home(platform)
^^^^^^^^^^^^^^^^^^^^^^
File "D:\ProgramData\Anaconda3\envs\rankgpt-3.12\Lib\site-packages\jnius\env.py", line 335, in get_jdk_home
raise Exception('Unable to find JAVA_HOME')
Exception: Unable to find JAVA_HOME
Apart from the environment specified in requirements.txt, is there any additional setup required? Looking forward to your reply!

@sunnweiwei
Copy link
Owner

Hi! Installing Pyserini on Windows can be tricky. You can refer to the official repo for more details: Pyserini, Anserini (dependency). In Anserini, the Windows tips mention: “If you are using Windows, please use WSL2 to build Anserini.”

Alternatively, you can avoid using Pyserini if you only need to: (i) Download data, consider using ir-datasets. (ii) Run BM25 retrieval, consider bm25s, which doesn’t require Java.

Hope this helps!

@MaoMaoStudents
Copy link
Author

MaoMaoStudents commented Dec 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants