spacy python package no longer runs

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

spacy python package no longer runs

问题

Running python 3.11.3 on macOS, Intel.

我之前使用spacy没有问题。然后我决定尝试添加GPU支持,使用以下命令:pip install -U 'spacy[cuda113]',但开始出现错误。

我使用pip uninstall 'spacy[cuda113]'卸载了它,然后只使用pip install spacy重新安装了spacy。

然而,当我运行一个简单的脚本,其中只有import spacy时,仍然出现相同的错误:

英文:

Running python 3.11.3 on macos, Intel.

I had spacy working fine. I then decided to try adding gpu support with: pip install -U 'spacy[cuda113]' but started getting errors.

I uninstalled with pip uninstall 'spacy[cuda113]' and then reinstalled spacy with just pip install spacy.

However, I'm still getting the same errors when running a simple script with just

import spacy in it:

Traceback (most recent call last):
  File "/Users/steve/workshop/python/blah.py", line 4, in <module>
    import spacy
  File "/usr/local/lib/python3.11/site-packages/spacy/__init__.py", line 14, in <module>
    from . import pipeline  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/spacy/pipeline/__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "/usr/local/lib/python3.11/site-packages/spacy/pipeline/attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy/pipeline/pipe.pyx", line 1, in init spacy.pipeline.pipe
  File "spacy/vocab.pyx", line 1, in init spacy.vocab
  File "/usr/local/lib/python3.11/site-packages/spacy/tokens/__init__.py", line 1, in <module>
    from .doc import Doc
  File "spacy/tokens/doc.pyx", line 36, in init spacy.tokens.doc
  File "/usr/local/lib/python3.11/site-packages/spacy/schemas.py", line 158, in <module>
    class TokenPatternString(BaseModel):
  File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 369, in __new__
    cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydantic/utils.py", line 231, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 2722, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'in' is not a valid parameter name

答案1

得分: 2

我不太确定这些命令是如何/为什么修复了问题的,但它们确实修复了问题:

pip uninstall spacy
pip uninstall spacy_legacy
pip uninstall spacy_alignments
pip uninstall spacy_loggers
pip uninstall pydantic
pip install 'pydantic<1.8'
pip install spacy
pip uninstall pydantic
pip install pydantic
pip install spacy-alignments
pip install spacy-transformers
pip uninstall spacy
pip install spacy
英文:

I'm not quite sure how/why these commands fixed the issue, but they did:

pip uninstall spacy
pip uninstall spacy_legacy
pip uninstall spacy_alignments
pip uninstall spacy_loggers
pip uninstall pydantic
pip install &#39;pydantic&lt;1.8&#39;
pip install spacy
pip uninstall pydantic
pip install pydantic
pip install spacy-alignments
pip install spacy-transformers
pip uninstall spacy
pip install spacy

答案2

得分: -1

我卸载了pydantic然后重新安装它。我在pydantic 1.10中修复了它。

英文:

I uninstalled pydantic then installed it again.I got it fixed in pydantic 1.10.

huangapple
  • 本文由 发表于 2023年4月11日 00:33:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978880.html
匿名

发表评论

匿名网友

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

确定