googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.12k stars 691 forks source link

Failed building wheel for javabridge #4663

Open brainfo opened 4 days ago

brainfo commented 4 days ago

Describe the current behavior I'm with python 3.10. and Error when pip3 install javabridge --no-cache-dir:

  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for javabridge (setup.py) ... error
  ERROR: Failed building wheel for javabridge
  Running setup.py clean for javabridge
Failed to build javabridge
ERROR: Could not build wheels for javabridge, which is required to install pyproject.toml-based projects

I installed open-jdk version 8, 11 and 17 before pip install javabridge and set the JAVA_HOME and sys_path respectively but none of them worked.
I also downloaded the javabridge-1.0.19.tar.gz from pypi and python setup.py install still not working. And this gave more specific error messages:

_javabridge.c:27720:5: error: lvalue required as increment operand
27720 |     ++Py_REFCNT(o);
      |     ^~

On terminal, after soft link openjdk v8 v11 and v17 to /etc/alternatives/javac and /etc/alternatives/java then pip install also failed with the same ERROR: Failed building wheel for javabridge

Describe the expected behavior Smooth installation

What web browser you are using Chrome

Additional context Example:

sys.path.append('/usr/lib/jvm/java-17-openjdk-amd64/bin/')
os.environ["JAVA_HOME"] = '/usr/lib/jvm/java-17-openjdk-amd64/'
!apt-get install build-essential python3-dev
!apt-get install python3-pil python3-pygraphviz
!apt install openjdk-17-jdk
!pip3 install javabridge --no-cache-dir