pythonjavavisual-c++pipjpype

Trying to install JPype1 but getting errors: cl.exe' failed with exit code 2


Im trying to install JPype1 but i keep getting this:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for JPype1
Failed to build JPype1
ERROR: Could not build wheels for JPype1, which is required to install pyproject.toml-based projects

I'm running on Python 3.12.0

Visual Studio 2022 Developer Command Prompt v17.8.3

and pip 23.3.1

Please help :( i need it for an assignment

I tried using

pip install --upgrade pip setuptools

and the outcome was:

WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in 'C:\Users\xxx\AppData\Roaming\Python\Python312\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.3.2 setuptools-69.0.2

I try downloading JPype1 again and the output was:

Defaulting to user installation because normal site-packages is not writeable
Collecting JPype1
  Using cached JPype1-1.4.1.tar.gz (797 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: packaging in c:\users\xxx\appdata\roaming\python\python312\site-packages (from JPype1) (23.2)
Building wheels for collected packages: JPype1
  Building wheel for JPype1 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for JPype1 (pyproject.toml) did not run successfully.

Solution

  • Unfortunately, jype1 is only supported till python 3.10 yet.

    https://pypi.org/project/JPype1/#:~:text=JPype%20is%20a%20Python%20module,scientific%20computing%2C%20and%20much%20more.

    You need to downgrade your python to 3.10 or less.

    enter image description here