ethereum / web3.py

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

RuntimeError: There is no current event loop in thread 'MainThread'. #3415

Closed shilkazx closed 3 months ago

shilkazx commented 3 months ago

What happened?

Python raise error while importing web3.

Code that produced the error

These code would trigger the same exception.
`import web3`
or
`from web3 import Web3, EthereumTesterProvider`

Full error output

In [1]: from web3 import Web3, EthereumTesterProvider
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[1], line 1
----> 1 from web3 import Web3, EthereumTesterProvider

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/__init__.py:14
      9     from importlib.metadata import version
     11     __version__ = version("web3")
---> 14 from web3.main import (
     15     AsyncWeb3,
     16     Web3,
     17 )
     18 from web3.providers.async_rpc import (  # noqa: E402
     19     AsyncHTTPProvider,
     20 )
     21 from web3.providers.eth_tester import (  # noqa: E402
     22     EthereumTesterProvider,
     23 )

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/main.py:78
     70 from web3._utils.encoding import (
     71     hex_encode_abi_type,
     72     to_hex,
     73     to_json,
     74 )
     75 from web3._utils.rpc_abi import (
     76     RPC,
     77 )
---> 78 from web3._utils.module import (
     79     attach_modules as _attach_modules,
     80 )
     81 from web3._utils.normalizers import (
     82     abi_ens_resolver,
     83 )
     84 from web3.eth import (
     85     AsyncEth,
     86     Eth,
     87 )

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/_utils/module.py:18
      5 from typing import (
      6     TYPE_CHECKING,
      7     Any,
   (...)
     12     Union,
     13 )
     15 from web3.exceptions import (
     16     Web3ValidationError,
     17 )
---> 18 from web3.module import (
     19     Module,
     20 )
     22 if TYPE_CHECKING:
     23     from web3.main import BaseWeb3  # noqa: F401

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/module.py:29
     21 from web3._utils.filters import (
     22     AsyncLogFilter,
     23     LogFilter,
     24     _UseExistingFilter,
     25 )
     26 from web3.method import (
     27     Method,
     28 )
---> 29 from web3.providers.persistent import (
     30     PersistentConnectionProvider,
     31 )
     32 from web3.types import (
     33     RPCEndpoint,
     34     RPCResponse,
     35 )
     37 if TYPE_CHECKING:

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/providers/__init__.py:17
     11 from .ipc import (
     12     IPCProvider,
     13 )
     14 from .rpc import (
     15     HTTPProvider,
     16 )
---> 17 from .websocket import (
     18     WebsocketProvider,
     19     WebsocketProviderV2,
     20 )
     21 from .persistent import (
     22     PersistentConnectionProvider,
     23 )
     24 from .auto import (
     25     AutoProvider,
     26 )

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/providers/websocket/__init__.py:9
      1 from .websocket import (
      2     DEFAULT_WEBSOCKET_TIMEOUT,
      3     RESTRICTED_WEBSOCKET_KWARGS,
      4     WebsocketProvider,
      5 )
      6 from .websocket_connection import (
      7     WebsocketConnection,
      8 )
----> 9 from .websocket_v2 import (
     10     WebsocketProviderV2,
     11 )

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/providers/websocket/websocket_v2.py:29
     21 from websockets.exceptions import (
     22     WebSocketException,
     23 )
     25 from web3.exceptions import (
     26     ProviderConnectionError,
     27     Web3ValidationError,
     28 )
---> 29 from web3.providers.persistent import (
     30     PersistentConnectionProvider,
     31 )
     32 from web3.types import (
     33     RPCEndpoint,
     34     RPCResponse,
     35 )
     37 DEFAULT_PING_INTERVAL = 30  # 30 seconds

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/providers/persistent.py:38
     30 from web3.types import (
     31     RPCId,
     32     RPCResponse,
     33 )
     35 DEFAULT_PERSISTENT_CONNECTION_TIMEOUT = 50.0
---> 38 class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
     39     logger = logging.getLogger("web3.providers.PersistentConnectionProvider")
     40     has_persistent_connection = True

File ~/miniforge3/envs/ray/lib/python3.9/site-packages/web3/providers/persistent.py:48, in PersistentConnectionProvider()
     46 _request_processor: RequestProcessor
     47 _message_listener_task: Optional["asyncio.Task[None]"] = None
---> 48 _listen_event: asyncio.Event = asyncio.Event()
     50 def __init__(
     51     self,
     52     request_timeout: float = DEFAULT_PERSISTENT_CONNECTION_TIMEOUT,
   (...)
     55     silence_listener_task_exceptions: bool = False,
     56 ) -> None:
     57     super().__init__()

File ~/miniforge3/envs/ray/lib/python3.9/asyncio/locks.py:177, in Event.__init__(self, loop)
    175 self._value = False
    176 if loop is None:
--> 177     self._loop = events.get_event_loop()
    178 else:
    179     self._loop = loop

File ~/miniforge3/envs/ray/lib/python3.9/asyncio/events.py:642, in BaseDefaultEventLoopPolicy.get_event_loop(self)
    639     self.set_event_loop(self.new_event_loop())
    641 if self._local._loop is None:
--> 642     raise RuntimeError('There is no current event loop in thread %r.'
    643                        % threading.current_thread().name)
    645 return self._local._loop

RuntimeError: There is no current event loop in thread 'MainThread'.

Fill this section in if you know how this could or should be fixed

I've done simple google work and search the issues, but found nothing.

web3 Version

6.16.0(conda)/6.19.0(pip)

Python Version

3.9.18(conda env)

Operating System

Archlinux x64

Output from pip freeze

absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1695154477682/work
aiohttp @ file:///home/conda/feedstock_root/build_artifacts/aiohttp_1696765431437/work
aiohttp-cors==0.7.0
aiorwlock @ file:///home/conda/feedstock_root/build_artifacts/aiorwlock_1649144056182/work
aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work
aiosqlite @ file:///home/conda/feedstock_root/build_artifacts/aiosqlite_1682491975081/work
akracer==0.0.13
akshare==1.13.89
aktools==0.0.83
alembic @ file:///home/conda/feedstock_root/build_artifacts/alembic_1705179948871/work
anyio @ file:///home/conda/feedstock_root/build_artifacts/anyio_1688651106312/work/dist
apprise @ file:///home/conda/feedstock_root/build_artifacts/apprise_1711818600014/work
asgi-lifespan @ file:///home/conda/feedstock_root/build_artifacts/asgi-lifespan_1680033598692/work
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1698341106958/work
astunparse @ file:///home/conda/feedstock_root/build_artifacts/astunparse_1610696312422/work
async-exit-stack @ file:///home/conda/feedstock_root/build_artifacts/async-exit-stack_1617751130790/work
async-generator==1.10
async-timeout @ file:///home/conda/feedstock_root/build_artifacts/async-timeout_1691763562544/work
asyncpg @ file:///home/conda/feedstock_root/build_artifacts/asyncpg_1700296457210/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1683424013410/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1687772187254/work
bcrypt @ file:///home/conda/feedstock_root/build_artifacts/bcrypt_1702663839147/work
beautifulsoup4 @ file:///home/conda/feedstock_root/build_artifacts/beautifulsoup4_1680888073205/work
bitarray @ file:///opt/conda/conda-bld/bitarray_1657739645104/work
blessed @ file:///home/conda/feedstock_root/build_artifacts/blessed_1666523113356/work
blinker @ file:///home/conda/feedstock_root/build_artifacts/blinker_1698890160476/work
Brotli @ file:///home/conda/feedstock_root/build_artifacts/brotli-split_1687884021435/work
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
cachetools @ file:///home/conda/feedstock_root/build_artifacts/cachetools_1698197297464/work
certifi @ file:///croot/certifi_1717618050233/work/certifi
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1696001742886/work
chardet @ file:///home/conda/feedstock_root/build_artifacts/chardet_1695468599471/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1698005359935/work
CherryPy==3.2.4
click @ file:///home/conda/feedstock_root/build_artifacts/click_1692311806742/work
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1674202310934/work
coconut-develop==3.1.0.post0.dev15
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
colorful @ file:///home/conda/feedstock_root/build_artifacts/colorful_1605540393928/work
coolname @ file:///home/conda/feedstock_root/build_artifacts/coolname_1673305982850/work
cPyparsing==2.4.7.2.4.0
croniter @ file:///home/conda/feedstock_root/build_artifacts/croniter_1686929181238/work
cryptography @ file:///home/conda/feedstock_root/build_artifacts/cryptography-split_1698192008573/work
cytoolz @ file:///croot/cytoolz_1701723583781/work
dataclasses @ file:///home/conda/feedstock_root/build_artifacts/dataclasses_1628958434797/work
dateparser @ file:///home/conda/feedstock_root/build_artifacts/dateparser_1700222000722/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work
distlib @ file:///home/conda/feedstock_root/build_artifacts/distlib_1689598491484/work
dm-tree @ file:///home/conda/feedstock_root/build_artifacts/dm-tree_1690203138977/work
docker @ file:///home/conda/feedstock_root/build_artifacts/docker-py_1688805481281/work
et-xmlfile @ file:///home/conda/feedstock_root/build_artifacts/et_xmlfile_1674664118162/work
eth-account @ file:///home/conda/feedstock_root/build_artifacts/eth-account_1707252998264/work
eth-hash @ file:///home/conda/feedstock_root/build_artifacts/eth-hash_1709627450795/work
eth-keyfile @ file:///home/conda/feedstock_root/build_artifacts/eth-keyfile_1713976682364/work
eth-keys @ file:///home/conda/feedstock_root/build_artifacts/eth-keys_1714062565492/work
eth-rlp @ file:///home/conda/feedstock_root/build_artifacts/eth-rlp_1708101160261/work
eth-typing @ file:///home/conda/feedstock_root/build_artifacts/eth-typing_1716475541654/work
eth-utils @ file:///home/conda/feedstock_root/build_artifacts/eth-utils_1716553571307/work
eth_abi @ file:///home/conda/feedstock_root/build_artifacts/eth-abi_1714506132099/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1692026125334/work
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1698579936712/work
Farama-Notifications @ file:///home/conda/feedstock_root/build_artifacts/farama-notifications_1684258120643/work
fastapi @ file:///home/conda/feedstock_root/build_artifacts/fastapi_1695951101499/work
filelock @ file:///home/conda/feedstock_root/build_artifacts/filelock_1698444591096/work
flatbuffers @ file:///home/conda/feedstock_root/build_artifacts/python-flatbuffers_1685164110706/work
frozenlist @ file:///home/conda/feedstock_root/build_artifacts/frozenlist_1695377824562/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1697919321618/work
gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1596839682936/work
gmpy2 @ file:///home/conda/feedstock_root/build_artifacts/gmpy2_1666808679441/work
google-api-core @ file:///home/conda/feedstock_root/build_artifacts/google-api-core-split_1695727073142/work
google-auth @ file:///home/conda/feedstock_root/build_artifacts/google-auth_1696932781355/work
google-auth-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/google-auth-oauthlib_1688235217226/work
google-pasta==0.2.0
googleapis-common-protos @ file:///home/conda/feedstock_root/build_artifacts/googleapis-common-protos-feedstock_1697198464829/work
gpustat @ file:///home/conda/feedstock_root/build_artifacts/gpustat_1692786716371/work
graphviz @ file:///home/conda/feedstock_root/build_artifacts/python-graphviz_1711016462626/work
greenlet @ file:///home/conda/feedstock_root/build_artifacts/greenlet_1703201596137/work
griffe @ file:///home/conda/feedstock_root/build_artifacts/griffe_1710874329828/work
grpcio @ file:///home/conda/feedstock_root/build_artifacts/grpc-split_1690942284331/work
gymnasium @ file:///home/conda/feedstock_root/build_artifacts/gymnasium-split_1684337014007/work
h11 @ file:///home/conda/feedstock_root/build_artifacts/h11_1664132893548/work
h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1634280454336/work
h5py @ file:///home/conda/feedstock_root/build_artifacts/h5py_1696885413992/work
hexbytes @ file:///home/conda/feedstock_root/build_artifacts/hexbytes_1686323307270/work
hpack==4.0.0
html5lib @ file:///home/conda/feedstock_root/build_artifacts/html5lib_1592930327044/work
httpcore @ file:///home/conda/feedstock_root/build_artifacts/httpcore_1711596990900/work
httpx @ file:///home/conda/feedstock_root/build_artifacts/httpx_1708530890843/work
hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1619110129307/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work
imagecodecs @ file:///home/conda/feedstock_root/build_artifacts/imagecodecs_1692293703666/work
imageio @ file:///home/conda/feedstock_root/build_artifacts/imageio_1696854106455/work
IMAPClient @ file:///home/conda/feedstock_root/build_artifacts/imapclient_1701511105986/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1688754491823/work
importlib-resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1695414790617/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1673103042956/work
ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1701831663892/work
jax @ file:///home/conda/feedstock_root/build_artifacts/jax_1698427139406/work
jax-jumpy @ file:///home/conda/feedstock_root/build_artifacts/jax-jumpy_1679161251636/work
jaxlib==0.4.14
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1696326070614/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1654302431367/work
jsonpatch @ file:///home/conda/feedstock_root/build_artifacts/jsonpatch_1695536281965/work
jsonpath==0.82
jsonpointer @ file:///home/conda/feedstock_root/build_artifacts/jsonpointer_1695397261020/work
jsonrpcclient==4.0.3
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema-meta_1695228989494/work
jsonschema-specifications @ file:///home/conda/feedstock_root/build_artifacts/jsonschema-specifications_1689701150890/work
keras @ file:///home/conda/feedstock_root/build_artifacts/keras_1679712543761/work/keras-2.12.0-py2.py3-none-any.whl
Keras-Preprocessing @ file:///home/conda/feedstock_root/build_artifacts/keras-preprocessing_1610713559828/work
kubernetes @ file:///home/conda/feedstock_root/build_artifacts/python-kubernetes_1689680899878/work
lazy_loader @ file:///home/conda/feedstock_root/build_artifacts/lazy_loader_1692295373316/work
lru-dict @ file:///home/conda/feedstock_root/build_artifacts/lru-dict_1695557480824/work
lxml @ file:///home/conda/feedstock_root/build_artifacts/lxml_1695546708845/work
lz4 @ file:///home/conda/feedstock_root/build_artifacts/lz4_1695448703528/work
Mako @ file:///home/conda/feedstock_root/build_artifacts/mako_1706629259024/work
Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1698797478597/work
markdown-it-py @ file:///home/conda/feedstock_root/build_artifacts/markdown-it-py_1686175045316/work
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1695367432301/work
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1713250518406/work
mdurl @ file:///home/conda/feedstock_root/build_artifacts/mdurl_1639515908913/work
ml-dtypes @ file:///home/conda/feedstock_root/build_artifacts/ml_dtypes_1697644156873/work
mpmath @ file:///home/conda/feedstock_root/build_artifacts/mpmath_1678228039184/work
msgpack @ file:///home/conda/feedstock_root/build_artifacts/msgpack-python_1695464112187/work
multidict @ file:///home/conda/feedstock_root/build_artifacts/multidict_1696716066079/work
networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1698504735452/work
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1695290879892/work/dist/numpy-1.26.0-cp39-cp39-linux_x86_64.whl#sha256=2145d30cdd6d3c9c4a4be216bb158edeac64e1c9aba388e733918d65b9481735
nvidia-ml-py @ file:///home/conda/feedstock_root/build_artifacts/nvidia-ml-py_1693425331741/work
oauthlib @ file:///home/conda/feedstock_root/build_artifacts/oauthlib_1666056362788/work
opencensus @ file:///home/conda/feedstock_root/build_artifacts/opencensus_1695079360989/work
opencensus-context @ file:///home/conda/feedstock_root/build_artifacts/opencensus-context_1695549766324/work
openpyxl @ file:///home/conda/feedstock_root/build_artifacts/openpyxl_1695464698612/work
opt-einsum @ file:///home/conda/feedstock_root/build_artifacts/opt_einsum_1696448916724/work
orjson @ file:///home/conda/feedstock_root/build_artifacts/orjson_1708717159352/work/target/wheels/orjson-3.9.15-cp39-cp39-linux_x86_64.whl#sha256=bb51ae543114c77f517c91158b37803f0c6d5cf4b1619390fa5938f4d83b4660
overrides @ file:///home/conda/feedstock_root/build_artifacts/overrides_1691338815398/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1696202382185/work
pandas @ file:///home/conda/feedstock_root/build_artifacts/pandas_1698375769637/work
paramiko @ file:///home/conda/feedstock_root/build_artifacts/paramiko_1703015906107/work
parsimonious @ file:///home/conda/feedstock_root/build_artifacts/parsimonious_1662537133900/work
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1712320355065/work
pathspec @ file:///home/conda/feedstock_root/build_artifacts/pathspec_1702249949303/work
pendulum @ file:///home/conda/feedstock_root/build_artifacts/pendulum_1695414695026/work
petl @ file:///home/conda/feedstock_root/build_artifacts/petl_1710290930740/work
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1706113125309/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
Pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1688255839723/work
pkgutil_resolve_name @ file:///home/conda/feedstock_root/build_artifacts/pkgutil-resolve-name_1694617248815/work
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/platformdirs_1683850015520/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1706116770704/work
prefect @ file:///home/conda/feedstock_root/build_artifacts/prefect_1711733797499/work
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1689032443210/work
prompt-toolkit @ file:///croot/prompt-toolkit_1704404351921/work
protobuf==4.21.12
psutil @ file:///home/conda/feedstock_root/build_artifacts/psutil_1695367186825/work
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pure-eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1642875951954/work
py-mini-racer==0.6.0
pyarrow==12.0.1
pyasn1 @ file:///home/conda/feedstock_root/build_artifacts/pyasn1_1694615621498/work
pyasn1-modules @ file:///home/conda/feedstock_root/build_artifacts/pyasn1-modules_1695107857548/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
pycryptodome @ file:///tmp/abs_37803fe8-caa0-41e9-b46c-dd275bf06bb4yhm6qpiu/croots/recipe/pycryptodome_1658310990674/work
pydantic @ file:///home/conda/feedstock_root/build_artifacts/pydantic_1697791018681/work
Pygments==2.18.0
PyJWT @ file:///home/conda/feedstock_root/build_artifacts/pyjwt_1689721553971/work
PyNaCl @ file:///home/conda/feedstock_root/build_artifacts/pynacl_1695544861128/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1685514481738/work
pypinyin @ file:///home/conda/feedstock_root/build_artifacts/pypinyin_1684272877456/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1709992573517/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
python-multipart @ file:///home/conda/feedstock_root/build_artifacts/python-multipart_1679167423335/work
python-slugify @ file:///home/conda/feedstock_root/build_artifacts/python-slugify-split_1707425621764/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1693930252784/work
pytzdata @ file:///home/conda/feedstock_root/build_artifacts/pytzdata_1594644346367/work
pyu2f @ file:///home/conda/feedstock_root/build_artifacts/pyu2f_1604248910016/work
pyunormalize @ file:///home/conda/feedstock_root/build_artifacts/pyunormalize_1701632642283/work
PyWavelets @ file:///home/conda/feedstock_root/build_artifacts/pywavelets_1695567547297/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1695373447169/work
randomgen @ file:///home/conda/feedstock_root/build_artifacts/randomgen_1696549825783/work
ray==2.7.1
readchar @ file:///home/conda/feedstock_root/build_artifacts/readchar_1679045163536/work
referencing @ file:///home/conda/feedstock_root/build_artifacts/referencing_1691337268233/work
regex @ file:///home/conda/feedstock_root/build_artifacts/regex_1703393472284/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1684774241324/work
requests-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/requests-oauthlib_1643557462909/work
rich @ file:///home/conda/feedstock_root/build_artifacts/rich-split_1696096668362/work/dist
rlp @ file:///home/conda/feedstock_root/build_artifacts/rlp_1714057048370/work
rpds-py @ file:///home/conda/feedstock_root/build_artifacts/rpds-py_1697072262194/work
rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1658328885051/work
ruamel.yaml @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml_1707298118514/work
ruamel.yaml.clib @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml.clib_1707314520663/work
scikit-image @ file:///home/conda/feedstock_root/build_artifacts/scikit-image_1697028619953/work/dist/scikit_image-0.22.0-cp39-cp39-linux_x86_64.whl#sha256=42ab2afa3a2d8d73124519138271187262fb4aadc71ac831171fb60dca648680
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy-split_1696467636616/work/dist/scipy-1.11.3-cp39-cp39-linux_x86_64.whl#sha256=a6aac64ea98b312a6fc4eb9b64913750b470af13ea37187c2f28d685ab103fde
setproctitle @ file:///home/conda/feedstock_root/build_artifacts/setproctitle_1696431172984/work
shellingham @ file:///home/conda/feedstock_root/build_artifacts/shellingham_1698144360966/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
smart-open @ file:///home/conda/feedstock_root/build_artifacts/smart_open_split_1694066705667/work/dist
sniffio @ file:///home/conda/feedstock_root/build_artifacts/sniffio_1662051266223/work
soupsieve @ file:///home/conda/feedstock_root/build_artifacts/soupsieve_1693929250441/work
SQLAlchemy @ file:///home/conda/feedstock_root/build_artifacts/sqlalchemy_1703940364228/work
stack-data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work
starlette @ file:///home/conda/feedstock_root/build_artifacts/starlette-recipe_1684245096404/work
sympy @ file:///home/conda/feedstock_root/build_artifacts/sympy_1684180540116/work
tabulate @ file:///home/conda/feedstock_root/build_artifacts/tabulate_1665138452165/work
tensorboard @ file:///home/conda/feedstock_root/build_artifacts/tensorboard_1683119049001/work/tensorboard-2.12.3-py3-none-any.whl#sha256=b4a69366784bc347e02fbe7d847e01896a649ca52f8948a11005e205dcf724fb
tensorboard-data-server @ file:///home/conda/feedstock_root/build_artifacts/tensorboard-data-server_1695425348895/work/tensorboard_data_server-0.7.0-py3-none-manylinux2014_x86_64.whl#sha256=c3327dfe496d955cacc10e4977436bc235dece0c0640c862ede133f2fd842b28
tensorboardX @ file:///home/conda/feedstock_root/build_artifacts/tensorboardx_1692548726750/work
tensorflow @ file:///home/conda/feedstock_root/build_artifacts/tensorflow-split_1696285825226/work/tensorflow_pkg/tensorflow-2.12.1-cp39-cp39-linux_x86_64.whl#sha256=2823dd98dd999ba679cd16515f44c50b97395057a447e5dc01e99dbf8e297bb0
tensorflow-estimator @ file:///home/conda/feedstock_root/build_artifacts/tensorflow-split_1696285825226/work/tensorflow-estimator/wheel_dir/tensorflow_estimator-2.12.0-py2.py3-none-any.whl#sha256=af6a1c1136f861af90b593ccb90089e7c683033463e4c730c6bb4f488e2316f1
termcolor @ file:///home/conda/feedstock_root/build_artifacts/termcolor_1682317048417/work
text-unidecode @ file:///home/conda/feedstock_root/build_artifacts/text-unidecode_1694707102786/work
tifffile @ file:///home/conda/feedstock_root/build_artifacts/tifffile_1695815014864/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
toolz @ file:///croot/toolz_1667464077321/work
torch==2.1.0
torchaudio==2.1.0
torchvision==0.16.0
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1691671248568/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1713535121073/work
typer @ file:///home/conda/feedstock_root/build_artifacts/typer_1683029246636/work
typing-utils @ file:///home/conda/feedstock_root/build_artifacts/typing_utils_1622899189314/work
typing_extensions==4.12.1
tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1680081134351/work
tzlocal @ file:///home/conda/feedstock_root/build_artifacts/tzlocal_1698012956072/work
ujson @ file:///home/conda/feedstock_root/build_artifacts/ujson_1702256699592/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1697720414277/work
uvicorn @ file:///home/conda/feedstock_root/build_artifacts/uvicorn-split_1695566113922/work
virtualenv @ file:///home/conda/feedstock_root/build_artifacts/virtualenv_1678703647856/work
watchfiles @ file:///home/conda/feedstock_root/build_artifacts/watchfiles_1695545924017/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1696255154857/work
web3==6.19.0
webencodings @ file:///home/conda/feedstock_root/build_artifacts/webencodings_1694681268211/work
websocket-client @ file:///home/conda/feedstock_root/build_artifacts/websocket-client_1701630677416/work
websockets @ file:///home/conda/feedstock_root/build_artifacts/websockets_1695409988029/work
Werkzeug @ file:///home/conda/feedstock_root/build_artifacts/werkzeug_1698235201373/work
wrapt @ file:///home/conda/feedstock_root/build_artifacts/wrapt_1695409056740/work
xlrd @ file:///home/conda/feedstock_root/build_artifacts/xlrd_1610224409810/work
xlwings @ file:///home/conda/feedstock_root/build_artifacts/xlwings_1695889616244/work
yarl @ file:///home/conda/feedstock_root/build_artifacts/yarl_1696732508422/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1695255097490/work
BlockGeeks0x01 commented 3 months ago

Got the same error

kclowes commented 3 months ago

I'm not able to replicate. I suspect it's an environment issue. Try in a fresh environment, and if you're still seeing this issue, reopen with more info.

epetrianou-ubi commented 3 months ago

Same here, we got the error while initiating a django server at a local machine (attached screenshots), with a Python 3.8 venv and the below libraries installed:

aiohttp==3.9.5
aiosignal==1.3.1
asgiref==3.8.1
async-timeout==4.0.3
attrs==23.2.0
backports.zoneinfo==0.2.1
bitarray==2.9.2
certifi==2024.7.4
charset-normalizer==3.3.2
ckzg==1.0.2
cytoolz==0.12.3
Django==4.2.13
djangorestframework==3.14.0
djangorestframework-simplejwt==5.3.0
eth-account==0.11.2
eth-hash==0.7.0
eth-keyfile==0.8.1
eth-keys==0.5.1
eth-rlp==1.0.1
eth-typing==4.3.1
eth-utils==4.1.1
eth_abi==5.1.0
frozenlist==1.4.1
hexbytes==0.3.1
idna==3.7
importlib_resources==6.4.0
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
lru-dict==1.2.0
multidict==6.0.5
parsimonious==0.10.0
pkgutil_resolve_name==1.3.10
protobuf==5.27.2
psycopg2-binary==2.9.9
pycryptodome==3.20.0
PyJWT==2.8.0
python-decouple==3.8
pytz==2024.1
pyunormalize==15.1.0
referencing==0.35.1
regex==2024.5.15
requests==2.32.3
rlp==4.0.1
rpds-py==0.18.1
sqlparse==0.5.0
toolz==0.12.1
typing_extensions==4.12.2
urllib3==2.2.2
web3==6.20.0
websockets==12.0
yarl==1.9.4
zipp==3.19.2

loop_error loop_error_2

Another environment with web3 version 6.9.0, worked with no problems, so for the above environment we also changed the version to 6.9.0 from 6.20.0, and the django server runs normally. It seems that everything starts with this import of web3 that triggers the asyncio.Event() call at the persistent.py file, that isn't probably part of the code at versions older than 6.10.0 (based also on the release notes).