Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Melodic support complicated by new rosbag dependencies #118

Closed
dhood opened this issue Jun 5, 2018 · 2 comments
Closed

Melodic support complicated by new rosbag dependencies #118

dhood opened this issue Jun 5, 2018 · 2 comments
Assignees
Labels
in progress Actively being worked on (Kanban column)
Milestone

Comments

@dhood
Copy link
Member

dhood commented Jun 5, 2018

rosbag has added support for encryption in melodic, which brings in a python dependency on Crypto, which @mikaelarguedas noticed was causing issues building the bridge on bionic, even if the Crypto dependency is installed in the virtualenv on CI:

--- stderr: ros1_bridge
Traceback (most recent call last):
  File "bin/ros1_bridge_generate_factories", line 11, in <module>
    from ros1_bridge import generate_cpp
  File "/home/rosbuild/ci_scripts/ws/src/ros2/ros1_bridge/ros1_bridge/__init__.py", line 82, in <module>
    import rosmsg  # noqa
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 54, in <module>
    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 Crypto import Random
ModuleNotFoundError: No module named 'Crypto'
make[2]: *** [generated/get_factory.cpp] Error 1

This is complicated in the case of the bridge because we need to import rosmsg dependencies using python2:

# import catkin_pkg and rospkg which are required by rosmsg

and rosbag is a rosmsg dependency.

I have gotten around the Crypto importing issue by importing Crypto using the same workaround as for other dependencies, but it just gets one step closer:

--- stderr: ros1_bridge
Traceback (most recent call last):
  File "bin/ros1_bridge_generate_factories", line 11, in <module>
    from ros1_bridge import generate_cpp
  File "/home/rosbuild/ci_scripts/ws/src/ros2/ros1_bridge/ros1_bridge/__init__.py", line 100, in <module>
    import rosmsg  # noqa
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 54, in <module>
    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 Crypto import Random
  File "/usr/lib/python2.7/dist-packages/Crypto/Random/__init__.py", line 28, in <module>
    from Crypto.Random import OSRNG
  File "/usr/lib/python2.7/dist-packages/Crypto/Random/OSRNG/__init__.py", line 32, in <module>
    from Crypto.Random.OSRNG.posix import new
  File "/usr/lib/python2.7/dist-packages/Crypto/Random/OSRNG/posix.py", line 66
    except IOError, e:
                  ^
SyntaxError: invalid syntax
make[2]: *** [generated/get_factory.cpp] Error 1

I can keep working around this, but wanted to ask @dirk-thomas if it is possible to instead not import rosbag globally upon import of rosmsg? or to only import Crypto locally inside rosbag, instead? I think then we wouldn't have to modify any import code in the bridge to work around it.

@dhood dhood added the in progress Actively being worked on (Kanban column) label Jun 5, 2018
@dhood dhood added this to the bouncy milestone Jun 5, 2018
@dhood dhood self-assigned this Jun 5, 2018
@dirk-thomas
Copy link
Member

if it is possible to instead not import rosbag globally upon import of rosmsg?

The import of rosbag could be moved into a local scope in the rosmsg module. That should be the easiest and most straight forward work around.

@mikaelarguedas
Copy link
Member

ros/ros_comm#1424 moves the rosbag import to a local scope

@dhood dhood closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Actively being worked on (Kanban column)
Projects
None yet
Development

No branches or pull requests

3 participants