Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Nornir installation

Khelil Sator edited this page Oct 29, 2019 · 5 revisions

Here's the steps to install Nornir

Ubuntu version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial

pip installation

install pip

$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt install -y python-pip python3-pip

Verify

$ pip -V
$ pip3 -V

Python versions

Ubuntu 16.04 comes with Python 2.7 and Python 3.5

$ python -V
Python 2.7.12
$ python2 -V
Python 2.7.12
$ python2.7 -V
Python 2.7.12
$ python3 -V
Python 3.5.2
$ python3.5 -V
Python 3.5.2

python 3.6 installation

python 3.6 doesnt come with Ubuntu 16.04.

$ python3.6 -V

you can NOT install python 3.6 using the below commands:

$ sudo apt-get install python3.6

Lets install python 3.6

This is an optionnal step (to get a more robust programming environment setup):

$ sudo apt-get install -y python-minimal build-essential libssl-dev libffi-dev python-dev libpq-dev openssl zlib1g-dev python3-pip python3-dev

Lets use PPA (Personal Package Archive) to install python 3.6

$ sudo apt-get install -y software-properties-common python-software-properties
$ sudo add-apt-repository ppa:jonathonf/python-3.6
$ sudo apt-get update
$ sudo apt-get install -y python3.6

Verify

$ python3.6 -V
Python 3.6.8

$ python3 -V
Python 3.5.2

$ python -V
Python 2.7.12

python virtual environment

Install virtualenv

sudo pip3 install virtualenv 

create a python virtual env:

  • myvenv is the name of the virtual environment
  • the default python version (in the python virtual environment myvenv) will be python3.6
$ virtualenv --python=python3.6 myvenv
$ ls myenv

Run this command to activate the python virtual environment

$ source myvenv/bin/activate

Verify the default python version is now python 3.6

$ python -V
Python 3.6.8

run the command deactivate when you want to deactivate the python virtual environment

Install Nornir

Run this command in the myvenv python virtual environment

$ pip3 install nornir

Verify Nornir is installed

Run this command in the myvenv python virtual environment to verify Nornir is installed

$ pip3 list

Nornir also installed Napalm, netmiko, junos-eznc, paramiko ....

Run theses commands in the myvenv python virtual environment to verify you can use Nornir

$ python
Python 3.6.8 (default, Oct  9 2019, 14:04:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from nornir import InitNornir
>>> exit()