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

ModuleNotFoundError: No module named 'ncs'

Sagar Patil
Cisco Employee
Cisco Employee

Hello Experts,

I am still exploring NSO and its features, was trying to execute some simple code but getting an error for "import ncs" in Pycharm. It works perfectly in terminal.

 

NSO - 4.6.1

Ubuntu - 18.04

Pythonpath - 

(venv) sagar@sagar-VirtualBox:~/PycharmProjects/Project-NSO2$ echo $PYTHONPATH
/home/ncs461//src/ncs/pyapi/

 

Is there any way I can point Pycharm to ncs module?

 

Thank you.

1 Accepted Solution

Accepted Solutions

vleijon
Cisco Employee
Cisco Employee

I am by no means a PyCharm expert, but I have done this once. In PyCharm you can setup a "Project Interpreter".

 

There are two ways of handling it, you can either create a virtual environment, and then make sure that the nso libraries are included in it, for instance by soft-linking it. Or, you can go to the plain environment and add loadpaths to that.

 

In preferences, under Project/project interpreter, I click the gear symbol  next to the project interpreter and pick "show all". This gives me a list of project interpreters where I can add new ones. Here you can also edit which loadpaths are used by the interpreter.

View solution in original post

1 Reply 1

vleijon
Cisco Employee
Cisco Employee

I am by no means a PyCharm expert, but I have done this once. In PyCharm you can setup a "Project Interpreter".

 

There are two ways of handling it, you can either create a virtual environment, and then make sure that the nso libraries are included in it, for instance by soft-linking it. Or, you can go to the plain environment and add loadpaths to that.

 

In preferences, under Project/project interpreter, I click the gear symbol  next to the project interpreter and pick "show all". This gives me a list of project interpreters where I can add new ones. Here you can also edit which loadpaths are used by the interpreter.