cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2958
Views
17
Helpful
1
Comments
rogaglia
Cisco Employee
Cisco Employee

I have had a number of customer in both local and system install facing the problem that their default python version is not compatible with NSO.

This is pretty common with Red Hat linux and CentOS where the official python version is 2.6. You cannot uninstall 2.6 as they will have issues with its system applications.

How can I tell NSO to run a different python version from the system default?

I found two options:

Option 1 (works both local and system install):

Basically the NSO python vms are started by running the start-command application that you can set like this:

admin@ncs% set python-vm

Possible completions:

  auto-restart    - NCS restarts the Python VM

  auto-start      - NCS starts the Python VM

  logging         - Configure Python Logging

  run-in-terminal - Run the VM inside a terminal such as xterm

  start-command   - Python VM start command

admin@ncs%

By default, the start-command is located here:

#cat $NCS_DIR/bin/ncs-start-python-vm

So, you can either edit that file or copy it into a new one (probably a better idea) that has the last line edited:

exec python -u ${main} $*

and you will replace the python command to the path of the correct python version.

Option 2 (tested for local installs only):

For a given user, you can create a shell alias in the bash_profile file:

alias python=/usr/local/bin/python2.7

This means that for that user and that shell, the python command is directed to a different binary.

I hope this helps!

Roque

1 Comment
PauloOliveira
Cisco Employee
Cisco Employee

Thanks Roque... This was very helpful to me today!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: