ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
608 stars 161 forks source link

Building wheel always fails #501

Closed skeletonyyy closed 1 week ago

skeletonyyy commented 12 months ago

I have been trying to install antspyx using PyCharm's package manager, and it kept failing when building the wheel. I then turned to installing it manually, but the problem persisted. I then tried cloning the github repo, changing Python versions (I tried 3.6, 3.9, and 3.11), using Conda, yet nothing is working. Here is the last lines that I think will be useful to identify the problem, but let me know if you need more!

C:\Users\Moi\AppData\Local\Temp\pip-install-0uys0kp3\antspyx_908e792c77cd4e168f30f56fc67277f4\ants\lib>cd .... Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Moi\AppData\Local\Programs\Python\Python311\Scripts\cmake.exe__main.py", line 4, in ModuleNotFoundError: No module named 'cmake' Configuring ITK No local ITK installation found... Building ITK now... Configuring ANTs core Configuring ANTsPy library Traceback (most recent call last): File "c:\users\moi\appdata\local\programs\python\python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "c:\users\moi\appdata\local\programs\python\python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\users\moi\appdata\local\programs\python\python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\build_meta.py", line 416, in build_wheel return self._build_with_temp_dir(['bdist_wheel'], '.whl', ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\build_meta.py", line 401, in _build_with_temp_dir self.run_setup() File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup self).run_setup(setup_script=setup_script) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 177, in File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\init__.py", line 107, in setup return distutils.core.setup(*attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 349, in run self.run_command("build") File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "", line 40, in run File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "C:\Users\Moi\AppData\Local\Temp\pip-build-env-_g_0bi7b\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "", line 102, in run File "c:\users\moi\appdata\local\programs\python\python311\Lib\subprocess.py", line 466, in check_output
return run(
popenargs, stdout=PIPE, timeout=timeout, check=True, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\users\moi\appdata\local\programs\python\python311\Lib\subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for antspyx Failed to build antspyx ERROR: Could not build wheels for antspyx, which is required to install pyproject.toml-based projects PS C:\Users\Moi\Documents\Assignments\CS463\A4\A4_py> pip install cmake Requirement already satisfied: cmake in c:\users\moi\appdata\local\programs\python\python311\lib\site-packages (3.27.1)

Steps to reproduce the behavior: With PyCharm:

  1. Click on 'Python Packages'
  2. Search 'antspyx' in search bar
  3. Select 'antspyc' from the list and click 'Install'
  4. Error: Failed building wheel for antspyx Manually with pip install:
  5. pip install antspyx
  6. Error: Failed building wheel for antspyx Manually with repo:
  7. git clone https://github.com/ANTsX/ANTsPy
  8. cd ANTsPy
  9. python3 setup.py install
  10. Error: Failed building wheel for antspyx

From what I understand, this looks like an issue with cmake, yet cmake looks fine. I have also installed setuptools-cmake (and setuptools only). I'm not sure what else I could be missing.

Desktop (please complete the following information):

In the meantime, I've been using ANTs with Ubuntu command line through WSL, but it would be really neat to use it with Python.

Thanks for your help!

skeletonyyy commented 11 months ago

So, this issue is still not fixed, but I found a workaround by using VS Code and WSL. It works fine there (apart from memory problem, but that's probably unrelated to ANTs), but it would be neat to be able to use it with PyCharm since I'm sure a few of us are used to that IDE for Python projects.

In other words, this issue is not as pressing as it was :)

nghuixin commented 5 months ago

What was the workaround you implemented? I have the same issue here where building the wheel fails Usign WSL (Ubuntu 22.04) on Windows 11 with Python 3.6.15

ncullen93 commented 5 months ago

From the error ModuleNotFoundError: No module named 'cmake' - you have to have cmake installed. Try this - https://cmake.org/download/

cookpa commented 1 week ago

Closing as the build process has been overhauled extensively. Wheels are available under the releases tab (pypi to follow)