GateNLP/python-gatenlp

Dependency mismatch

paulbriton opened this issue · 6 comments

I think there is an error with the new release. GatenlpWorker.java is pointing to the 3.0.8 gateplugin version (6915b60), and version 3.0.9-SNAPSHOT has been released (GateNLP/gateplugin-Python@7f66fc0).

Release process is unclear to me, so it might be normal, but I got error with the new version when I'm testing it locally.

I am not sure I understand your problem - could you please tell me which errors or problems you encounter?

Did you check the two commits I'm referring to? Is it okay to have two different versions?

When I'm calling saveDocumentToFile with the new version I got the error below.
Here is the version I'm testing:

Plugin Python version: 3.0.8 commit: 9392e9d dirty: false
Lib interaction version: 4.1 commit: 7819f1c dirty: false
Python gatenlp version: 1.0.8 commit: 5ce4023 dirty: false

Here is the error:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/dev/citemap/env/lib/python3.9/site-packages/py4j/java_gateway.py:1322 in __call__          │
│                                                                                                  │
│   1319 │   │   │   proto.END_COMMAND_PART                                                        │
│   1320 │   │                                                                                     │
│   1321 │   │   answer = self.gateway_client.send_command(command)                                │
│ ❱ 1322 │   │   return_value = get_return_value(                                                  │
│   1323 │   │   │   answer, self.gateway_client, self.target_id, self.name)                       │
│   1324 │   │                                                                                     │
│   1325 │   │   for temp_arg in temp_args:                                                        │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │       answer = 'xro3'                                                                        │ │
│ │         args = (                                                                             │ │
│ │                │   JavaObject id=o1,                                                         │ │
│ │                │                                                                             │ │
│ │                '/home/dev/citemap/var/22-11-10-document-export/isds.decision.24844.en.txt.x… │ │
│ │                │   'xml',                                                                    │ │
│ │                │   <repr-error 'Gateway is not connected.'>,                                 │ │
│ │                │   '',                                                                       │ │
│ │                │   True                                                                      │ │
│ │                )                                                                             │ │
│ │ args_command = 'ro1\ns/home/dev/citemap/var/22-11-10-document-export/isds.decision.24844.en… │ │
│ │      command = 'c\nt\nsaveDocumentToFile\nro1\ns/home/dev/citemap/var/22-11-10-document-exp… │ │
│ │         self = <py4j.java_gateway.JavaMember object at 0x7f94aec8edf0>                       │ │
│ │    temp_args = []                                                                            │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/dev/citemap/env/lib/python3.9/site-packages/py4j/protocol.py:326 in get_return_value       │
│                                                                                                  │
│   323 │   │   │   type = answer[1]                                                               │
│   324 │   │   │   value = OUTPUT_CONVERTER[type](answer[2:], gateway_client)                     │
│   325 │   │   │   if answer[1] == REFERENCE_TYPE:                                                │
│ ❱ 326 │   │   │   │   raise Py4JJavaError(                                                       │
│   327 │   │   │   │   │   "An error occurred while calling {0}{1}{2}.\n".                        │
│   328 │   │   │   │   │   format(target_id, ".", name), value)                                   │
│   329 │   │   │   else:                                                                          │
│                                                                                                  │
│ ╭────────────────────────────────── locals ───────────────────────────────────╮                  │
│ │         answer = 'xro3'                                                     │                  │
│ │ gateway_client = <py4j.java_gateway.GatewayClient object at 0x7f94aecbaee0> │                  │
│ │           name = 'saveDocumentToFile'                                       │                  │
│ │      target_id = 't'                                                        │                  │
│ │           type = 'r'                                                        │                  │
│ │          value = JavaObject id=o3                                           │                  │
│ ╰─────────────────────────────────────────────────────────────────────────────╯                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Py4JJavaError: <exception str() failed>

Unfortunately the error messages are truncated in this output, especially for the exception which shows "Gateway not connected"
I will have a look here as well.

The versions are as intended, for a released gatenlp version 1.0.x, there should be an equivalent release Python plugin version 3.0.x , development versions after the release are 3.0.9-SNAPSHOT and 1.0.9-dev0

OK, I tested this:

  • fresh install of gatenlp 1.0.9 using pip install gatenlp[java] requests
  • java version 1.8.0_265 on the path
  • python version 3.7.13 on the path
  • run the ptyhon code below
  • worked as expected

Code:

from gatenlp import Document
from gatenlp.gateworker import GateWorker

doc = Document("This is just a test document")
doc.annset().add(2,3,"Type1", features=dict(a=1, b=2))
with GateWorker() as gw:
    gdoc = gw.pdoc2gdoc(doc)
    gw.saveDocumentToFile(gdoc,"debug-doc-inline.xml", mimetype="text/xml")

Output:

Trying to start GATE Worker on port=25334 host=127.0.0.1 log=false keep=false
Process id is 2812548
CREOLE plugin loaded: creole 
CREOLE plugin loaded: Format: Bdoc 1.10
Plugin Python version: 3.0.8 commit: 9392e9d dirty: false
Lib interaction version: 4.1 commit: 7819f1c dirty: false
Python gatenlp version: 1.0.8 commit: 5ce4023 dirty: false
CREOLE plugin loaded: Python 3.0.8
PythonWorkerRunner.java: starting server with 25334/127.0.0.1/VML_bD-SmzTqlhsYJdHk_7C13bA/false
Java GatenlpWorker ENDING: 2812548

This shows that gatenlp release 1.0.8 is used with release 3.0.8 of the Python plugin as intended.

Could you please test the above simple code with your installation?

Could you please also share the Python and Java versions you are using? And maybe the full output of the errors you get?

Thanks a lot for your explanations on versions. You were right issue wasn't linked to the new release, it was on my side, I was not setting the mimetype parameter correctly. Sorry for bothering you!

Glad it works!