Ask Your Question
1

module yaml not found

asked 2020-12-01 14:27:41 -0500

Joao gravatar image

updated 2020-12-02 08:50:37 -0500

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-12-02 09:39:15 -0500

I think this is because roslaunch turtle_tf turtle_tf2_demo.launch is running python and not python3.

I'm expecting the following to solve the problem, so that python3 runs when you run python.

  • Set the link ( ln -s ... )
  • Configuring an Alias
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-12-01 14:27:41 -0500

Seen: 1,659 times

Last updated: Dec 02 '20