{"id":24550,"library":"ryu","title":"Ryu","description":"Ryu is a component-based software-defined networking (SDN) framework that provides a set of APIs for network applications to manage and control network devices. The current version is 4.34. It has a stable release cadence with occasional updates.","status":"active","version":"4.34","language":"python","source_language":"en","source_url":"https://github.com/faucetsdn/ryu","tags":["SDN","OpenFlow","network controller","software-defined networking"],"install":[{"cmd":"pip install ryu","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for asynchronous I/O and hub.","package":"eventlet","optional":false},{"reason":"Required for URL routing in REST API.","package":"routes","optional":false}],"imports":[{"note":"Ryu is not installed as top-level modules; always import from 'ryu' package.","wrong":"import app_manager","symbol":"app_manager","correct":"from ryu.base import app_manager"},{"note":"set_ev_cls is in the controller.handler module, not base.","wrong":"from ryu.base.handler import set_ev_cls","symbol":"set_ev_cls","correct":"from ryu.controller.handler import set_ev_cls"}],"quickstart":{"code":"from ryu.base import app_manager\nfrom ryu.controller import ofp_event\nfrom ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls\nfrom ryu.ofproto import ofproto_v1_3\n\nclass MyController(app_manager.RyuApp):\n    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]\n\n    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, MAIN_DISPATCHER)\n    def switch_features_handler(self, ev):\n        datapath = ev.msg.datapath\n        ofproto = datapath.ofproto\n        parser = datapath.ofproto_parser\n        print(f\"Switch connected: {datapath.id}\")\n","lang":"python","description":"A minimal Ryu application that responds to switch connection events."},"warnings":[{"fix":"Use Python 3.6 or higher.","message":"Ryu removed support for Python 2.7 as of version 4.31. Attempting to use Python 2 will result in syntax errors.","severity":"breaking","affected_versions":">=4.31"},{"fix":"Use Ryu's REST API or import 'ryu.app.rest_topology' explicitly.","message":"The 'ryu-manager --observe-links' flag is deprecated in favor of using the REST API or topology discovery module directly.","severity":"deprecated","affected_versions":">=4.30"},{"fix":"Add 'OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]' (or appropriate version) in your RyuApp subclass.","message":"Ryu applications must declare the OFP_VERSIONS class variable. Omitting it causes silent failures or versions mismatches.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from ryu.base import app_manager' instead of 'import ryu.base as base'.","cause":"Typo or wrong import path; 'base' is a subpackage, not an attribute of the top-level ryu module.","error":"AttributeError: module 'ryu' has no attribute 'base'"},{"fix":"Check the actual location of the desired module; most functionality is now in 'ryu.ofproto' or 'ryu.controller'.","cause":"Ryu's 'lib' package was removed or restructured in newer versions.","error":"ImportError: No module named 'ryu.lib'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}