Comments (4)
Re-created problem here: https://github.com/JohnRudolfLewis/bazel-ros-example
ModuleNotFoundError: No module named 'rospy'
$ bazel run //chatter:chatter
INFO: Analyzed target //chatter:chatter (1 packages loaded, 16 targets configured).
INFO: Found 1 target...
Target //chatter:chatter up-to-date:
bazel-bin/chatter/chatter
bazel-bin/chatter/chatter_launch.py
INFO: Elapsed time: 0.945s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/chatter/chatter
... logging to /home/vscode/.ros/log/a64df9b8-4eb5-11ef-b119-bf9446a06087/roslaunch-edfa49feca88-51089.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://edfa49feca88:37901/
SUMMARY
========
NODES
/
listener (chatter/listener)
listenerpy (chatter/listener.py)
talker (chatter/talker)
auto-starting new master
process[master]: started with pid [51800]
ROS_MASTER_URI=http://localhost:11311/
setting /run_id to a64df9b8-4eb5-11ef-b119-bf9446a06087
process[rosout-1]: started with pid [51811]
started core service [/rosout]
process[talker-2]: started with pid [51816]
process[listener-3]: started with pid [51817]
process[listenerpy-4]: started with pid [51818]
Traceback (most recent call last):
File "/home/vscode/.cache/bazel/_bazel_vscode/0cd11761e4a882ffd46b0cb0705acf1d/execroot/_main/bazel-out/k8-fastbuild/bin/chatter/chatter.runfiles/_main/chatter/listener.py", line 6, in <module>
import rospy
ModuleNotFoundError: No module named 'rospy'
[listenerpy-4] process has died [pid 51818, exit code 1, cmd chatter/listener.py __name:=listenerpy __log:=/home/vscode/.ros/log/a64df9b8-4eb5-11ef-b119-bf9446a06087/listenerpy-4.log].
log file: /home/vscode/.ros/log/a64df9b8-4eb5-11ef-b119-bf9446a06087/listenerpy-4*.log
from rules_ros.
In order to launch a python node from a launch file I had to add a shebang to the top of the python file and mark it as executable. The only shebang that I got working so far was #!/usr/bin/env python3
. My current suspicion is this is part of the issue.
FYI: If I remove the shebang like the examples in this repo suggest, I get the following error:
RLException: Unable to launch [listenerpy-4].
If it is a script, you may be missing a '#!' declaration at the top.
The traceback for the exception was written to the log file
from rules_ros.
Adding @ros_comm//:rospy
to third_party/ros/roslaunch/BUILD.bazel fixes the 'No module named 'rospy' error.
diff --git a/third_party/ros/roslaunch/BUILD.bazel b/third_party/ros/roslaunch/BUILD.bazel
index 06e19d2..09cdf2d 100644
--- a/third_party/ros/roslaunch/BUILD.bazel
+++ b/third_party/ros/roslaunch/BUILD.bazel
@@ -45,7 +45,6 @@ py_library(
"//third_party/ros:roslib",
"@ros_comm//:rosmaster",
"@ros_comm//:rosparam",
- "@ros_comm//:rospy",
"@ros_comm_msgs//:py_rosgraph_msgs",
"@ros_ros//:rosclean",
requirement("pyyaml"),
But then if you are importing other types in your python script, message definitions for example, those imports will not work right. Still more work to do.
from rules_ros.
needed to adjust the way that the message def was being imported such that it worked when being launched both directly and via the launch file. Submitted PR.
from rules_ros.
Related Issues (13)
- Naming conventions for targets HOT 1
- Rules ROS seems to be not fully hermetic HOT 2
- Cannot find rosnode py_library
- Add back API documentation
- Add back an example for cross-compilation
- Add back examples for archiving binaries and assembling Docker images HOT 4
- Create a lock file from rosdistro
- Why "cc_ros_library" will generate .so and .a at the same time? And how can I choose one to pack? HOT 1
- Port to Bazel Modules HOT 4
- 'ros_comm//:rospy' and 'ros_ros//:rosunit' does not have mandatory providers: 'PyInfo' or 'PyVirtualInfo' HOT 4
- Dependency Dashboard
- Using rules_ros via bzlmod results in `invalid label for module extension found` HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_ros.