04-07-2019 09:32 PM
I am trying to import the NSO Python package and it doesn't work. I sourced the required file ($ source nso-4.7/ncsrc). In Python when I try to import ncs I get this error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/user/nso-4.7/src/ncs/pyapi/ncs/__init__.py", line 20, in <module> import _ncs File "/Users/user/nso-4.7/src/ncs/pyapi/_ncs/__init__.py", line 5, in <module> from _ncs_py2 import cdb ImportError: No module named _ncs_py2 >>>
I don't have _ncs_py2. Do I have to re-compile?
ls src/ncs/pyapi/ total 64 -rw-r--r-- 1 user group 49B Jun 21 2018 MANIFEST.in -rw-r--r-- 1 user group 8.3K Jun 21 2018 Makefile -rw-r--r--@ 1 user group 1.3K Jun 21 2018 README.dist drwxr-xr-x 5 user group 160B Apr 8 14:23 _ncs -rw-r--r-- 1 user group 2.4K Jun 21 2018 build.py drwxr-xr-x 6 user group 192B Apr 4 10:43 doc drwxr-xr-x 3 user group 96B Jun 21 2018 ebin -rw-r--r-- 1 user group 6.0K Jun 21 2018 gen-constants.py drwxr-xr-x 13 user group 416B Jun 21 2018 include drwxr-xr-x 21 user group 672B Apr 8 14:23 ncs drwxr-xr-x 8 user group 256B Jun 21 2018 ncs_pyvm drwxr-xr-x 15 user group 480B Jun 21 2018 pysrc drwxr-xr-x 11 user group 352B Apr 4 10:45 src
04-10-2019 02:07 AM
_ncs_py2 is a shared library, I don't expect you to be able to compile the sources for that easily.
Do you have it? Should be called .../src/ncs/pyapi/_ncs/_ncs_py2.so
Which python version are you using? If you're not sure, try
>>> import sys
>>> sys.version
Which host OS are you using?
What is your Python path? echo $PYTHONPATH
04-10-2019 05:38 PM
The problem was resolved by reinstalling NSO. For some reason I didn't have _ncs_py2.so for the first install. I was using Mac os and Python 2.7.15. The PATH included '/Users/user/nso-4.7/src/ncs/pyapi'.
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