Description:
I’m encountering an issue with a LightGBM regressor and classifier when using PySpark in Python 3.10.0.
Environment:
PySpark version: 3.2.1
Python version: 3.10.0
Py4j version: 0.10.9.5
Spark jars packages: com.microsoft.azure:synapseml_2.12:0.11.0
Error Message:
java.lang.UnsatisfiedLinkError: Can’t load library: /var/folders/dz/mc23060n2kq52djyhcxl9kmh0000gp/T/mml-natives17452036633252549823/lib_lightgbm.dylib
Steps to Reproduce:
- Use LightGBM regressor or classifier with PySpark DataFrame in Python
3.10.0. - Encounter the error mentioned above.
Attempts Made:
I followed the solution provided here and symlinked the installed libomp, but the issue persists.
Detailed Error Stack:
py4j.protocol.Py4JJavaError: An error occurred while calling o5147.fit.
E : java.lang.UnsatisfiedLinkError: Can’t load library: /var/folders/dz/mc23060n2kq52djyhcxl9kmh0000gp/T/mml-natives17452036633252549823/lib_lightgbm.dylib
E at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
E at java.base/java.lang.Runtime.load0(Unknown Source)
E at java.base/java.lang.System.load(Unknown Source)
E at com.microsoft.azure.synapse.ml.core.env.NativeLoader.loadLibraryByName(NativeLoader.java:66)
E at com.microsoft.azure.synapse.ml.lightgbm.LightGBMUtils$.initializeNativeLibrary(LightGBMUtils.scala:33)
E at com.microsoft.azure.synapse.ml.lightgbm.LightGBMBase.train(LightGBMBase.scala:37)
E at com.microsoft.azure.synapse.ml.lightgbm.LightGBMBase.train$(LightGBMBase.scala:36)
E at com.microsoft.azure.synapse.ml.lightgbm.LightGBMRegressor.train(LightGBMRegressor.scala:39)
E at com.microsoft.azure.synapse.ml.lightgbm.LightGBMRegressor.train(LightGBMRegressor.scala:39)
E at org.apache.spark.ml.Predictor.fit(Predictor.scala:151)
E at org.apache.spark.ml.Predictor.fit(Predictor.scala:115)
E at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
E at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
E at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
E at java.base/java.lang.reflect.Method.invoke(Unknown Source)
E at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
E at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
E at py4j.Gateway.invoke(Gateway.java:282)
E at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
E at py4j.commands.CallCommand.execute(CallCommand.java:79)
E at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
E at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
E at java.base/java.lang.Thread.run(Unknown Source)
Additional Notes:
- The issue seems to be related to loading the LightGBM library in Python 3.10.0
- I’ve checked that lib_lightgbm.dylib exists in the specified path.
- Any insights or suggestions on resolving this issue would be greatly appreciated.