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

build failure with Python 3.11.0b1 #139

Closed
flit opened this issue Jun 5, 2022 · 11 comments
Closed

build failure with Python 3.11.0b1 #139

flit opened this issue Jun 5, 2022 · 11 comments

Comments

@flit
Copy link
Contributor

flit commented Jun 5, 2022

Host OS: macOS 12.4 (21F79)
Python: 3.11.0b1 installed via pyenv 2.3.1
wheel: 0.37.1
pip: 22.1.2

Build log:

  Building wheel for hidapi (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      /Volumes/projects/pyOCD-flit/venv/m3110b1/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running bdist_wheel
      running build
      running build_ext
      skipping 'hid.c' Cython extension (up-to-date)
      building 'hid' extension
      creating build
      creating build/temp.macosx-12.2-x86_64-cpython-311
      creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi
      creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi/mac
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation -framework AppKit -Ihidapi/hidapi -I/Volumes/projects/pyOCD-flit/venv/m3110b1/include -I/Users/creed/.pyenv/versions/3.11.0b1/include/python3.11 -c hid.c -o build/temp.macosx-12.2-x86_64-cpython-311/hid.o
      clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: -framework AppKit: 'linker' input unused [-Wunused-command-line-argument]
      hid.c:253:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' 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 hidapi
@prusnak
Copy link
Member

prusnak commented Jun 5, 2022

Seems like a Cython issue fixed in cython/cython#4428

@prusnak prusnak closed this as completed Jun 5, 2022
@flit
Copy link
Contributor Author

flit commented Jun 5, 2022

The problem is actually the hid.c file included in the sdist generated from Cython before cython/cython#4428 was fixed. If I build from a git clone or install with pip using git+https://github.com/trezor/cython-hidapi it works fine.

So… imo, this issue remains open until a new sdist is released with an updated hid.c. Would you mind whenever you get a chance? 🙏🏽

@prusnak prusnak reopened this Jun 5, 2022
@flit
Copy link
Contributor Author

flit commented Jun 5, 2022

Thanks! 😄

@prusnak
Copy link
Member

prusnak commented Jun 5, 2022

I just uploaded 0.12.0 to PyPi - https://pypi.org/project/hidapi/0.12.0/#files

Can you please try if that fixed the issue?

Thanks

@flit
Copy link
Contributor Author

flit commented Jun 6, 2022

Unexpectedly, it doesn't build successfully on install.

$ python --version
Python 3.11.0b1
$ pip install hidapi
Collecting hidapi
  Downloading hidapi-0.12.0.tar.gz (145 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.9/145.9 kB 2.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools>=19.0 in ./venv311/lib/python3.11/site-packages (from hidapi) (62.3.2)
Building wheels for collected packages: hidapi
  Building wheel for hidapi (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      /Users/creed/test/venv311/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running bdist_wheel
      running build
      running build_ext
      skipping 'hid.c' Cython extension (up-to-date)
      building 'hid' extension
      creating build
      creating build/temp.macosx-12.2-x86_64-cpython-311
      creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi
      creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi/mac
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation -framework AppKit -Ihidapi/hidapi -I/Users/creed/test/venv311/include -I/Users/creed/.pyenv/versions/3.11.0b1/include/python3.11 -c hid.c -o build/temp.macosx-12.2-x86_64-cpython-311/hid.o
      clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
      clang: warning: -framework AppKit: 'linker' input unused [-Wunused-command-line-argument]
      hid.c:253:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' 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 hidapi

Could you have had an existing hid.c in your working copy when you built the sdist? I had to remove my copy in order to force regeneration via the updated Cython.

@flit
Copy link
Contributor Author

flit commented Jun 6, 2022

Yeah… the hid.c files in both 0.11.2 and 0.12.0 sdists are exactly the same.

@prusnak
Copy link
Member

prusnak commented Jun 6, 2022

I generated the result via cython 0.29.30.

Not sure what to do next ... 🤷

@flit
Copy link
Contributor Author

flit commented Jun 6, 2022

Delete hid.c from the working copy root, build/install so that hid.c is regenerated, then build the sdist.

When I do this, the generated hid.c is different from the one included in the 0.12.0 sdist.

@prusnak
Copy link
Member

prusnak commented Jun 6, 2022

When I do this, the generated hid.c is different from the one included in the 0.12.0 sdist.

Good catch! I wrongly assumed that hid.c is regenerated when I run python3 setup.py sdist 🤦

Will upload 0.12.0.post1 with regenerated hid.c to PyPI soon

@prusnak
Copy link
Member

prusnak commented Jun 6, 2022

Uploaded 0.12.0.post2 to PyPI : https://pypi.org/project/hidapi/0.12.0.post2/#files

@flit can you please check whether this works for you?

I will upload wheels once the fix has been confirmed.

@flit
Copy link
Contributor Author

flit commented Jun 6, 2022

🎉 Works perfectly!

Thanks very much for fixing this quickly.

@flit flit closed this as completed Jun 6, 2022
@prusnak prusnak closed this as completed Jun 6, 2022
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

2 participants