Robotics StackExchange | Archived questions

Vscode with ms-python is not recognizing rospy and friends

I am using code-server which runs vscode in a web browser. It is served through a cluster running linux/ubuntu. The install includes many ros packages which are installed in /opt/ros/noetic/... in other words they are part of the Robot Operating System. They were not installed with Pip but with apt-get install xxx.

In this copy of vscode I have installed the ms-python extension and it works well. I see pop ups with helpful information on everything. Except libraries that were defined outside of pip.

I am not sure how to configure things so that ms-python sees all these libraries.

Asked by pitosalas on 2022-07-26 16:31:01 UTC

Comments

Answers

You need to use the ms-ros extension to generate the .settings file. It will also generate some *.vc.db files.

Here's an example of what it should look like when your setup will be properly completed:

{
"python.autoComplete.extraPaths": [
    "/opt/ros/noetic/lib/python3/dist-packages"
],
"python.analysis.extraPaths": [
    "/opt/ros/noetic/lib/python3/dist-packages"
],
"ros.distro": "noetic" }

Asked by Alex-SSoM on 2022-08-04 15:32:49 UTC

Comments