Install Junos PyEZ
SUMMARY You can install Junos PyEZ on a network management system, in a Python virtual environment, or as a Docker container.
Junos PyEZ is a Python library that enables you to manage and automate Junos devices. You can install Junos PyEZ on a UNIX-like operating system or on Windows. You have the option to install and run Junos PyEZ in one of the following ways:
Directly on the configuration management server
Within a Python virtual environment
As a Docker container
As an alternative to installing Junos PyEZ directly on the server, you can install it in a virtual environment. A Python virtual environment isolates a project’s Python installation and packages from those installed on the system or in other virtual environments, which prevents breaking the dependencies of other projects. You can create virtual environments when you have projects that require different versions of Python or Python packages or as an alternative to installing packages globally on the system.
Juniper Networks also provides a Junos PyEZ Docker image that enables you to run Junos PyEZ as a Docker container. The Docker container is a lightweight, self-contained system that bundles Junos PyEZ, its dependencies, and Python into a single portable container. The Docker image enables you to quickly run Junos PyEZ in interactive mode, as an executable package, or as a terminal on any platform that supports Docker.
To install Junos PyEZ on the configuration management server, see the following sections:
To install Junos PyEZ in a Python virtual environment, see the following sections:
To use the Junos PyEZ Docker image, see the following section:
Install Prerequisite Software
Before you install the Junos PyEZ library on the configuration management server or in a virtual environment, ensure that the configuration management server has the following software installed:
Python 3.8 or later
All prerequisite software for the given operating system, which is outlined in Table 1
Python 3.x is supported starting in Junos PyEZ Release 2.0.
Python 2.7 support is removed starting in Junos PyEZ Release 2.6.0.
Python 3.10 is supported starting in Junos PyEZ Release 2.7.0.
Operating System |
Package or Library |
---|---|
CentOS |
|
Debian |
|
Fedora |
|
FreeBSD |
|
OSX Note:
If Junos PyEZ does not successfully install using |
|
Ubuntu |
|
Windows |
|
Install Junos PyEZ on the Configuration Management Server
After you install the prerequisite software on the configuration management server, you can install the latest release of Junos PyEZ from the Python Package Index (PyPI) site. You can also download the latest version of the code from the Junos PyEZ GitHub repository. To install Junos PyEZ from GitHub, you must have Git installed on the configuration management server.
To install the current release of Junos PyEZ from PyPI, execute the following command (use
sudo
where appropriate):user@server:~$ sudo pip3 install junos-eznc
Note:To upgrade an existing version of Junos PyEZ, include the
-U
or--upgrade
option in the command.To install Junos PyEZ from the GitHub project master branch, execute the following command (use
sudo
where appropriate):user@server:~$ sudo pip3 install git+https://github.com/Juniper/py-junos-eznc.git
Note:The latest code in the GitHub source repository is under active development and might not be stable.
For additional information about installing Junos PyEZ, including additional installation options, see the INSTALL file for your specific operating system in the Junos PyEZ GitHub repository.
Install Junos PyEZ in a Python Virtual Environment
As an alternative to installing Python packages globally on a system, you can install the required packages and dependencies for a specific project in an isolated Python virtual environment. We recommend that you use Python 3 for your virtual environment.
To create a virtual Python 3 installation with Junos PyEZ on a Linux or macOS server:
Use the Junos PyEZ Docker Image
Docker is a software container platform that is used to package and run an application and its dependencies in an isolated container. Juniper Networks provides a Junos PyEZ Dockerfile as well as Junos PyEZ Docker images, which are automatically built for every Junos PyEZ release. Starting in Junos PyEZ Release 2.1.8, the Docker images include Python 3.6.
You can customize and use the Dockerfile to build your own Junos PyEZ Docker image, or you can use one of the prebuilt Docker images, which are stored on Docker Hub, to run Junos PyEZ as a Docker container. You can run the container in interactive mode, as an executable package, or as a terminal.
To use a prebuilt Junos PyEZ Docker image on your configuration management server: