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

FIX: change c includes to account for upstream changes #4428

Merged
merged 3 commits into from
Oct 31, 2021

Conversation

tacaswell
Copy link
Contributor

python/cpython#28968 / 8e5de40f90476249e9a2e5ef135143b5c6a0b512 which is part of implementing https://bugs.python.org/issue35134 moved the header "longintrepr.h" into a sub-folder. The notes on this change suggested to include "Python.h" instead.

@da-woods
Copy link
Contributor

I think this needs #if PY_VERSION_HEX guards, at least for Python 2.7

For the pxd file the easiest way to do that is

cdef extern from *:
    """"
    #if PY_VERSION_HEX >= 0x03000000
     #include "xx"
    #else
     #include "yy"
    #endif
    """
    ... # contents as before...

python/cpython#28968 /
8e5de40f90476249e9a2e5ef135143b5c6a0b512 which is part of implementing
https://bugs.python.org/issue35134 moved the header "longintrepr.h" into a
sub-folder.  The notes on this change suggested to include "Python.h" instead.
tests/compile/pylong.pyx Outdated Show resolved Hide resolved
tests/compile/pylong.pyx Outdated Show resolved Hide resolved
Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we're essentially saying here is "we always need Python.h anyway, but in Py2.7, we also need longintrepr.h". Let's spell it that way.

tests/compile/pylong.pyx Outdated Show resolved Hide resolved
Cython/Utility/ModuleSetupCode.c Outdated Show resolved Hide resolved
Cython/Includes/cpython/longintrepr.pxd Outdated Show resolved Hide resolved
tests/compile/pylong.pyx Outdated Show resolved Hide resolved
@tacaswell
Copy link
Contributor Author

The failures appears to be exttype_total_ordering.ExtTypeTotalOrderingNeGt, but I do not have a OSX machine to debug on.

@da-woods
Copy link
Contributor

ExtTypeTotalOrderingNeGt

I think that's a pre-existing failure on the master branch

@scoder scoder merged commit 60ec08b into cython:master Oct 31, 2021
@scoder
Copy link
Contributor

scoder commented Oct 31, 2021

Thanks.

@scoder scoder added this to the 0.29.25 milestone Oct 31, 2021
scoder pushed a commit that referenced this pull request Oct 31, 2021
…H-4428)

See python/cpython#28968
which is part of implementing
https://bugs.python.org/issue35134
moved the header "longintrepr.h" into a sub-folder.
The notes on this change suggested to include "Python.h" instead.
@scoder
Copy link
Contributor

scoder commented Oct 31, 2021

0.29.x: 0f7bd0d

miku added a commit to miku/siskin that referenced this pull request Jan 5, 2023
fedora 37 uses python 3.11 and pycld (https://pypi.org/project/pycld3/)
only provides wheels for 3.6-3.9. When building pycld3, we ran into

> fatal error: longintrepr.h: No such file or directory

which seems to have been addressed in cython (cython/cython#4428);
we need to install some additional packages and USE_CYTHON=1 pip ... in
order for the build on the target machine to succeed.
@l1x
Copy link

l1x commented Mar 21, 2023

What is the workaround?

@scoder
Copy link
Contributor

scoder commented Mar 21, 2023

What is the workaround?

The best "work-around" is probably to use the latest Cython releases.

@l1x
Copy link

l1x commented Mar 22, 2023

What is the workaround?

The best "work-around" is probably to use the latest Cython releases.

Let me be a bit more precise. I have a Debian 12 server and I would like to use Python 3.11. What is the workaround that I can use to have Python 3.11 without compiling Python myself? Is there a way to install longintrepr.h?

@tacaswell
Copy link
Contributor Author

@l1x This due to a change to CPython to no longer include that header. If you are feeling particularly bloody minded I guess you could put an empty file with the right name someplace that the compiler will see but that seems like a Bad Idea™️ .

The best fix is to update the version of cython you are using and re-cythonize your source.

@dnabanita7
Copy link

I am still getting this issue

/anaconda3/envs/tts/include -arch arm64 -fPIC -O2 -isystem /Users/dnabanita7/anaconda3/envs/tts/include -arch arm64 -I /opt/homebrew/opt/protobuf/include -I/usr/local/include/ -I/private/var/folders/_m/4y30kv853fg5mxzh8574czq80000gn/T/pip-install-n4rd5tst/pycld3_2ddc0107d9c54442a6fb7aa615689cd3/src/ -I/private/var/folders/_m/4y30kv853fg5mxzh8574czq80000gn/T/pip-install-n4rd5tst/pycld3_2ddc0107d9c54442a6fb7aa615689cd3/src/cld_3/protos/ -I/Users/dnabanita7/anaconda3/envs/tts/include/python3.11 -c cld3/pycld3.cpp -o build/temp.macosx-11.0-arm64-cpython-311/cld3/pycld3.o -std=c++11 -stdlib=libc++
      cld3/pycld3.cpp:250:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1

I can't update cython version as its not compatible with coqui-tts. Also upgrading cython version to 3.0.0 doesn't woek either. I am using ventura osx m2 chip.

@da-woods
Copy link
Contributor

I can't update cython version as its not compatible with coqui-tts

Then you're stuck and there is no possible solution that lets you use Python 3.11.

I suggest you use Python 3.10 or earlier.

@dnabanita7
Copy link

dnabanita7 commented Aug 17, 2023 via email

@muhannad-hash
Copy link

screen
still have this issue

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

Successfully merging this pull request may close these issues.

None yet

6 participants