{"id":24120,"library":"nornir","title":"Nornir","description":"Nornir is a pluggable multi-threaded automation framework with inventory management for operating collections of network devices. It provides a pure Python approach to network automation without relying on a DSL. Current version is 3.5.0 (2024-09-16), released several times a year.","status":"active","version":"3.5.0","language":"python","source_language":"en","source_url":"https://github.com/nornir-automation/nornir","tags":["network-automation","inventory","multi-threaded","networking","automation-framework"],"install":[{"cmd":"pip install nornir","lang":"bash","label":"Install Nornir"},{"cmd":"pip install nornir[paramiko]","lang":"bash","label":"Install with Paramiko support"}],"dependencies":[{"reason":"Provides common tasks like netmiko_send_command, napalm_get, etc.","package":"nornir-utils","optional":true}],"imports":[{"note":"InitNornir is in the top-level nornir package since v3.0.","wrong":"from nornir.core import InitNornir","symbol":"InitNornir","correct":"from nornir import InitNornir"},{"note":"","wrong":"","symbol":"NRF","correct":"from nornir.plugins.functions import NRF"},{"note":"The F class is used for filtering hosts.","wrong":"from nornir import Filter","symbol":"Filter","correct":"from nornir.core.filter import F"}],"quickstart":{"code":"from nornir import InitNornir\nfrom nornir.core.task import Task, Result\n\n# Create a simple inventory definition inline\nnr = InitNornir(\n    inventory={\n        \"plugin\": \"DictInventory\",\n        \"options\": {\n            \"hosts\": {\n                \"router1\": {\n                    \"hostname\": \"192.0.2.1\",\n                    \"username\": \"admin\",\n                    \"password\": \"password\"\n                }\n            }\n        }\n    }\n)\n\n# Define a task\ndef hello_task(task: Task) -> Result:\n    return Result(host=task.host, result=f\"Hello from {task.host.name}\")\n\n# Run the task\nresults = nr.run(task=hello_task)\nprint(results['router1'][0].result)\n\n# Close connections if any\nnr.close_connections()","lang":"python","description":"Basic example: initialize Nornir with an inline dict inventory, run a simple task, and print the result."},"warnings":[{"fix":"Follow the official upgrade guide at https://nornir.readthedocs.io/en/latest/upgrading/2_to_3.html","message":"Nornir 3.x introduced a completely new API compared to 2.x. The `InitNornir` function, inventory structure, and task execution model changed significantly. Existing Nornir 2.x code will not work without migration.","severity":"breaking","affected_versions":"3.0.0+"},{"fix":"Use the `SerialRunner` to run tasks sequentially: `InitNornir(runner={'plugin': 'SerialRunner'})`","message":"Nornir's default runner is `ThreadedRunner`, which uses threading. This may cause issues with libraries that are not thread-safe (e.g., some SSH libraries).","severity":"gotcha","affected_versions":"3.x"},{"fix":"Use `'plugin': 'ThreadedRunner'` instead of `'plugin': 'ParallelRunner'`","message":"The `ParallelRunner` plugin was renamed to `ThreadedRunner` in v3.0.0a4. Using `ParallelRunner` will raise a deprecation warning.","severity":"deprecated","affected_versions":"3.0.0+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install nornir`","cause":"Nornir is not installed.","error":"ModuleNotFoundError: No module named 'nornir'"},{"fix":"Ensure you are using the correct plugin names and options as per Nornir 3 documentation. For DictInventory, use `inventory={'plugin': 'DictInventory', 'options': {...}}`","cause":"The configuration dictionary passed to InitNornir does not match the expected schema (e.g., using a plugin not recognized).","error":"nornir.core.exceptions.NornirUnsupportedConfigSchema: Unsupported config schema"},{"fix":"Define your task function like: `def my_task(task: Task) -> Result: host = task.host`","cause":"In Nornir 3, task function should accept a `Task` object, not a hostname string. The first argument is the task instance, and the host is accessed via `task.host`.","error":"AttributeError: 'str' object has no attribute 'name'"},{"fix":"Ensure you are using Nornir 3.x and that your task function is defined correctly (accepts a single `task` argument).","cause":"Using Nornir 2.x style `nr.run()`. In Nornir 3, the method is `nr.run()` but the task function signature changed. If you see this error, you might be using an old version or mixing APIs.","error":"AttributeError: 'Nornir' object has no attribute 'run'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}