You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem
I am trying to run a python script from java with the below import statement.
import tensorflow as tf
When I run this script using jep, it imports the java tensorflow library ( mavan's tensorflow library is a dependency in the java project) and not python's tensorflow library. Then, the below import fails.
from tensorflow import keras
Exception:
jep.JepException: <class 'ImportError'>: tensorflow.keras
at /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jep/java_import_hook.getattr(java_import_hook.py:57)
at /Users/kpriyadarsh/amelia/ameliav3/ameliav3/amelia-nlp-api-impl/src/main/java/net/ipsoft/amelia/nlp/ml/wrapper/bert_model_trainer.(bert_model_trainer.py:16)
at .(:1)
at jep.Jep.exec(Native Method)
at jep.Jep.exec(Jep.java:339)
at com.roberta.BertTrainer.train(BertTrainer.java:55)
at com.roberta.TrainerRunner.main(TrainerRunner.java:52)
Caused by: java.lang.ClassNotFoundException: tensorflow.keras
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 4 more
How can I stop jep from trying to load the java tensorflow dependency and make it import the python's tensorflow library. Any help would be appreciated. Environment (please complete the following information):
OS Platform, Distribution, and Version: MacOS BigSur 11.1
Python Distribution and Version:3.7.1
Java Distribution and Version:Amazon Coretto 11
Jep Version:4.0.1
Python packages used (e.g. numpy, pandas, tensorflow):tensorflow
The text was updated successfully, but these errors were encountered:
The ClassEnquirer is responsible for determining which java packages can be imported into python. You will need to set a custom ClassEnquirer on your JepConfig that returns false when tensorflow is passed to isJavaPackage, You could try the NamingConventionClassEnquirer that comes with jep but if that doesn't work for you you may need to implement the interface yourself to get the desired behavior.
Describe the problem
I am trying to run a python script from java with the below import statement.
import tensorflow as tf
When I run this script using jep, it imports the java tensorflow library ( mavan's tensorflow library is a dependency in the java project) and not python's tensorflow library. Then, the below import fails.
from tensorflow import keras
Exception:
jep.JepException: <class 'ImportError'>: tensorflow.keras
at /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jep/java_import_hook.getattr(java_import_hook.py:57)
at /Users/kpriyadarsh/amelia/ameliav3/ameliav3/amelia-nlp-api-impl/src/main/java/net/ipsoft/amelia/nlp/ml/wrapper/bert_model_trainer.(bert_model_trainer.py:16)
at .(:1)
at jep.Jep.exec(Native Method)
at jep.Jep.exec(Jep.java:339)
at com.roberta.BertTrainer.train(BertTrainer.java:55)
at com.roberta.TrainerRunner.main(TrainerRunner.java:52)
Caused by: java.lang.ClassNotFoundException: tensorflow.keras
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 4 more
How can I stop jep from trying to load the java tensorflow dependency and make it import the python's tensorflow library. Any help would be appreciated.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: