Issues installing python-javabridge

68 views
Skip to first unread message

Juan José Expósito González

unread,
Jan 12, 2024, 10:18:12 PMJan 12
to python-weka-wrapper
Hi! I have just submit an Issue in the github repo (sorry I think that was not the proper way to do it).


I am having problems installing python-javabridge and therefore python-weka-wrapper3. I would appreciate any help.

I have python 3.12, jdk-1.21 from open-jdk, Windows SDK...I have followed to the letter the process but I get the error:

$ pip install python-javabridge
Defaulting to user installation because normal site-packages is not writeable
Collecting python-javabridge
  Using cached python-javabridge-4.0.3.tar.gz (1.3 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Juanjo\AppData\Local\Temp\pip-install-216hqklm\python-javabridge_425fc86c9e654e6ab9185c0e433547f9\setup.py", line 412, in <module>
          ext_modules=ext_modules(),
                      ^^^^^^^^^^^^^
        File "C:\Users\Juanjo\AppData\Local\Temp\pip-install-216hqklm\python-javabridge_425fc86c9e654e6ab9185c0e433547f9\setup.py", line 120, in ext_modules
          p = subprocess.Popen(cmd)
              ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Peter Reutemann

unread,
Jan 12, 2024, 10:25:51 PMJan 12
to python-we...@googlegroups.com
Are you trying to install this through a native Windows shell
(cmd/powershell) or via WSL2?

BTW I'm not a Windows user.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, Hamilton, NZ
Mobile +64 22 190 2375
https://www.cs.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/

Juanjo

unread,
Jan 13, 2024, 1:12:11 PMJan 13
to python-we...@googlegroups.com
Hi Peter,

I have tried through a native shell and through the WSL Ubuntu, even the Docker image is not working for me.

I guess there is something to do with my system. I have also tried Jython console and calling weka from command line using java command.

I want to automate a batch processing rule extraction with ripper, prior to remove the attributes with a correlation with the target greater than a threshold (0.01) and using several seeds for the ripper. I am struggling to do it through the jython console, which for me would be ideal, since it uses Python but the weka part is still not clear. 

Also using docs but still new to this.

I appreciate your help.

Kindest Regards,

JJ

--
You received this message because you are subscribed to the Google Groups "python-weka-wrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-weka-wra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-weka-wrapper/CAHoQ12JYRczg%3Dvwy-90PTqbCft4e4SmLJvK-jpWHMwjJojQNfw%40mail.gmail.com.

Peter Reutemann

unread,
Jan 13, 2024, 3:14:14 PMJan 13
to python-we...@googlegroups.com
> I have tried through a native shell and through the WSL Ubuntu, even the Docker image is not working for me.

Docker will only work through WSL2 as it is based on a Linux base image.

Try setting up a Python virtual environment in your WSL2:

python3 -m venv venv
./venv/bin/pip install numpy
./venv/bin/pip install python-javabridge
./venv/bin/pip install python-weka-wrapper3

Then run this command:
./venv/bin/pww-classifier -h

Which should output something like this:
usage: pww-classifier [-h] [-j classpath] [-X heap] -t train [-T test]
[-c class index]
[-d outmodel] [-l inmodel] [-x num folds] [-s
seed] [-v] [-o] [-i] [-k]
[-m costmatrix] [-g graph]
classifier ...

Performs classification/regression from the command-line. Calls JVM
start/stop automatically.
...

> I guess there is something to do with my system. I have also tried Jython console and calling weka from command line using java command.

Syntax between pww3 and Jython will be different. In the former you
are running a Python 3 process that communicates with a JVM via JNI
and in the latter your staying in the same JVM process using Python
2.7 like syntax to directly access the Weka objects.

> I want to automate a batch processing rule extraction with ripper, prior to remove the attributes with a correlation with the target greater than a threshold (0.01) and using several seeds for the ripper. I am struggling to do it through the jython console, which for me would be ideal, since it uses Python but the weka part is still not clear.

I presume that you want to use the following classifier?
weka.classifiers.rules.JRip
https://weka.sourceforge.io/doc.dev/weka/classifiers/rules/JRip.html

Juan José Expósito González

unread,
Jan 13, 2024, 6:02:37 PMJan 13
to python-weka-wrapper
Hi Peter, already solved. Have mixed up Python versions. I was using Python 3.11 and python-javabridge is for 3.10. I installed it back, created the env and now everything is working fine. One question. I had to install with pip weka package...

You were right, I want to run JRip. I am now into the docs to get the options passed and run the classifier.

Many thanks!

JJ

Reply all
Reply to author
Forward
0 new messages