Ask Your Question
1

No module named 'Cryptodomex' error when running rosmsg show

asked 2021-01-31 02:00:02 -0500

buzzport93 gravatar image

My system is ROS melodic / Ubuntu 18.04.

I tried to do rosmsg show [msg], but it returns this error:

dlee640@dlee640-ThinkPad-T580:~$ rosmsg show nav_msgs/Odometry 
Traceback (most recent call last):
  File "/opt/ros/melodic/bin/rosmsg", line 35, in <module>
    rosmsg.rosmsgmain()
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 754, in rosmsgmain
    sys.exit(rosmsg_cmd_show(ext, full, command))
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 582, in rosmsg_cmd_show
    import rosbag
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module>
    from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in <module>
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'

I have searched this issue and the recommended solution was to

pip install pycryptodomex

which returns

Requirement already satisfied: pycryptodomex in ./.pyenv/versions/3.8.6/lib/python3.8/site-packages (3.9.7)

Other than above, I have also tried

pip3 install pycryptodomex
pip3 install pycrypto
pip3 install Cryptodome

None of these seem to work. All the installation goes successful, but I think the problem is related to ROS not being able to locate the pycryptodomex property due to python version. I have tried normal pip instead of pip3 as well, so that is not the solution I am looking for.

Can someone guide me where to look for to address this issue?

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-02-03 05:49:22 -0500

130s gravatar image

Indeed in bag.py Cryptodome is referenced (permalink to the latest melodic-devel at the time):

from Cryptodome.Cipher import AES

Unfamilliar with this package, I'm curious where the dependency on this pkg is defined.

Barebone Ubuntu distro, or default python? Looks like no.

$ docker run -it ubuntu:bionic bash
# apt update && apt install python
# python -c "import Cryptodome"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named Cryptodome

Somewhere in base ROS? Looks like it.

$ docker run -it ros:melodic-ros-base bash
root@ccde9d6e77bd:/# python -c "import Cryptodome"
root@ccde9d6e77bd:/# 
# apt-cache policy python-pycryptodome
python-pycryptodome:
  Installed: 3.4.7-1ubuntu1
  Candidate: 3.4.7-1ubuntu1
  Version table:
 *** 3.4.7-1ubuntu1 100
        100 /var/lib/dpkg/status

Indeed rosbag package itself defines it.

So, if you followed any standard way to (build/)install rosbag (and others), the missing package should have been beautifully installed automatically (by rosdep install that references to package.xml of each package and installs missing packages). I can only recommend that you review your installation steps. But, b/c there are other people who are stuck with the same error msg e.g. #q331160, I'd say there _may_ be a corner case that the installtion steps haven't captured yet (In that case we should fix. Please consider updating your description, or open a ticket. For a starter I'd say ros_comm is ok).

edit flag offensive delete link more
0

answered 2021-01-31 12:45:41 -0500

buzzport93 gravatar image

I was able to solve this issue by replacing the first line in the file at "/opt/ros/melodic/bin/rosmsg" Previous: #!/usr/bin/python After: #!/usr/bin/python2.7

edit flag offensive delete link more

Comments

Beside my post https://answers.ros.org/question/3706... is likely more proper fix, using pipis _ok_ but in general not recommended esp. if you're making software that's meant to be maintained longer term. FYI there's lengthy discussion https://discourse.ros.org/t/should-we...

130s gravatar image 130s  ( 2021-02-03 05:54:18 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2021-01-31 02:00:02 -0500

Seen: 978 times

Last updated: Feb 03