模块"google.protobuf.internal.containers"没有属性"MutableMapping"



我的工作场所决定引入双因素身份验证(2FA(,突然之间,我的项目就没有以前那样工作了。我不知道这个2FA是否真的造成了问题,但简单的任务是:";导入spacy";已经不起作用了。我收到一条冗长的错误消息:


AttributeError                            Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 import spacy
File ~anaconda3libsite-packagesspacy__init__.py:11, in <module>
8 setup_default_warnings()  # noqa: E402
10 # These are imported as part of the API
---> 11 from thinc.api import prefer_gpu, require_gpu, require_cpu  # noqa: F401
12 from thinc.api import Config
14 from . import pipeline  # noqa: F401
File ~anaconda3libsite-packagesthincapi.py:2, in <module>
1 from .config import Config, registry, ConfigValidationError
----> 2 from .initializers import normal_init, uniform_init, glorot_uniform_init, zero_init
3 from .initializers import configure_normal_init
4 from .loss import CategoricalCrossentropy, L2Distance, CosineDistance
File ~anaconda3libsite-packagesthincinitializers.py:4, in <module>
1 from typing import Callable, cast
2 import numpy
----> 4 from .backends import Ops
5 from .config import registry
6 from .types import FloatsXd, Shape
File ~anaconda3libsite-packagesthincbackends__init__.py:7, in <module>
4 from contextvars import ContextVar
5 import threading
----> 7 from .ops import Ops
8 from .cupy_ops import CupyOps, has_cupy
9 from .numpy_ops import NumpyOps
File ~anaconda3libsite-packagesthincbackendsops.py:11, in <module>
9 from ..types import FloatsXd, Ints1d, Ints2d, Ints3d, Ints4d, IntsXd, _Floats
10 from ..types import DeviceTypes, Generator, Padded, Batchable, SizedGenerator
---> 11 from ..util import get_array_module, is_xp_array, to_numpy
14 ArrayT = TypeVar("ArrayT", bound=ArrayXd)
15 FloatsT = TypeVar("FloatsT", bound=_Floats)
File ~anaconda3libsite-packagesthincutil.py:38, in <module>
35     has_torch_gpu = False
37 try:  # pragma: no cover
---> 38     import tensorflow.experimental.dlpack
39     import tensorflow as tf
41     has_tensorflow = True
File ~anaconda3libsite-packagestensorflow__init__.py:41, in <module>
38 import six as _six
39 import sys as _sys
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
44 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.
File ~anaconda3libsite-packagestensorflowpython__init__.py:40, in <module>
31 import traceback
33 # We aim to keep this file minimal and ideally remove completely.
34 # If you are adding a new file with @tf_export decorators,
35 # import it in modules_with_exports.py instead.
36 
37 # go/tf-wildcard-import
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
---> 40 from tensorflow.python.eager import context
42 # pylint: enable=wildcard-import
43 
44 # Bring in subpackages.
45 from tensorflow.python import data
File ~anaconda3libsite-packagestensorflowpythoneagercontext.py:32, in <module>
29 import numpy as np
30 import six
---> 32 from tensorflow.core.framework import function_pb2
33 from tensorflow.core.protobuf import config_pb2
34 from tensorflow.core.protobuf import rewriter_config_pb2
File ~anaconda3libsite-packagestensorflowcoreframeworkfunction_pb2.py:7, in <module>
5 import sys
6 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 7 from google.protobuf import descriptor as _descriptor
8 from google.protobuf import message as _message
9 from google.protobuf import reflection as _reflection
File ~anaconda3libsite-packagesgoogleprotobufdescriptor.py:47, in <module>
45   import binascii
46   import os
---> 47   from google.protobuf.pyext import _message
48   _USE_C_DESCRIPTORS = True
51 class Error(Exception):
AttributeError: module 'google.protobuf.internal.containers' has no attribute 'MutableMapping'

我再次尝试卸载和安装spacy,我尝试了pip安装protobuf,我尝试过这个:

import collections.abc
from collections.abc import MutableMapping

正如在这里的一篇帖子中所建议的那样,我已经检查了我是否有与我的同事和远程机器相同的版本(对他来说,它可以在他的笔记本电脑上工作,但不能在远程上工作(,我已经尝试升级python(从3.8.8到3.8.12(-似乎什么都不起作用。还有一些额外的问题,比如gensim和spacy的问题,或者一个项目成功地导入了所有内容,但现在为我产生了错误,而它在2FA之前工作。有人能分享可能导致这种情况的原因吗?我该如何解决?我们甚至不知道如何引导IT了解问题所在——他们对python一无所知,我也不确定问题是否与python有关?有人能帮我了解一下发生了什么事吗?

我建议检查您安装的protobuf的版本,并降级到3.17.3或更低的版本。这对我很有效。

相关内容

  • 没有找到相关文章

最新更新