pmneila / PyMCubes

Marching cubes (and related tools) for Python
BSD 3-Clause "New" or "Revised" License
692 stars 87 forks source link

numpy version problem #49

Closed Ice-Tear closed 1 month ago

Ice-Tear commented 1 month ago

Thank you very much for this great work. I encountered a version issue with numpy while building in building PyMcubes. I resolved the issue by changing the numpy version in the pyproject.toml file from numpy~=2.0 to numpy>=1.21. The modified pyproject.toml file looks like this: [build-system] requires = ["setuptools", "wheel", "Cython", "numpy>=1.21"] build-backend = "setuptools.build_meta"

Is there a potential version issue with doing this? I haven't found any problems so far with the marching cube method.

pmneila commented 1 month ago

Hi, @Ice-Tear,

The latest version of pymcubes added support for NumPy 2.0 and requires NumPy 2.0 to build. In any case, it should support older versions of NumPy as well, so you shouldn't have any problems (at least for Python>3.8). What issues did you find?

If you are using older versions of Python, you can simply use version 0.1.4 of pymcubes, which does not have support for NumPy 2.0 but does support Python 3.6-3.8. Otherwise, the library itself is basically the same.

Ice-Tear commented 1 month ago

Hi, @pmneila , My python version is 3.8.19, and numpy version is 1.24.3. When I used the command pip install --upgrade PyMCubes to install the PyMcubes, I encountered the following issue.

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting PyMCubes
  Using cached https://mirrors.aliyun.com/pypi/packages/df/fb/8660bc09b05e5b7209377a476e937f36c2e4353a5300e6c71283fd6f8c2b/pymcubes-0.1.6.tar.gz (109 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
      Collecting setuptools
        Using cached https://mirrors.aliyun.com/pypi/packages/ef/15/88e46eb9387e905704b69849618e699dc2f54407d8953cc4ec4b8b46528d/setuptools-70.3.0-py3-none-any.whl (931 kB)
      Collecting wheel
        Using cached https://mirrors.aliyun.com/pypi/packages/7d/cd/d7460c9a869b16c3dd4e1e403cce337df165368c71d6af229a74699622ce/wheel-0.43.0-py3-none-any.whl (65 kB)
      Collecting Cython
        Using cached https://mirrors.aliyun.com/pypi/packages/3a/ac/18d413580ac61a88f3725c5b6eb73c651495f1b6a5631be211514ac8aa0c/Cython-3.0.10-cp38-cp38-win_amd64.whl (2.8 MB)
      ERROR: Ignored the following versions that require a different python version: 1.25.0 Requires-Python >=3.9; 1.25.0rc1 Requires-Python >=3.9; 1.25.1 Requires-Python >=3.9; 1.25.2 Requires-Python >=3.9; 1.26.0 Requires-Python <3.13,>=3.9; 1.26.0b1 Requires-Python <3.13,>=3.9; 1.26.0rc1 Requires-Python <3.13,>=3.9; 1.26.1 Requires-Python <3.13,>=3.9; 1.26.2 Requires-Python >=3.9; 1.26.3 Requires-Python >=3.9; 1.26.4 Requires-Python >=3.9; 2.0.0 Requires-Python >=3.9; 2.0.0b1 Requires-Python >=3.9; 2.0.0rc1 Requires-Python >=3.9; 2.0.0rc2 Requires-Python >=3.9
      ERROR: Could not find a version that satisfies the requirement numpy~=2.0 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0rc1, 1.24.0rc2, 1.24.0, 1.24.1, 1.24.2, 1.24.3, 1.24.4)
      ERROR: No matching distribution found for numpy~=2.0
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies 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.

I think the problem should be in the pyproject.toml file, so by changing the numpy version from ~=2.0 to >=1.21 in that file, I resolved the problem. I think that if I install PyMcubes in python3.8 using the pip install --upgrade PyMCubes, the default version installed should be 0.1.6. As you suggested, I will manually install version 0.1.4 in the future. I will close this issue.