Troubleshoot jnpr.junos Import Errors
Problem
Description
Python generates an error message that the jnpr.junos
module was not found. For example:
from jnpr.junos import Device ImportError: No module named junos
Cause
The Juniper Networks Junos PyEZ Python library must be installed before importing the package and using it to perform operations on Junos devices.
Solution
Install Junos PyEZ on the configuration management server and update any necessary environment variables. For installation instructions, see Install Junos PyEZ.
To verify that Junos PyEZ is successfully installed,
start Python and import the jnpr.junos
package.
[user@server ~]$ python >>> import jnpr.junos >>> jnpr.junos.__version__ '2.2.0'
If the jnpr.junos
package is successfully
imported and there is no error message, then Junos PyEZ is correctly
installed.