module yaml not found
When launching this:
roslaunch turtle_tf turtle_tf2_demo.launch
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 48, in <module>
import yaml
ImportError: No module named yaml
I installed it, by trying all of the below:
sudo pip install pyyaml
Requirement already satisfied: pyyaml in ./.local/lib/python3.9/site-packages (5.3.1)
pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in ./.local/lib/python3.9/site-packages (5.3.1)
sudo pip3 install pyyaml
Requirement already satisfied: pyyaml in ./.local/lib/python3.9/site-packages (5.3.1)
pip3 install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in ./.local/lib/python3.9/site-packages (5.3.1)
It seems pip is installing in the same location as pip3
I have several python version as you can see below
:~$ pip -V
pip 20.3 from /home/ohmy/.local/lib/python3.9/site-packages/pip (python 3.9)
:~$ pip3 -V
pip 20.3 from /home/ohmy/.local/lib/python3.9/site-packages/pip (python 3.9)
:~$ python -V
Python 2.7.18
:~$ python3 -V
Python 3.9.0
:~$ cd /usr/local/lib/py
pypy3.6/ python2.7/ python3.8/ python3.9/
:/usr/local/lib/python3.9/site-packages$ ls -d yaml
yaml _yaml.cpython-39-x86_64-linux-gnu.so
It seems that I need to include a path on these libraries located in site-packages
* I tried to assign it in .bashcr to usr/local/lib/python3.9/site-packages *
export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python3.9/site-packages/"
Open a new terminal and re-run
roslaunch turtle_tf turtle_tf2_demo.launch
File "/usr/local/lib/python3.9/site-packages/yaml/__init__.py", line 399
class YAMLObject(metaclass=YAMLObjectMetaclass):
^
SyntaxError: invalid syntax