Skip to content

Python 3.13 #516

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

Open
raphaelauv opened this issue Oct 15, 2024 · 9 comments
Open

Python 3.13 #516

raphaelauv opened this issue Oct 15, 2024 · 9 comments

Comments

@raphaelauv
Copy link

hi , some wheels for Python package https://pypi.org/project/google-re2/ for Python 3.13 would help a lot , thanks all 👍

@raphaelauv
Copy link
Author

when I try to build, I hit the error

2.598       /usr/local/include/python3.13/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
2.598          22 | typedef struct _frame PyFrameObject;
2.598             |                ^~~~~~
2.598       error: command '/usr/bin/g++' failed with exit code 1
2.598       [end of output]

@andife
Copy link

andife commented Oct 19, 2024

I am also very interested in a python 3.13 compatible release. Could you share the whole error log?

@xceberg3058
Copy link

I am also very interested in a python 3.13 compatible release for google-re2, Thanks !

@andersk
Copy link

andersk commented Oct 21, 2024

It already builds fine with sufficiently recent versions of dependencies (Abseil, pybind11, re2). For example, on Ubuntu 24.10:

$ docker run --pull=always --rm -it ubuntu:24.10
root@229a132a6b4a:/# apt update
root@229a132a6b4a:/# apt install -y --no-install-recommends g++ libabsl-dev libre2-dev pybind11-dev python3.13-dev python3.13-venv
root@229a132a6b4a:/# python3.13 -m venv venv
root@229a132a6b4a:/# . venv/bin/activate
(venv) root@229a132a6b4a:/# pip install google-re2
Collecting google-re2
  Downloading google_re2-1.1.20240702.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: google-re2
  Building wheel for google-re2 (pyproject.toml) ... done
  Created wheel for google-re2: filename=google_re2-1.1.20240702-cp313-cp313-linux_x86_64.whl size=1663356 sha256=18a2878c8b22afdae98eb66ab95745fa045658fa3a01dc51fa686ea7f28269e0
  Stored in directory: /root/.cache/pip/wheels/8e/ee/2d/36f51c4a17497ae98352ac575d982f06706dbb917a9ce66c69
Successfully built google-re2
Installing collected packages: google-re2
Successfully installed google-re2-1.1.20240702
(venv) root@229a132a6b4a:/# python
Python 3.13.0 (main, Oct  7 2024, 21:58:50) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re2
>>> re2.match("a?" * 26 + "a" * 26, "a" * 26)
<re2._Match object at 0x7fab72a60ae0>

All we need are binary wheels for Python 3.13 so it works on every typical platform. Opened https://code-review.googlesource.com/c/re2/+/63490.

@raphaelauv
Copy link
Author

raphaelauv commented Oct 21, 2024

yes, this work

FROM ubuntu:24.10

RUN  apt-get update \
  && apt install -y --no-install-recommends g++ libabsl-dev libre2-dev pybind11-dev python3.13-dev python3-pip \
  && rm -rf /var/lib/apt/lists/*

RUN python3.13 -m pip install google-re2 --break-system-packages

@lorenzogatti
Copy link

Requiring Windows users to install Abseil (and, I assume, PyBind11) on their own is very nonstandard and very impractical.
Isn't it possible to put everything needed in the PyPI package? Binary wheels would be, of course, even better.
The following is a pathetic installation attempt with Windows 10 and Python 3.13:


>pip install google-re2
Collecting google-re2
  Downloading google_re2-1.1.20240702.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: google-re2
  Building wheel for google-re2 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for google-re2 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-313\re2
      copying re2\__init__.py -> build\lib.win-amd64-cpython-313\re2
      running build_ext
      building '_re2' extension
      creating build\temp.win-amd64-cpython-313\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Python\include -IC:\Python\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tp_re2.cc /Fobuild\temp.win-amd64-cpython-313\Release\_re2.obj -fvisibility=hidden
      cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'
      _re2.cc
      _re2.cc(15): fatal error C1083: Cannot open include file: 'absl/strings/string_view.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for google-re2
Failed to build google-re2
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (google-re2)

@potiuk
Copy link

potiuk commented Feb 23, 2025

Is it possible to have a release of google-re2 with Python 3.13 support? This is a huge blocker for Airflow Python 3.13 support - we are very seriously considering removal of google-re2 from our dependencies apache/airflow#46891

@bogdandm
Copy link

bogdandm commented Mar 19, 2025

yes, this work

FROM ubuntu:24.10

RUN apt-get update
&& apt install -y --no-install-recommends g++ libabsl-dev libre2-dev pybind11-dev python3.13-dev python3-pip
&& rm -rf /var/lib/apt/lists/*

RUN python3.13 -m pip install google-re2 --break-system-packages

Hello, I'm trying to install it on ubuntu24.04 (LTS) and it gives a lot of c++ errors. I tried to compile Abseil and PyBind from sources but it didn't help unfortunately

FROM ubuntu:24.04

ENV ROOT_PATH="/builds/project" \
    BUILD_DIR="/build/project" \
    VIRTUAL_ENV="/tv"

ARG DEBIAN_FRONTEND=noninteractive

RUN mkdir -p $BUILD_DIR
WORKDIR $BUILD_DIR
RUN apt-get update \
    && apt-get install -y software-properties-common curl git \
    && add-apt-repository ppa:deadsnakes/ppa \
    && apt-get update  \
    && apt-get install -y --no-install-recommends \
        build-essential \
        libabsl-dev \
        libre2-dev \
        pybind11-dev \
	    python3.13-dev \
	    python3.13-venv \
        g++ cmake make \
    && curl -s -L https://bootstrap.pypa.io/get-pip.py | python3.13

#RUN git clone https://github.com/abseil/abseil-cpp.git && cd abseil-cpp && mkdir build && cd build && cmake .. && make && make install && cd $BUILD_DIR
#RUN python3.8 -m pip install pytest && git clone https://github.com/pybind/pybind11.git && cd pybind11 && mkdir build && cd build && cmake .. && make && make install && cd $BUILD_DIR

RUN python3.13 -m venv --copies . \
    && . bin/activate \
    && pip install google-re2

And log:

#8 2.500 Collecting google-re2
#8 2.712   Downloading google_re2-1.1.20240702.tar.gz (11 kB)
#8 2.727   Installing build dependencies: started
#8 4.542   Installing build dependencies: finished with status 'done'
#8 4.543   Getting requirements to build wheel: started
#8 4.673   Getting requirements to build wheel: finished with status 'done'
#8 4.674   Preparing metadata (pyproject.toml): started
#8 4.810   Preparing metadata (pyproject.toml): finished with status 'done'
#8 4.813 Building wheels for collected packages: google-re2
#8 4.814   Building wheel for google-re2 (pyproject.toml): started
#8 6.972   Building wheel for google-re2 (pyproject.toml): finished with status 'error'
#8 6.985   error: subprocess-exited-with-error
#8 6.985   
#8 6.985   × Building wheel for google-re2 (pyproject.toml) did not run successfully.
#8 6.985   │ exit code: 1
#8 6.985   ╰─> [110 lines of output]
#8 6.985       running bdist_wheel
#8 6.985       running build
#8 6.985       running build_py
#8 6.985       creating build/lib.linux-x86_64-cpython-313/re2
#8 6.985       copying re2/__init__.py -> build/lib.linux-x86_64-cpython-313/re2
#8 6.985       running build_ext
#8 6.985       building '_re2' extension
#8 6.985       creating build/temp.linux-x86_64-cpython-313
#8 6.985       x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -g -fwrapv -O2 -fPIC -I/build/project/include -I/usr/include/python3.13 -c _re2.cc -o build/temp.linux-x86_64-cpython-313/_re2.o -fvisibility=hidden
#8 6.985       _re2.cc: In function ‘std::vector<std::pair<long int, long int> > re2_python::RE2MatchShim(const re2::RE2&, re2::RE2::Anchor, pybind11::buffer, ssize_t, ssize_t)’:
#8 6.985       _re2.cc:132:19: error: cannot convert ‘absl::debian3::string_view’ to ‘const re2::StringPiece&’
#8 6.985         132 |   if (!self.Match(text, pos, endpos, anchor, groups.data(), groups.size())) {
#8 6.985             |                   ^~~~
#8 6.985             |                   |
#8 6.985             |                   absl::debian3::string_view
#8 6.985       In file included from /usr/include/re2/filtered_re2.h:28,
#8 6.985                        from _re2.cc:21:
#8 6.985       /usr/include/re2/re2.h:572:33: note:   initializing argument 1 of ‘bool re2::RE2::Match(const re2::StringPiece&, size_t, size_t, Anchor, re2::StringPiece*, int) const’
#8 6.985         572 |   bool Match(const StringPiece& text,
#8 6.985             |              ~~~~~~~~~~~~~~~~~~~^~~~
#8 6.985       _re2.cc: In function ‘pybind11::bytes re2_python::RE2QuoteMetaShim(pybind11::buffer)’:
#8 6.985       _re2.cc:155:25: error: cannot convert ‘absl::debian3::string_view’ to ‘const re2::StringPiece&’
#8 6.985         155 |   return RE2::QuoteMeta(pattern);
#8 6.985             |                         ^~~~~~~
#8 6.985             |                         |
#8 6.985             |                         absl::debian3::string_view
...
#8 6.985   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 6.986   ERROR: Failed building wheel for google-re2
#8 6.986 Failed to build google-re2

Any ideas on how to make this works?

@potiuk
Copy link

potiuk commented Mar 19, 2025

Any ideas on how to make this works?

BTW. We just got rid of google-re2 from our codebase in Airflow, becuse we did not want neither us nor our users to have to deal with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants