faucetsdn / ryu

Ryu component-based software defined networking framework
https://ryu-sdn.org
Apache License 2.0
1.5k stars 1.16k forks source link

Possible eventlet issue breaks `simple_switch` #180

Open lantz opened 1 year ago

lantz commented 1 year ago

On Ubuntu 22.04, I'm seeing this error which may be related to #138 .

$ ryu run simple_switch
Traceback (most recent call last):
  File "/usr/local/bin/ryu", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/ryu/cmd/ryu_base.py", line 72, in main
    subcmd_mod = utils.import_module(subcmd_mod_name)
  File "/usr/local/lib/python3.10/dist-packages/ryu/utils.py", line 108, in import_module
    return importlib.import_module(modname)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/ryu/cmd/manager.py", line 33, in <module>
    from ryu.app import wsgi
  File "/usr/local/lib/python3.10/dist-packages/ryu/app/wsgi.py", line 109, in <module>
    class _AlreadyHandledResponse(Response):
  File "/usr/local/lib/python3.10/dist-packages/ryu/app/wsgi.py", line 111, in _AlreadyHandledResponse
    from eventlet.wsgi import ALREADY_HANDLED
ImportError: cannot import name 'ALREADY_HANDLED' from 'eventlet.wsgi' (/home/openflow/.local/lib/python3.10/site-packages/eventlet/wsgi.py)

$ pip3 list | egrep 'ryu|eventlet|dnspython'
dnspython                     2.2.1
eventlet                      0.33.1
ryu                           4.34

$ pip3 --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
lantz commented 1 year ago

Note to get to that point I had to downgrade dnspython from 2.3.0 to 2.2.1 to avoid another error:

File "/usr/local/lib/python3.10/dist-packages/dns/zone.py", line 86, in <module>
    class Zone(dns.transaction.TransactionManager):
  File "/usr/local/lib/python3.10/dist-packages/dns/zone.py", line 757, in Zone
    ) -> dns.rdtypes.ANY.SOA.SOA:
AttributeError: module 'dns.rdtypes' has no attribute 'ANY'
991jo commented 1 year ago

Looks like the issue is a change of the eventlet API in eventlet 0.30.3: https://github.com/benoitc/gunicorn/pull/2581

However downgrading to older versions of eventlet only leads to other errors.

haseebkhan611 commented 7 months ago

I resolved this issue by creating a venv and downgrading eventlet to 0.30.2

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install virtualenv python3.9 python3.9-distutils

#create the virtualenv 
virtualenv -p`which python3.9` ryu-python3.9-venv
source ryu-python3.9-venv/bin/activate
echo $VIRTUAL_ENV #check if we are indeed in the virtual environment
pip install ryu
pip uninstall eventlet
pip install eventlet==0.30.2
ryu-manager --help

Reference: https://github.com/faucetsdn/ryu/issues/169#issuecomment-1537440144

AnthonVal21 commented 5 months ago

Gracias amigo [haseebkhan611] , tenia ese problema y puede solucionarlo .