cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
634
Views
0
Helpful
1
Replies

NSO Python VM cannot load other python modules from system site-packages

ranamin
Cisco Employee
Cisco Employee

Hi All

I have set PYTHONPATH variable correctly (hopefully) and still cannot make NSO (v4.4.2) to load third party modules from system site-packages. i am getting following error in ncs-python-vm.log. Just FYI, the code execute fine outside of NSO VM when executed directly.

[root@localhost logs]# cat ncs-python-vm.log

2017-06-26 20:43:47 - Started PyVM: <<"ansible">> , Port=#Port<0.8378> , OSpid="19236"

2017-06-26 20:43:47 - ansible :: Starting /root/nso-4.4.2/src/ncs/pyapi/ncs_pyvm/startup.py -l info -f ./logs/ncs-python-vm -i ansible

2017-06-26 20:43:48 - ansible :: Traceback (most recent call last):

  File "/root/nso-4.4.2/src/ncs/pyapi/ncs_pyvm/startup.py", line 228, in start_components

    pname=pname, cname=cname, main_q=self.msg_sink)

  File "/root/nso-4.4.2/src/ncs/pyapi/ncs_pyvm/ncsthreads.py", line 152, in __init__

    mod = __import__(modname)

  File "/root/ncs-run/state/packages-in-use/1/ansible/python/ansible/action.py", line 7, in <module>

    from ansible.parsing.dataloader import DataLoader

ImportError: No module named parsing.dataloader

my pythonpath variable:

[root@localhost logs]# env | grep PYTHON

PYTHONPATH=/root/nso-4.4.2/src/ncs/pyapi:/usr/lib64/python27.zip:/usr/lib64/python2.7:/usr/lib64/python2.7/plat-linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-old:/usr/lib64/python2.7/lib-dynload:/usr/lib64/python2.7/site-packages:/usr/lib/python2.7/site-packages

What am i missing?

any help is much appreciated!

Regards

1 Reply 1

frjansso
Cisco Employee
Cisco Employee

Was the python path set when you started NSO? I suspect NSO copies whatever PYTHONPATH is set at startup.