问题导入PyYAML,cltk。

huangapple go评论125阅读模式
英文:

Issue importing PyYAML, cltk

问题

我刚刚购买了一台MacBook,克隆了我正在工作的项目,然后去设置Python环境。创建环境后,我更新了pip,并尝试使用pip install -r requirements.txt安装必要的库。给我带来问题的三个库是cltkPyYAMLstanza

在执行pip install -r requirements.txt后,出现了以下错误:

从requirements.txt(第56行)收集PyYAML==5.4.1
正在使用缓存的PyYAML-5.4.1.tar.gz(175 kB)
正在安装构建依赖项 ... 完成
获取要构建的wheel的要求 ... 错误
错误:子进程以错误退出

× 获取要构建的wheel的要求未成功运行。
│ 退出代码:1
╰─> [62行输出]
    正在运行egg_info
    写入lib3/PyYAML.egg-info/PKG-INFO
    将依赖关系链接写入lib3/PyYAML.egg-info/dependency_links.txt
    将顶级名称写入lib3/PyYAML.egg-info/top_level.txt
    /private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: 已弃用的配置在`setup.cfg`中
    !!

            ********************************************************************************
            license_file参数已弃用,请改用license_files。
            到2023年10月30日,您需要更新您的项目并删除已弃用的调用,否则将不再支持您的构建。
            有关详细信息,请参阅https://setuptools.pypa.io/en/latest/userguide/declarative_config.html。
            ********************************************************************************

    !!
    解析= self.parsers.get(option_name,lambda x:x)(value)
    最后一次调用失败的跟踪:
    File“/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”,line 353,在<module>行
    主要
    File“/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”,line 335,在main行
    json_out [‘return_val’] = hook(**hook_input [‘kwargs’])
    File“/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”,line 118,在get_requires_for_build_wheel行
    返回钩子(config_settings)
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”,line 341,在get_requires_for_build_wheel行
    return self._get_build_requires(config_settings,requirements = ['wheel'])
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”,line 323,在_get_build_requires行
    self.run_setup()
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”,line 338,在run_setup行
    exec(code,locals())
    File“<string>”,line 271,在<module>行
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/__init__.py”,line 107,在setup行
    return distutils.core.setup(** attrs)
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py”,line 185,在setup行
    return run_commands(dist)
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py”,line 201,在run_commands行
    dist.run_commands()
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”,line 969,在run_commands行
    self.run_command(cmd)
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/dist.py”,line 1234,在run_command行
    super()。run_command(命令)
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”,line 988,在run_command行
    cmd_obj.run()
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py”,line 314,在run行
    self.find_sources()
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py”,line 322,在find_sources行
    mm.run()
    File“/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py”,line 551,在run行
    self.add_defaults()
    File“/private/var

<details>
<summary>英文:</summary>

I just got a MacBook, cloned the project I was working on, and went to set up the python environment.  After creating the environment, I updated pip and tried installing the necessary libraries using `pip install -r requirements.txt`.  The 3 libraries that are giving me issues are `cltk`, `PyYAML`, and `stanza`. 

This is what it gives me after executing `pip install -r requirements.txt`:

Collecting PyYAML==5.4.1 (from -r requirements.txt (line 56))
Using cached PyYAML-5.4.1.tar.gz (175 kB)
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
╰─> [62 lines of output]
running egg_info
writing lib3/PyYAML.egg-info/PKG-INFO
writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
writing top-level names to lib3/PyYAML.egg-info/top_level.txt
/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in setup.cfg
!!

          ********************************************************************************
          The license_file parameter is deprecated, use license_files instead.
  
          By 2023-Oct-30, you need to update your project and remove deprecated calls
          or your builds will no longer be supported.
  
          See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
          ********************************************************************************
  
  !!
    parsed = self.parsers.get(option_name, lambda x: x)(value)
  Traceback (most recent call last):
    File &quot;/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py&quot;, line 353, in &lt;module&gt;
      main()
    File &quot;/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py&quot;, line 335, in main
      json_out[&#39;return_val&#39;] = hook(**hook_input[&#39;kwargs&#39;])
    File &quot;/Users/mikerabayda/repos/github.com/public/FastBridge/env/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py&quot;, line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py&quot;, line 341, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[&#39;wheel&#39;])
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py&quot;, line 323, in _get_build_requires
      self.run_setup()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/build_meta.py&quot;, line 338, in run_setup
      exec(code, locals())
    File &quot;&lt;string&gt;&quot;, line 271, in &lt;module&gt;
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/__init__.py&quot;, line 107, in setup
      return distutils.core.setup(**attrs)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py&quot;, line 185, in setup
      return run_commands(dist)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py&quot;, line 201, in run_commands
      dist.run_commands()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py&quot;, line 969, in run_commands
      self.run_command(cmd)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/dist.py&quot;, line 1234, in run_command
      super().run_command(command)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py&quot;, line 988, in run_command
      cmd_obj.run()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py&quot;, line 314, in run
      self.find_sources()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py&quot;, line 322, in find_sources
      mm.run()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py&quot;, line 551, in run
      self.add_defaults()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py&quot;, line 589, in add_defaults
      sdist.add_defaults(self)
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/command/sdist.py&quot;, line 104, in add_defaults
      super().add_defaults()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py&quot;, line 251, in add_defaults
      self._add_defaults_ext()
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py&quot;, line 336, in _add_defaults_ext
      self.filelist.extend(build_ext.get_source_files())
    File &quot;&lt;string&gt;&quot;, line 201, in get_source_files
    File &quot;/private/var/folders/lk/14gmp9zs33512s20nwz_329c0000gn/T/pip-build-env-pbxz96he/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py&quot;, line 107, in __getattr__
      raise AttributeError(attr)
  AttributeError: cython_sources
  [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.


In `requirements.txt` I noticed that it specifies versions of all the packages, I tried taking those out to let pip solve the dependency issues and get the same error.  I&#39;ve tried deleting `cltk`, `PyYAML`, and `stanza` and pip installing them manually after downloading the others from `requirements.txt` but get similar dependency issues.  

This is still all working on WSL on my other computer with a virtual environment using python `3.8.10`, but I can&#39;t get it to work on this new one.  I&#39;m using `3.8.17` and have tried more recent python versions with 0 success. 


</details>


# 答案1
**得分**: 4

这是PyYAML `5.4.1`中的一个错误,这是您正在尝试安装的版本。该问题在上周提出,建议的解决方法是使用先前的小版本`5.3.1`。

更多信息请参考:
https://github.com/yaml/pyyaml/issues/724

所以,在您的`requirements.txt`文件中:

    ...
    PyYAML==5.3.1

<details>
<summary>英文:</summary>

This is a bug in PyYAML `5.4.1` which is the version you are trying to install. It was opened last week and the workaround suggested is to use the previous minor version `5.3.1`.

More information here:
https://github.com/yaml/pyyaml/issues/724

So, in your `requirements.txt`:

    ...
    PyYAML==5.3.1



</details>



# 答案2
**得分**: 1

Snyk显示了PyYAML==5.3.1存在[严重的安全问题][1]。请升级到版本6.0.1来解决。

[1]: https://security.snyk.io/vuln/SNYK-PYTHON-PYYAML-590151

<details>
<summary>英文:</summary>

Snyk shows a [critical security issue][1] with PyYAML==5.3.1. Fix by upgrading to version 6.0.1 instead. 


  [1]: https://security.snyk.io/vuln/SNYK-PYTHON-PYYAML-590151

</details>



huangapple
  • 本文由 发表于 2023年7月18日 03:13:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76707475.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定