-
Notifications
You must be signed in to change notification settings - Fork 12
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
installation: cannot import java related packages #20
Comments
Hi @cmdoret, it is possible to solve this issue using Python 3.8 or 3.9 instead, because there might be an issue with |
Thanks @Lawhy, I tried recreating the conda environment from scratch using to python 3.8 (also tried with 3.9), the
Yet, I still run into the same issue :/ Python 3.8.19 | packaged by conda-forge | (default, Mar 20 2024, 12:47:35)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.3 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from deeponto.onto import Ontology
Please enter the maximum memory located to JVM [8g]:
INFO:deeponto:8g maximum memory allocated to JVM.
INFO:deeponto:JVM started successfully.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from deeponto.onto import Ontology
File ~/.local/share/micromamba/envs/deeponto38/lib/python3.8/site-packages/deeponto/onto/__init__.py:14
1 # Copyright 2021 Yuan He. All rights reserved.
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 14 from .ontology import Ontology, OntologyReasoner
15 from .pruning import OntologyPruner
16 from .verbalisation import OntologyVerbaliser, OntologySyntaxParser
File ~/.local/share/micromamba/envs/deeponto38/lib/python3.8/site-packages/deeponto/onto/ontology.py:47
45 from java.io import File # type: ignore
46 from java.lang import Runtime, System # type: ignore
---> 47 from org.slf4j.impl import SimpleLogger # type: ignore
48 System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "warn") # set slf4j default logging level to warning
49 from org.semanticweb.owlapi.apibinding import OWLManager # type: ignore
ModuleNotFoundError: No module named 'org.slf4j' Do you have any other suggestion? |
Hi @cmdoret, it can also be the version of your Java that causes the problem. DeepOnto is using OWL API 4 which requires Java 7 or 8 as the backend. You can also comment line 47 temporarily to see if
|
Thanks @Lawhy, I tried commenting out that line, but the same error is then raised by the Unfortunately, I cannot afford to downgrade java (11) on my machine (required by other software), this dependency would make a strong case for dockerizing deeponto and its dependencies. Did you start / plan anything in that direction, and do you think this would be useful? |
Hi @cmdoret, have you also tried to test About dockers, it is a good idea but I currently have no time to implement this. |
Did you try the statement?
If the jar is in the path and the import statement is failing then it may be a conflicting python module. This can be bypassed by placing an alias statement such that some other symbol like "jorg" is used to refer to "org". Example:
|
@Lawhy you were exactly right... I have a folder named Thanks for your help! :) |
@Thrameos thank you, your example worked and help me figure out that the issue was elsewhere 👍 |
Describe the bug
After following the installation instructions (via conda) of deeponto+pytorch+jpype, I cannot import the
Ontology
class. It seems that allorg.*
packages cannot be imported.Setting and exporting
JAVA_HOME
manually does not seem to fix the issue.It fails with the following error (full traceback below):
Any advice would be appreciated.
To Reproduce
Steps to reproduce the behavior:
conda create -n deeponto python=3.10
conda activate deeponto
conda install pytorch torchvision torchaudio cpuonly -c pytorch -c conda-forge
conda install -c conda-forge jpype1
from deeponto.onto import Ontology
Expected behavior
The
Ontology
is imported.Screenshots
Traceback below:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: