spacy python package no longer runs

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

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:

  1. Traceback (most recent call last):
  2. File "/Users/steve/workshop/python/blah.py", line 4, in <module>
  3. import spacy
  4. File "/usr/local/lib/python3.11/site-packages/spacy/__init__.py", line 14, in <module>
  5. from . import pipeline # noqa: F401
  6. ^^^^^^^^^^^^^^^^^^^^^^
  7. File "/usr/local/lib/python3.11/site-packages/spacy/pipeline/__init__.py", line 1, in <module>
  8. from .attributeruler import AttributeRuler
  9. File "/usr/local/lib/python3.11/site-packages/spacy/pipeline/attributeruler.py", line 6, in <module>
  10. from .pipe import Pipe
  11. File "spacy/pipeline/pipe.pyx", line 1, in init spacy.pipeline.pipe
  12. File "spacy/vocab.pyx", line 1, in init spacy.vocab
  13. File "/usr/local/lib/python3.11/site-packages/spacy/tokens/__init__.py", line 1, in <module>
  14. from .doc import Doc
  15. File "spacy/tokens/doc.pyx", line 36, in init spacy.tokens.doc
  16. File "/usr/local/lib/python3.11/site-packages/spacy/schemas.py", line 158, in <module>
  17. class TokenPatternString(BaseModel):
  18. File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 369, in __new__
  19. cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
  20. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  21. File "/usr/local/lib/python3.11/site-packages/pydantic/utils.py", line 231, in generate_model_signature
  22. merged_params[param_name] = Parameter(
  23. ^^^^^^^^^^
  24. 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__
  25. raise ValueError('{!r} is not a valid parameter name'.format(name))
  26. ValueError: 'in' is not a valid parameter name

答案1

得分: 2

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

  1. pip uninstall spacy
  2. pip uninstall spacy_legacy
  3. pip uninstall spacy_alignments
  4. pip uninstall spacy_loggers
  5. pip uninstall pydantic
  6. pip install 'pydantic<1.8'
  7. pip install spacy
  8. pip uninstall pydantic
  9. pip install pydantic
  10. pip install spacy-alignments
  11. pip install spacy-transformers
  12. pip uninstall spacy
  13. pip install spacy
英文:

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

  1. pip uninstall spacy
  2. pip uninstall spacy_legacy
  3. pip uninstall spacy_alignments
  4. pip uninstall spacy_loggers
  5. pip uninstall pydantic
  6. pip install &#39;pydantic&lt;1.8&#39;
  7. pip install spacy
  8. pip uninstall pydantic
  9. pip install pydantic
  10. pip install spacy-alignments
  11. pip install spacy-transformers
  12. pip uninstall spacy
  13. 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:

确定