openapi2jsonschema icon indicating copy to clipboard operation
openapi2jsonschema copied to clipboard

Fix installation on modern Python versions

Open artob opened this issue 7 months ago • 1 comments

This package no longer installs as of May 2025 and Python 3.13.2:

$ pip install openapi2jsonschema
...
Collecting pyyaml<6.0,>=5.1 (from openapi2jsonschema)
  Downloading PyYAML-5.4.1.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [65 lines of output]
...
      AttributeError: cython_sources
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build 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.

The workaround is as follows:

pip install "cython<3.0.0" wheel
pip install setuptools
pip install "pyyaml==5.4.1" --no-build-isolation
pip install openapi2jsonschema
openapi2jsonschema --help

Or better yet, use uv to sandbox all the preceding in a dedicated venv:

uv init
uv pip install "cython<3.0.0" wheel
uv pip install setuptools
uv pip install "pyyaml==5.4.1" --no-build-isolation
uv pip install openapi2jsonschema
uv run openapi2jsonschema --help

artob avatar May 14 '25 07:05 artob

I had the same issue, thanks so much for the workaround 🥰

reiinoldo avatar Jun 19 '25 16:06 reiinoldo