Let me clarify the title a bit, thats basically my general assumption as I was working around some stuff with python virtual environment where to put it simply I have done the following steps
python3 -m venv .venv
source .venv/bin/activate
and I just continue developing my python stuff. Then I deactivate the virtual environment once I was done. Please note that before all of this, I have successfully ran my vscode ros debugger fine.
After a few days, I had to debug some bugs I found in my ROS code. As I ran my vscode ros debugger with the following configuration, I am getting the following error
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ROS: Launch",
"type": "ros",
"request": "launch",
"target": "/home/khalidowlwalid/eufs-master/install/eufs_sim2/share/eufs_sim2/launch/eufs_sim2.launch.py",
}
]
}
Error:
...
...
ModuleNotFoundError: No module named 'yaml'
This configuration used to work before without any problems!
I then decided to add an extra argument to my launch.json
file which is shown below:
"env": {
"PYTHONPATH": "/usr/bin/python3.10"
}
I manage to overcome the yaml
module error, but as I keep adding more to the $PYTHONPATH
, I found myself in a dead end where I keep on circulating to the same problem.
Here are some notes on this:
- My ROS node still execute just fine if I use the terminal, which I call my ‘launch.py’ file
- The vscode ros debugger fails to launch the ‘launch.py’ file and keeps complaining about missing modules
- While using my python virtual environment, I installed a lot of modules
I personally doubt the python virtual environment is the issue, but this is simply me tracing back my steps. I cant say for sure what causes it.
2nd Note:
I notice vscode calls the python3
alias, so I check my alias and it is
python3 --version
# Output
> Python 3.12.3
Changing the alias to other version (e.g to Python 3.10) does not help either.