Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.12 #135

Closed
jbeirer opened this issue Jan 4, 2024 · 11 comments · Fixed by #136
Closed

Add support for Python 3.12 #135

jbeirer opened this issue Jan 4, 2024 · 11 comments · Fixed by #136
Labels
dependencies Pull requests that update a dependency file

Comments

@jbeirer
Copy link

jbeirer commented Jan 4, 2024

It would be great to add Python 3.12 support in the near future. Currently installs fail for me with:

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  /tmp/tmptbzg1t85/.venv/lib/python3.12/site-packages/setuptools_scm/git.py:308: UserWarning: git archive did not support describe output
    warnings.warn("git archive did not support describe output")
  /tmp/tmptbzg1t85/.venv/lib/python3.12/site-packages/setuptools_scm/git.py:327: UserWarning: unprocessed git archival found (no export subst applied)
    warnings.warn("unprocessed git archival found (no export subst applied)")
  *** scikit-build-core 0.7.1 using CMake 3.28.1 (wheel)
  *** Configuring CMake...
  loading initial cache file /tmp/tmp4t3tkzsh/build/CMakeInit.txt
  -- The C compiler identification is GNU 10.2.1
  -- The CXX compiler identification is GNU 10.2.1
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Setting build type to 'Release'
  -- Found Python: /tmp/tmptbzg1t85/.venv/bin/python (found version "3.12.0") found components: Interpreter Development.Module 
  -- Performing Test HAS_FLTO
  -- Performing Test HAS_FLTO - Success
  -- Found pybind11: /tmp/tmptbzg1t85/.venv/lib/python3.12/site-packages/pybind11/include (found version "2.11.1")
  CMake Warning (dev) at cmake/modules/FindPythonExtensions.cmake:247 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.
  
  Call Stack (most recent call first):
    CMakeLists.txt:33 (find_package)
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  -- Found PythonInterp: /tmp/tmptbzg1t85/.venv/bin/python (found version "3.12") 
  CMake Warning (dev) at cmake/modules/FindPythonExtensions.cmake:248 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.
  
  Call Stack (most recent call first):
    CMakeLists.txt:33 (find_package)
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  -- Found PythonLibs: /usr/local/lib/libpython3.12.so (found version "3.12.0") 
  -- Found Cython: /tmp/tmptbzg1t85/.venv/bin/cython  
  CMake Error at CMakeLists.txt:37 (find_package):
    By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "CGAL", but
    CMake did not find one.
  
    Could not find a package configuration file provided by "CGAL" (requested
    version 5.0) with any of the following names:
  
      CGALConfig.cmake
      cgal-config.cmake
  
    Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
    "CGAL_DIR" to a directory containing one of the above files.  If "CGAL"
    provides a separate development package or SDK, be sure it has been
    installed.
  
  
  -- Configuring incomplete, errors occurred!
  
  *** CMake configuration failed
  

  at /usr/local/py-utils/venvs/poetry/lib/python3.12/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 pyg4ometry (1.1.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pyg4ometry (==1.1.2)"'.```
@gipert gipert added the dependencies Pull requests that update a dependency file label Jan 5, 2024
@gipert
Copy link
Member

gipert commented Jan 5, 2024

I have tried enabling 3.12 builds in our CI:

https://github.com/g4edge/pyg4ometry/actions/runs/7423609080/job/20201409008?pr=136

The package seems to build without failures, but something goes wrong during tests. Will need to debug locally. Your build is failing because of a missing/misconfigured CGAL installation (see CMake error message). Which Linux distribution are you on? How did you install the dependencies required to build the package?

As for PyPI builds, cbuildwheel was supposed to build 3.12 wheels, but it didn't for same unknown reason.

@gipert
Copy link
Member

gipert commented Jan 5, 2024

Update: Python 3.12 tests seem to fail because of dateutil/dateutil#1314, so there's nothing we can do about it until they fix it.

Good news is that pyg4ometry seems to be fully Python 3.12 ready.

@jbeirer
Copy link
Author

jbeirer commented Jan 6, 2024

Hi @gipert,

thanks for the quick response. Indeed, the issue seems to come from the missing PyPi builds (see jbeirer/pygeosimplify#67). As the list of dependencies required to build pyg4ometry is quite large, I'll wait for the pre-built py312 wheels instead of trashing my CI :)

Thanks!

@stewartboogert
Copy link
Member

@jbeirer,
Should be very straightforward to install the required dependencies. CGAL, GMP, MPFR, OpenCASCADE, Vtk. But waiting is also fine.

@gipert
I'll test what is going on with python3.12 today

@stewartboogert
Copy link
Member

@gipert

Running pytest with python3.12. The failure is

ERROR test_pyoce.py - DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware...

Now this is imported via a package we must depend on. So really there is not fixing this until the packages we depend on update. I think the best thing to do is

pytest -W ignore::DeprecationWarning

To get the CI to release a 3.12 version.

@gipert
Copy link
Member

gipert commented Jan 6, 2024

I'm a bit uncomfortable with ignoring deprecation warnings, they are important for development and I'm afraid we would forget about removing this "temporary ignore" once a new version of dateutil is released. I would just ignore the CI failure instead, I'm sure it will fix by itself soon.

More importantly, I think I have figured out why cbuildwheel did not build python-3.12 wheels for v1.1.2: we were still using an old version at that point:

https://github.com/g4edge/pyg4ometry/actions/runs/7378413766/job/20073504830#step:4:1

So I'm rather sure it will upload 3.12 wheels to PyPI, if we make a new release now.

@stewartboogert
Copy link
Member

I love cutting corners ;-) Ok agreed with you @gipert

Having said this, the apple silicon library deps might have been resolved in the more recent cibuildwheel versions

@gipert
Copy link
Member

gipert commented Jan 6, 2024

I'll tag a new version now, let's see what happens.

@stewartboogert
Copy link
Member

Looks like there is now a problem with upload-artifact it might be work moving back to v3.

actions/upload-artifact#478

@gipert
Copy link
Member

gipert commented Jan 8, 2024

Actually, the problem seems to be that Python 3.12 is not available in the manylinux container we use to build wheels on Linux. I don't understand why, I have also tried updating it. I'll try to have a look into it.

@gipert
Copy link
Member

gipert commented Jan 8, 2024

Python 3.12 wheels should hopefully appear soon on PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants