Skip to content

Support for Python >3.11 #149

Open
Open

Description

@pylipp

Hej team,
Python 3.12 was released a year ago, and Python 3.13 just some days ago.

Judging from the Readme, and issues like #142 and #144 , the profiler can only be used in Python versions up to 3.11.

What are the plans to support newer Python versions? How can the community contribute to make this package compatible @aabmass ?

Thanks for the heads-up 🙏

For reference:
https://docs.python.org/3/whatsnew/3.12.html#c-api-changes

Activity

  1. ysk24ok commented on Mar 18, 2025

    @ysk24ok

    Building a wheel for 4.1.0 (latest as of now) fails with Python 3.13.

    % docker run --rm -it python:3.13.2 /bin/bash
    root@74042e43e532:/# pip3 install google-cloud-profiler
    ...
    Building wheels for collected packages: google-cloud-profiler
      Building wheel for google-cloud-profiler (pyproject.toml) ... error
      error: subprocess-exited-with-error
    
      × Building wheel for google-cloud-profiler (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [59 lines of output]
          running bdist_wheel
          running build
          running build_py
          creating build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/cpu_profiler.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/profile_pb2.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/builder.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/pythonprofiler.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/backoff.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/__init__.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/__version__.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          copying googlecloudprofiler/client.py -> build/lib.linux-x86_64-cpython-313/googlecloudprofiler
          running build_ext
          building 'googlecloudprofiler._profiler' extension
          creating build/temp.linux-x86_64-cpython-313/googlecloudprofiler/src
          g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -Igooglecloudprofiler/src -I/usr/local/include/python3.13 -c googlecloudprofiler/src/_profiler.cc -o build/temp.linux-x86_64-cpython-313/googlecloudprofiler/src/_profiler.o -std=c++11
          In file included from googlecloudprofiler/src/profiler.h:26,
                           from googlecloudprofiler/src/_profiler.cc:18:
          googlecloudprofiler/src/stacktraces.h: In member function ‘void AsyncSafeTraceMultiset::Reset()’:
          googlecloudprofiler/src/stacktraces.h:72:24: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct AsyncSafeTraceMultiset::TraceData’ with no trivial copy-assignment; use value-initialization instead [-Wclass-memaccess]
             72 |   void Reset() { memset(traces_, 0, sizeof(traces_)); }
                |                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          googlecloudprofiler/src/stacktraces.h:89:10: note: ‘struct AsyncSafeTraceMultiset::TraceData’ declared here
             89 |   struct TraceData {
                |          ^~~~~~~~~
          g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -Igooglecloudprofiler/src -I/usr/local/include/python3.13 -c googlecloudprofiler/src/clock.cc -o build/temp.linux-x86_64-cpython-313/googlecloudprofiler/src/clock.o -std=c++11
          g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -Igooglecloudprofiler/src -I/usr/local/include/python3.13 -c googlecloudprofiler/src/log.cc -o build/temp.linux-x86_64-cpython-313/googlecloudprofiler/src/log.o -std=c++11
          googlecloudprofiler/src/log.cc: In function ‘void Log(const char*, const char*, ...)’:
          googlecloudprofiler/src/log.cc:27:43: warning: ‘PyObject* PyImport_ImportModuleNoBlock(const char*)’ is deprecated [-Wdeprecated-declarations]
             27 |     logging = PyImport_ImportModuleNoBlock("logging");
                |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
          In file included from /usr/local/include/python3.13/Python.h:128,
                           from googlecloudprofiler/src/log.cc:17:
          /usr/local/include/python3.13/import.h:54:44: note: declared here
             54 | Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
                |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -Igooglecloudprofiler/src -I/usr/local/include/python3.13 -c googlecloudprofiler/src/populate_frames.cc -o build/temp.linux-x86_64-cpython-313/googlecloudprofiler/src/populate_frames.o -std=c++11
          In file included from googlecloudprofiler/src/populate_frames.h:6,
                           from googlecloudprofiler/src/populate_frames.cc:1:
          googlecloudprofiler/src/stacktraces.h: In member function ‘void AsyncSafeTraceMultiset::Reset()’:
          googlecloudprofiler/src/stacktraces.h:72:24: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct AsyncSafeTraceMultiset::TraceData’ with no trivial copy-assignment; use value-initialization instead [-Wclass-memaccess]
             72 |   void Reset() { memset(traces_, 0, sizeof(traces_)); }
                |                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          googlecloudprofiler/src/stacktraces.h:89:10: note: ‘struct AsyncSafeTraceMultiset::TraceData’ declared here
             89 |   struct TraceData {
                |          ^~~~~~~~~
          googlecloudprofiler/src/populate_frames.cc: In function ‘_PyInterpreterFrame* unsafe_PyThreadState_GetInterpreterFrame(PyThreadState*)’:
          googlecloudprofiler/src/populate_frames.cc:32:36: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘cframe’
             32 |   _PyInterpreterFrame *f = tstate->cframe->current_frame;
                |                                    ^~~~~~
          googlecloudprofiler/src/populate_frames.cc: In function ‘PyCodeObject* unsafe_PyInterpreterFrame_GetCode(_PyInterpreterFrame*)’:
          googlecloudprofiler/src/populate_frames.cc:49:31: error: ‘_PyInterpreterFrame’ {aka ‘struct _PyInterpreterFrame’} has no member named ‘f_code’
             49 |   PyCodeObject *code = frame->f_code;
                |                               ^~~~~~
          googlecloudprofiler/src/populate_frames.cc: In function ‘int _PyInterpreterFrame_GetLine(_PyInterpreterFrame*)’:
          googlecloudprofiler/src/populate_frames.cc:73:34: error: ‘_PyInterpreterFrame’ {aka ‘struct _PyInterpreterFrame’} has no member named ‘f_code’
             73 |   return PyCode_Addr2Line(frame->f_code, addr);
                |                                  ^~~~~~
          error: command '/usr/bin/g++' 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 google-cloud-profiler
    Failed to build google-cloud-profiler
    
    [notice] A new release of pip is available: 24.3.1 -> 25.0.1
    [notice] To update, run: pip install --upgrade pip
    ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (google-cloud-profiler)
    
  2. rahul-roy-glean commented on Nov 5, 2025

    @rahul-roy-glean

    while i have very less hope of this going through - #150 , maybe someone can benefit from taking this and vendoring a wheel themselves

  3. didier-viboo commented on Nov 5, 2025

    @didier-viboo

    Maybe the best thing would be to write some adapter to connect the new Python 3.15 profiler to the GCP profile collection infrastructure, and ditch this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions