pschanely / CrossHair

An analysis tool for Python that blurs the line between testing and type systems.
Other
1.04k stars 49 forks source link

Error installing CrossHair with Poetry under macOS 14.4.1 in Python 3.13 #319

Closed iusedmyimagination closed 1 week ago

iusedmyimagination commented 1 week ago

Our project's pyproject.toml file has:

[tool.poetry.dependencies]
[...]
crosshair-tool = "^0.0.77"
[...]

When installing with Poetry, we get the following error:

% poetry install --with dev
Installing dependencies from lock file

Package operations: 81 installs, 14 updates, 0 removals
[...]
  - Installing crosshair-tool (0.0.77): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  running bdist_wheel
  running build
  running build_py
  creating build/lib.macosx-11.0-arm64-cpython-313/crosshair
  copying crosshair/pure_importer.py -> build/lib.macosx-11.0-arm64-cpython-313/crosshair
[...]
  copying crosshair/_mark_stacks.h -> build/lib.macosx-11.0-arm64-cpython-313/crosshair
  running build_ext
  building '_crosshair_tracers' extension
  creating build/temp.macosx-11.0-arm64-cpython-313/crosshair
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /Users/renaud/miniforge3/envs/codeflash313/include -arch arm64 -fPIC -O2 -isystem /Users/renaud/miniforge3/envs/codeflash313/include -arch arm64 -I/var/folders/wg/xqtxrnxj7273nzvy7ncc2bj00000gn/T/tmp36pgaom_/.venv/include -I/Users/renaud/miniforge3/envs/codeflash313/include/python3.13 -c crosshair/_tracers.c -o build/temp.macosx-11.0-arm64-cpython-313/crosshair/_tracers.o
  In file included from crosshair/_tracers.c:22:
  crosshair/_mark_stacks.h:549:6: error: use of undeclared identifier 'FORMAT_VALUE'
      [FORMAT_VALUE] = 1,
       ^
  crosshair/_tracers.c:314:10: warning: variable 'ran_handler' set but not used [-Wunused-but-set-variable]
      BOOL ran_handler = FALSE;
           ^
  crosshair/_tracers.c:960:19: warning: unused variable 'code' [-Wunused-variable]
      PyCodeObject *code;
                    ^
  2 warnings and 1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1

  at ~/miniforge3/envs/codeflash313/lib/python3.13/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with crosshair-tool (0.0.77) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "crosshair-tool (==0.0.77)"'.
[...]

Running the specified command gives the same error:

% pip wheel --no-cache-dir --use-pep517 "crosshair-tool (==0.0.77)"
Collecting crosshair-tool==0.0.77
  Downloading crosshair-tool-0.0.77.tar.gz (448 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting packaging (from crosshair-tool==0.0.77)
[...]
Building wheels for collected packages: crosshair-tool
  Building wheel for crosshair-tool (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for crosshair-tool (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [201 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-11.0-arm64-cpython-313/crosshair
      copying crosshair/pure_importer.py -> build/lib.macosx-11.0-arm64-cpython-313/crosshair
[...]
      copying crosshair/_mark_stacks.h -> build/lib.macosx-11.0-arm64-cpython-313/crosshair
      running build_ext
      building '_crosshair_tracers' extension
      creating build/temp.macosx-11.0-arm64-cpython-313/crosshair
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /Users/renaud/miniforge3/envs/codeflash313/include -arch arm64 -fPIC -O2 -isystem /Users/renaud/miniforge3/envs/codeflash313/include -arch arm64 -I/Users/renaud/miniforge3/envs/codeflash313/include/python3.13 -c crosshair/_tracers.c -o build/temp.macosx-11.0-arm64-cpython-313/crosshair/_tracers.o
      In file included from crosshair/_tracers.c:22:
      crosshair/_mark_stacks.h:549:6: error: use of undeclared identifier 'FORMAT_VALUE'
          [FORMAT_VALUE] = 1,
           ^
      crosshair/_tracers.c:314:10: warning: variable 'ran_handler' set but not used [-Wunused-but-set-variable]
          BOOL ran_handler = FALSE;
               ^
      crosshair/_tracers.c:960:19: warning: unused variable 'code' [-Wunused-variable]
          PyCodeObject *code;
                        ^
      2 warnings and 1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for crosshair-tool
Failed to build crosshair-tool
ERROR: Failed to build one or more wheels

We get the same error in a similar GitHub Action, in Ubuntu.

iusedmyimagination commented 1 week ago

Same issue with pip install. No problem in Python 3.9, 3.10, 3.11 or 3.12.

pschanely commented 1 week ago

Thank you for the report!

I think the latest version I've attempted was 3.13rc2, and indeed, I can confirm that the final 3.13 release doesn't build. The build is easy enough to get functional, but looks like I've got a few test failures that I should investigate too. I'll report back in a day or two!

pschanely commented 1 week ago

@iusedmyimagination OK, 0.0.78 should install on 3.13 for you. (in fact, you probably should even get a binary wheel and not have to build anything)

i'll optimistically close this, but let me know how it goes either way!

iusedmyimagination commented 1 week ago

Thanks @pschanely, it installed with the binary wheel without any issues. Thank you for the quick turnaround and a wonderful tool!