10-21-2018 01:04 PM - edited 03-01-2019 04:13 AM
Hello,
I've made a python package that I have install using pip, in NSO I have created a cli command that uses my python package but it failed : I want to know which python and pip NSO uses ? and how to create a script command using external python package in NSO ?
In bin/ncs-start-python I have set python3.4 to be used by NSO.
In a shell, when I perform pip3.4 freeze I have :
... my-package==0.0.1 ...
I have made a test to print it in NSO which showed this :
in test.sh :
set -e while [ $# -gt 0 ]; do case "$1" in --command) cat << EOF begin command modes: oper styles: c i j cmdpath: echo-totot help: echo toto end EOF exit ;; *) break ;; esac shift done echo `which python3.4` echo `which pip3.4` echo `pip3.4 freeze`
I performed a package reload, a script reload and launched my command :
rguilloux@ncs# echo-totot /usr/bin/python3.4 /usr/bin/pip3.4
So :
1- global python3.4 is used
2- global pip3.4 is used
3- It doesn't show any python package
How to use a pip package in NSO script command ?
Any help please ?
Romain
Solved! Go to Solution.
10-23-2018 09:16 AM
For running and testing ncs/python code/... in different Python environments I use virtualenv - I create a new or use existing virtual environment, switch to it and start NSO there, NSO and anything started from NSO happily picks whatever the environment provides. Looks to me this would work for you as well.
10-23-2018 09:16 AM
For running and testing ncs/python code/... in different Python environments I use virtualenv - I create a new or use existing virtual environment, switch to it and start NSO there, NSO and anything started from NSO happily picks whatever the environment provides. Looks to me this would work for you as well.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide