ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
4.96k stars 1.69k forks source link

protobuf dependency compatibility #2654

Closed ChrisLally closed 1 year ago

ChrisLally commented 1 year ago
ContextualVersionConflict

What was wrong?

protobuf compatibility needs updating. Needed to downgrade protobuf to get it working. Version currently needs to be >4 but protobuf's latest version is 4.21.6

How can it be fixed?

The newest version of protobuf should be compatible https://pypi.org/project/protobuf/

ghost commented 1 year ago

Currently running into the same issue with web3==6.0.0b4 on an M1 Mac, web3 is requiring protobuf==3.20.2 but I had to downgrade to 3.20.1 to avoid this import error:

File "/Users/ibis/.pyenv/versions/3.10.5/envs/import_test/lib/python3.10/site-packages/ethpm/_utils/ipfs.py", line 18, in <module>
    from google.protobuf.descriptor import (
  File "/Users/ibis/.pyenv/versions/3.10.5/envs/import_test/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: dlopen(/Users/ibis/.pyenv/versions/3.10.5/envs/import_test/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (__ZN6google8protobuf15FieldDescriptor12TypeOnceInitEPKS1_)
fselmo commented 1 year ago

@clally1 @helloibis thanks for the heads up. I'm going to pin it to 3.20.1 for now until we can regenerate some of ethpm with 4.x

pietrodn commented 1 year ago

@fselmo that bug has now been resolved, I think you can unpin the protobuf version now. https://github.com/protocolbuffers/protobuf/issues/10571

kclowes commented 1 year ago

This should be resolved with #2666, but let me know if there are still issues. That PR is released in web3.py v6.0.0-b.7.

anthonygtellez commented 1 year ago

Still seeing this issue with 6.2.0 on google collab.

ContextualVersionConflict: (protobuf 3.20.3 (/usr/local/lib/python3.10/dist-packages), Requirement.parse('protobuf>=4.21.6'), {'web3'})
Installing collected packages: lru-dict, bitarray, websockets, pycryptodome, protobuf, parsimonious, multidict, hexbytes, frozenlist, eth-typing, eth-hash, cytoolz, async-timeout, yarl, eth-utils, aiosignal, rlp, mplcyberpunk, eth-keys, eth-abi, aiohttp, eth-rlp, eth-keyfile, eth-account, web3
  Attempting uninstall: protobuf
    Found existing installation: protobuf 3.20.3
    Uninstalling protobuf-3.20.3:
      Successfully uninstalled protobuf-3.20.3
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 bitarray-2.7.3 cytoolz-0.12.1 eth-abi-4.0.0 eth-account-0.8.0 eth-hash-0.5.1 eth-keyfile-0.6.1 eth-keys-0.4.0 eth-rlp-0.3.0 eth-typing-3.3.0 eth-utils-2.1.0 frozenlist-1.3.3 hexbytes-0.3.0 lru-dict-1.1.8 mplcyberpunk-0.6.0 multidict-6.0.4 parsimonious-0.9.0 protobuf-4.22.3 pycryptodome-3.17 rlp-3.0.0 web3-6.2.0 websockets-11.0.2 yarl-1.9.2
[2]
1s

I have installed the latest version of protobuf: protobuf==4.22.3

I do not see a version 3.20.3 in /usr/local/lib/python3.10/dist-packages

kclowes commented 1 year ago

@anthonygtellez We require protobuf>=4.21.6, so I'd just try installing again in a fresh environment.