In case of an error, the following diagram is given:
Solution:
# download nest_asyncio
pip3 install nest_asyncio
Add the following two lines at the beginning of the asynchronous collaboration code, or in the code:
import nest_asyncio
nest_asyncio.apply()
After consulting the data, it is found that using the Jupiter notebook environment, it is connected to the IPython kernel, and the IPython kernel itself runs on the event loop, while asyncio does not allow nesting of its event loop
, so the error message as shown in the above figure will appear.
nest_asyncio exists as a patch for asynchronous operations.
Read More:
- Python asynchronous execution library asyncio
- [Solved] RuntimeError: run loop already started raise RuntimeError(‘run loop already started‘)
- Python3.6 Run uvicorn Error: AttributeError: module ‘asyncio‘ has no attribute ‘run‘
- Python Error: SyntaxError: ‘break‘ outside loop
- Opencv-python Install is Stuck Error: running setup.py bdist_wheel for opencv-python
- [How to Fix]RuntimeError: Python is not installed as a framework, If you are using (Ana)Conda
- [Solved] Python Error: “RuntimeError: ‘cryptography‘ package is required for sha256_password or caching_sha2_pas”
- [Solved] nn.BatchNorm1d Error: RuntimeError: running_mean should contain 1 elements not 512错误
- [Solved] python tqdm raise RuntimeError(“cannot join current thread“) RuntimeError: cannot join current thr
- [Solved] RuntimeError (note: full exception trace is shown but execution is paused at: <module>)
- [Solved] RuntimeError: Numpy is not available (Associated Torch or Tensorflow)
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- Autograd error in Python: runtimeerror: grad can be implicitly created only for scalar outputs
- [Solved] Python matplotlib Error: RuntimeError: In set_size: Could not set the fontsize…
- The solution of no such file or directory and cannot load native module running error of python3 pyinstaller after packaging
- Python environment error, bad interpreter: there is no file or directory
- [Solved] Jupyter notebook: TypeError: __init__() got an unexpected keyword argument ‘io_loop’
- [Solved] RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at
- [Solved] Pymysql Use Error: RuntimeError: ‘cryptography‘ package is required for sha256_password
- Python error: ‘int’ object is not callable