English 中文(简体)
差类:不能直接设立说明员
原标题:TypeError: Descriptors cannot not be created directly

我试图安装Ray,但留下了一个错误:

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

I tried to solve the problem and downgraded protobuf:

Name: protobuf
Version: 3.20.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author:
Author-email:
License: BSD-3-Clause
Location: d:opencvlibsite-packages
Requires:
Required-by: ray, tensorboard, tensorflow

但是,在Ry、、TensorFlow、Keras仍然存在着这一问题。 我的申请不再奏效。 我怎么能够确定?

问题回答

有时protobuf 一揽子计划可以在没有你参与的情况下安装。 为此,你有两个解决办法。 以下解决办法之一值得一提,它应当发挥作用。

Solution 1:

页: 1 plugin,

pip install protobuf==3.20.*

或者,作为最后一揽子方案,请在<代码>查询.txt文档中加入。 由于这将优先于先前安装的protobuf

...
protobuf==3.20.*

Solution 2:

你们可以确定以下环境变量。

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

according to the error description, this might impact your program performance.

but this will use pure-Python parsing and will be much slower


参考资料:

<<>Solution 1: 降级防御工事

This library has recently released a new version, which causes an error. Use this command in the terminal to downgrade, which should resolve the problem:

pip install --upgrade "protobuf<=3.20.1"

或强迫重新插入旧版本:

pip install  protobuf<=3.20.1  --force-reinstall

< Update TensorFlow to the recent edition

TensorFlow 2.9.1于2022年5月23日获释。 可更新:

pip install tensorflow==2.9.1

航道使用最新版本的TensorFlow。

在我的案件中,我没有在我的<编码>中明确列入<编码>protobuf 查询tx,但我确实有相关的依赖性,这显然有问题:

googleapis-common-protos==1.6.0。 # 取决于代用产品

<>Removing<>>>>>em>,允许随后的pip装置-e (假定setup.py现存)与google-api-core==1.13.0对附属公司适用。 结果安装了<代码>googleapis-common-protos==1.56.2,并解决了错误。

甚至我也遇到了同样的错误。

我通过安装推进器解决了这一问题:

pip install protobuf==3.20.

Screen Snippet

指挥

pip install protobuf==3.20.3 --upgrade

Worked for me. All other versions mentioned in the answers did not solve the problem.

Alternatively, I was able to upgrade to wandb==0.12.17, and everything seems to be working.

Old (not working):

  - pip:
      - wandb==0.10.21

新(工作):

  - pip:
      - wandb==0.12.17

不得直接设立声明人:

  1. We need to downgrade the protobuf package from 4.21.2 to 3.20.1.
  2. Go to setting → ProjectPython Interpreter → install protobuf 3.20.1 (specify version)

我发现同一问题,但我遵守了本网页的指示:

< Python 包装用户指南(https://github.com/pypa/ Packaging.python.org” rel=“nofollow noreferer”>on Git Hub

Steps

Requirements / prerequisites:

  1. 间谍

  2. 2. 随同

  3. 2. sp-内表 2021.4.11b9

  4. python-docs-theme 2021.5

  5. 脊髓灰质炎 0.4.0

  6. <代码>python-V的输出:

    3.8.10

  7. <代码>protoc.exe www.un.org/Depts/DGACM/index_spanish.htm

    校准 3.21.0-rc2

Installation:

  1. http://github.com/pypa/pypa-docs-theme.git#egg=pypa-docs-theme

  2. 图书馆

  3. Copy the compiled library from F: empPythonprotocpackaging.python.orgprotobufDebug to F: empPythonprotocpackaging.python.orgprotobufsrc

<<>Output>:

installing library code to builddist.win-amd64egg
running install_lib
running build_py
creating buildlib.win-amd64-3.8
creating buildlib.win-amd64-3.8google
copying google\__init__.py -> buildlib.win-amd64-3.8google
creating buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufany_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufapi_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufdescriptor.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufdescriptor_database.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufdescriptor_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufdescriptor_pool.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufduration_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufempty_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuffield_mask_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufjson_format.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufmessage.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufmessage_factory.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufproto_builder.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf
eflection.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufservice.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufservice_reflection.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufsource_context_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufstruct_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufsymbol_database.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf	ext_encoding.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf	ext_format.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf	imestamp_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf	ype_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufunknown_fields.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobufwrappers_pb2.py -> buildlib.win-amd64-3.8googleprotobuf
copying googleprotobuf\__init__.py -> buildlib.win-amd64-3.8googleprotobuf

...
testTimestampSerializeAndParse (google.protobuf.internal.well_known_types_test.TimeUtilTest) ... ok
testTimezoneAwareDatetimeConversionLA (google.protobuf.internal.well_known_types_test.TimeUtilTest)
testTimezoneAwareDatetimeConversionLA([1969, 12, 31, 18], datetime.timezone(datetime.timedelta(days=-1, seconds=57600),  US/Pacific )) ... ok
testTimezoneAwareDatetimeConversionLondon (google.protobuf.internal.well_known_types_test.TimeUtilTest)
testTimezoneAwareDatetimeConversionLondon([1970, 1, 1, 2], datetime.timezone.utc) ... ok
testTimezoneAwareDatetimeConversionTokyo (google.protobuf.internal.well_known_types_test.TimeUtilTest)
testTimezoneAwareDatetimeConversionTokyo([1970, 1, 1, 11], datetime.timezone(datetime.timedelta(seconds=32400),  Japan )) ... ok
testTimezoneNaiveDatetimeConversion (google.protobuf.internal.well_known_types_test.TimeUtilTest) ... ok
testByteSizeFunctions (google.protobuf.internal.wire_format_test.WireFormatTest) ... ok
testPackTag (google.protobuf.internal.wire_format_test.WireFormatTest) ... ok
testUnpackTag (google.protobuf.internal.wire_format_test.WireFormatTest) ... ok
testZigZagDecode (google.protobuf.internal.wire_format_test.WireFormatTest) ... ok
testZigZagEncode (google.protobuf.internal.wire_format_test.WireFormatTest) ... ok

我与流利问题一样。

OLD-> 溪流==1.19.0

I updated the version of streamlit using pip install streamlit --upgrade and it worked.

New ->streamlit==1.23.1

我正在使用Tensor Flow 1.15.5和3.7.9。

这些特殊版本帮助我:

wandb 0.12.17
protobuf 3.15.0

您可以使用:

pip install wandb==0.12.17

pip uninstall protobuf

pip install protobuf==3.15.0

我最近在法典中看到了同样的错误。 在我的案件中,还有一张牵涉<代码>pychromecast的痕迹。 因此,对我来说,定点只是更新了<代码>pychromecast。 这只是提醒说,固定办法不一定是贬低某些包裹。





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签