Aspose.Cells for Python via .NET license issue for databricks

Hi, we are trying to deploy our purchased license for aspose.cell python product to our Databricks environment which we could do successfully. But when we call the license within our code, we run into the following error,
Fatal error: The Python kernel is unresponsive.
databricks_aspsoe_error.txt.zip (3.7 KB)

Please note, the same license succfully works in our normal linux server when deployed.

@psethu01,

Thanks for the error logs.

  1. The issue may be related to how you are accessing the license. Ensure the license is being applied in a part of the code that doesn’t involve any distributed processing or multi-threading. Also, make sure the license file path is valid and accessible in Databricks. There should be no rights issue.

  2. Please test the code in a non-distributed or single-node environment in Databricks, which isolates the issue and helps determine if the distributed nature of Spark is causing conflicts. Consider breaking up the execution flow such that the license application is isolated from the main computation.

Hi @amjad.sahi ,

We verified that path was accessible and tried running just the license piece of the code in a single node cluster, we still are hit with the same error. any suggestions?

@psethu01
You mentioned that “the same license successfully works in our normal Linux server when deployed.” Therefore, we suggest that you focus on the differences between your current running environment and Linux. Additionally, ensure that you can access the Aspose.Cells Python product license normally in the current environment without using Databricks.

Furthermore, the Fatal Python error: Aborted mentioned in your logs is a critical issue that may relate to the runtime environment or the integration with Spark. To further troubleshoot, we recommend:

  1. Check the compatibility between Python and Spark to ensure the environment is correctly configured.
  2. Test in different Python environments (such as different versions of Python or non-Spark environments) to narrow down the issue.
  3. Examine your code to ensure that it does not access the license file in a multi-threaded or distributed manner.

Even without enabling spark, Since data bricks uses a cluster driven approach for running an application, how will the license work since the cluster will not be constant for every instance of the run.

@psethu01
Thank you for your feedback. We will further investigate your issue. We will get back to you soon.

@psethu01
Hello, In any case, if you are using or setting the license in a multi-threaded application, please ensure that the license code is only executed once and is executed first in the entire application lifecycle. Please check whether the license-setting code is being executed repeatedly and concurrently. If so, you should fix this issue.
could you please provide a detailed introduction of your runtime environment, including hardware information, OS, and installed software? Is it possible to set up a similar environment locally in single-machine mode to simulate and reproduce your issue?
We further analyzed your error message and found that the error may stem from a Socket connection issue (/usr/lib/python3.11/socket.py) or a Py4j communication failure. Therefore, we recommend ensuring that network communication is functioning properly, and also check if everything works fine without using Aspose.
Thank you!

Hi,

We tried running a single node environment hitting the same issue. The application runs fine if we dont call the license file and just use the aspose lib without it.

@psethu01,

It is quite unusual that the licensing issue persists even when setting the license in a single-node environment. Hopefully, you are not processing the licensing code repeatedly in your app. We will investigate this further and get back to you soon. But could you please also give us details about your runtime environment, including hardware information, OS, and installed software, etc.? Is it possible to set up a similar environment locally in single-machine mode on your end to simulate and reproduce your issue?

@psethu01
We have two ways to set the license: one is by using the file name, and the other is by using a stream. If you are currently using the first method, you can try the second method.

from aspose.cells import License
lic = License()
# Try to set license by lic file name
lic.set_license(yourPath + "Aspose.Cells.Pythonvia.NET.lic")
from aspose.cells import License
import io

# Try to set license from the stream.
lic = License()
lic_stream = io.FileIO("Aspose.Cells.Pythonvia.NET.lic")
lic.set_license(lic_stream)
lic_stream.close()

Hope helps a bit!

Could you please provide sample databricks Code

@psethu01,

See the example code below for reference:

from aspose.cells import License
import io

# Create License object
lic = License()

# Read license file from DBFS path
license_path = "/dbfs/FileStore/licenses/Aspose.Cells.Pythonvia.NET.lic"

# Use a stream to load the license
with open(license_path, "rb") as f:
    stream = io.BytesIO(f.read())

lic.set_license(stream)

when I am trying to run the above code I am getting the below error:
“Fatal error: The Python kernel is unresponsive.”
attaching the screenshot
macro error.jpg (99.2 KB)

@psethu01
It seems that Python does not work. Please remove all codes about Aspose.Cells and just simply call print(“Hello World”)

If I comment the license part, python code is working fine.
hello world.jpg (14.3 KB)

@psethu01
Thanks for your info. We will check it for databricks soon.

@psethu01
Hi!
First, please try using the Aspose library without loading the license file to verify whether the issue is truly related to the license.

from aspose.cells import  CellsHelper
print(CellsHelper.get_version())

If the problem still occurs, it may indicate an issue with the Aspose library itself, rather than just a license-related problem.

If the above code runs without issues, please try the following methods:

  1. Copy the license file to a local temporary directory (e.g., /tmp) and load it from there:
from aspose.cells import License  
lic = License()  
lic.set_license("/dbfs/tmp/Aspose.Cells.Pythonvia.NET.lic")
  1. Alternatively, use the DBFS API to read the license content, which may help bypass potential compatibility issues with distributed environments:
from aspose.cells import License  
import io  
license_content = dbutils.fs.head("dbfs:/FileStore/licenses/Aspose.Cells.Pythonvia.NET.lic", 10000)  
lic = License()  
lic.set_license(io.BytesIO(license_content.encode("utf-8")))

Additionally, regarding the error message “Fatal error: The Python kernel is unresponsive,” our research suggests that this is often caused by resource exhaustion.

Please also check your system’s resource usage (e.g., memory and CPU) for further insights.
Thank you!

I tried to running the below code

“from aspose.cells import CellsHelper
print(CellsHelper.get_version())”

It’s having a issue loading the Aspose Library .

aspose library error.jpg (23.5 KB)

@psethu01
I registered a user on Databricks and installed the latest version of aspose-cells-python (25.7) in a Notebook.
When I ran the code above, the result was as follows:
databricks.png (5.3 KB)

Could you please share how you are running the code on Databricks?
Is it possible that your setup—such as file system, cluster, or other configurations—is different from mine?
(As mentioned above, I simply registered, installed the package, and ran the code without any other setup.)