首页 > 编程语言 >Python报错:performance hint: av/logging.pyx:232:5: the GIL to be acquired

Python报错:performance hint: av/logging.pyx:232:5: the GIL to be acquired

时间:2023-12-13 10:01:04浏览次数:53  
标签:pyx because logging 报错 build File av pip

 

参考:

https://stackoverflow.com/questions/77410272/problems-installing-python-av-in-windows-11

https://github.com/PyAV-Org/PyAV/issues/1177

 

 

================================

 

 

报错信息:

C:\Windows.old\Users\chris>pip install av
Defaulting to user installation because normal site-packages is not writeable
Collecting av
  Using cached av-10.0.0.tar.gz (2.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      Compiling av\buffer.pyx because it changed.
      [1/1] Cythonizing av\buffer.pyx
      Compiling av\bytesource.pyx because it changed.
      [1/1] Cythonizing av\bytesource.pyx
      Compiling av\descriptor.pyx because it changed.
      [1/1] Cythonizing av\descriptor.pyx
      Compiling av\dictionary.pyx because it changed.
      [1/1] Cythonizing av\dictionary.pyx
      Compiling av\enum.pyx because it changed.
      [1/1] Cythonizing av\enum.pyx
      Compiling av\error.pyx because it changed.
      [1/1] Cythonizing av\error.pyx
      Compiling av\format.pyx because it changed.
      [1/1] Cythonizing av\format.pyx
      Compiling av\frame.pyx because it changed.
      [1/1] Cythonizing av\frame.pyx
      performance hint: av\logging.pyx:232:5: Exception check on 'log_callback' will always require the GIL to be acquired.
      Possible solutions:
          1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
          2. Use an 'int' return type on the function to allow an error code to be returned.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      cdef const char *log_context_name(void *ptr) nogil:
          cdef log_context *obj = <log_context*>ptr
          return obj.name

      cdef lib.AVClass log_class
      log_class.item_name = log_context_name
                            ^
      ------------------------------------------------------------

      av\logging.pyx:216:22: Cannot assign type 'const char *(void *) except? NULL nogil' to 'const char *(*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'const char *(void *) except? NULL nogil'.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

      # Start the magic!
      # We allow the user to fully disable the logging system as it will not play
      # nicely with subinterpreters due to FFmpeg-created threads.
      if os.environ.get('PYAV_LOGGING') != 'off':
          lib.av_log_set_callback(log_callback)
                                  ^
      ------------------------------------------------------------

      av\logging.pyx:351:28: Cannot assign type 'void (void *, int, const char *, va_list) except * nogil' to 'av_log_callback'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (void *, int, const char *, va_list) except * nogil'.
      Compiling av\logging.pyx because it changed.
      [1/1] Cythonizing av\logging.pyx
      Traceback (most recent call last):
        File "C:\Program Files\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Program Files\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Program Files\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 157, in <module>
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "C:\Users\chris\AppData\Local\Temp\pip-build-env-4nz2e7u1\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: av\logging.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

 

 

 

 

解决方法:

 

网上给出的解决方法:

1. 

The problem is not Windows 11. The problem lies within python 3.12 . The package av is not yet released for python 3.12.

Please try to install av under python 3.11.

2. 

I had the same issue and switching from Python 3.12.0 to 3.11.6 solved it for me

 

------------------------------

 

 

个人实测的成功解决方法:

把Python的版本从Python 3.11降到Python 3.10,不再报错,成功解决。

 

 

 

============================

 

 

查询Google:

Python报错:performance hint: av/logging.pyx:232:5:  the GIL to be acquired_Python

 

标签:pyx,because,logging,报错,build,File,av,pip
From: https://blog.51cto.com/u_15642578/8798278

相关文章

  • Python报错:pkg-config could not find libraries ['avformat', 'avcodec', 'av
    参考:https://github.com/PyAV-Org/PyAV/issues/238https://pyav.org/docs/6.1.2/installation.html#mac-os-x  =====================  报错信息:C:\Users\liuxue>pipinstallavCollectingavUsingcachedav-0.3.3.tar.gzInstallingcollectedpackages:avRunning......
  • Django runserver 时报错 [Errno 11001] getaddrinfo failed
    现象描述:python使用Django命令pythonmanage.pyrunserver0:8000时,在浏览器登录遇到错误[Errno11001]getaddrinfofailed错误:解决办法:查看本机ip地址(windows在cmd中输入ipconfig可查看本机ip)打开Django项目的settings.py文件,在ALLOWED_HOSTS=[]中填入查......
  • 故障解析丨导入字符串NULL导致主从报错
    1.背景概述目前需要搭建一个从库,由于单表数据量较大,时间比较有限,考虑到导入导出的时间,并且GreatSQL支持并行loaddata的功能,能够加速数据的导入,因此决定使用selectintooutfile和loaddata的方式进行数据的迁移;在数据导入完成后进行数据同步,从库发生报错1032找不到记录,但......
  • python 报错应对列表
    =========================RESTART:D:/Python37/ziti1.py========================Traceback(mostrecentcalllast):File"D:/Python37/ziti1.py",line1,in<module>importdocxModuleNotFoundError:Nomodulenamed'docx'>>......
  • docker启动容器报错:Error response from daemon: driver failed programming external
    安装的docker启动报错如下:Errorresponsefromdaemon:driverfailedprogrammingexternalconnectivityonendpointnacos(2b0f4edff8f640559af9626936d1b38d965302ef525af483716e8e8c9121583e):(iptablesfailed:iptables--wait-tnat-ADOCKER-ptcp-d0/0--dp......
  • btoa atob 与 base64,以及btoa报错
    在JavaScript中,btoa和atob是两个用于Base64编码和解码的函数。下面是对这两个函数以及Base64的解释和代码示例:btoa函数:btoa(表示base64encode)将字符串转换为Base64编码的数据。它接受一个ASCII字符串参数,并返回经过Base64编码的字符串。b表示"binary",它......
  • vite编译为什么会报错“__vite-browser-external:node:path、fs、url...”
    当你在使用Vite打包时,遇到类似于`__vite-browser-external`的错误消息,通常是因为在代码中尝试导入浏览器不支持的模块。`__vite-browser-external`是Vite内部的一个机制,用于替换浏览器环境中无法直接访问的Node.js核心模块。例如,浏览器不具备文件系统访问能力,因此Node.......
  • 解决Python爬虫中Header报错的方法
    在使用Python编写爬虫时,有时会遇到Header报错的情况。本文将介绍常见的Header报错类型,并提供解决方法,帮助您顺利处理Python爬虫中的Header报错问题。当我们使用Python进行爬虫开发时,经常需要设置请求头(Header)来模拟浏览器发送请求。然而,有时可能会遇到一些与Header相关的报错。以下......
  • Python网络连接request报错:OSError: [Errno 113] No route to host
    报错:(pytorch)devil@Monster:~$huggingface-clilogin_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|......
  • gh-ost 报错 ERROR 1236 (HY000): A slave with the same server_uuid/server_id as t
    使用gh-ost 对表在线加索引时,第一次发生了下面的报错(使用gh-ost很长时间了,第一次遇到这个报错):[2023/12/1211:48:08][error]binlogstreamer.go:77closesyncwitherr:ERROR1236(HY000):Aslavewiththesameserver_uuid/server_idasthisslavehasconnectedtoth......