StanfordVL / iGibson

A Simulation Environment to train Robots in Large Realistic Interactive Scenes
http://svl.stanford.edu/igibson
MIT License
642 stars 157 forks source link

ModuleNotFoundError for already installed module while running roslaunch #334

Closed jd730 closed 1 year ago

jd730 commented 1 year ago

Hello, I am trying to use iGibson with ROS. I followed the instruction in https://stanfordvl.github.io/iGibson/ros_integration.html including PYTHONPATH

/home/jdhwang/catkin_ws/devel/lib/python3/dist-packages:/opt/ros/noetic/lib/python3/dist-packages:/opt/ros/noetic/lib/python3/dist-packages;/home/jdhwang/conda/igibson/lib/python3.8/site-packages;/home/jdhwang/iGibson

However, I am facing a ModuleNotFoundError for gym although I have it and I can execute that line in the python shell.

Traceback (most recent call last):
  File "/home/jdhwang/catkin_ws/src/igibson-ros/turtlebot_rgbd.py", line 19, in <module>
    from igibson.envs.igibson_env import iGibsonEnv
  File "/home/jdhwang/catkin_ws/src/igibson-ros/igibson/envs/igibson_env.py", line 7, in <module>
    import gym
ModuleNotFoundError: No module named 'gym'
[turtlebot_gibson_sim-4] process has died [pid 3062570, exit code 1, cmd /home/jdhwang/catkin_ws/src/igibson-ros/turtlebot_rgbd.py /mobile_base/commands/velocity:=/cmd_vel __name:=turtlebot_gibson_sim __log:=/home/jdhwang/.ros/log/0c839c6e-35a4-11ee-adb7-d9fe9e8ecf75/turtlebot_gibson_sim-4.log].
log file: /home/jdhwang/.ros/log/0c839c6e-35a4-11ee-adb7-d9fe9e8ecf75/turtlebot_gibson_sim-4*.log
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
[rviz-5] process has finished cleanly
log file: /home/jdhwang/.ros/log/0c839c6e-35a4-11ee-adb7-d9fe9e8ecf75/rviz-5*.log
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
C^C[slam_gmapping-10] killing on exit
[cloudify-9] killing on exit
[ INFO] [1691468934.559956457]: Unloading nodelet /cloudify from manager record_player_manager
[record_player_manager-8] killing on exit
[depthimage_to_laserscan-7] killing on exit
[teleop_twist_keyboard-6] killing on exit
[robot_state_publisher-2] killing on exit
[joint_state_publisher-3] killing on exit
^Cvirtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Start
virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Deleting tree
^C^CGot shutdown request before subscribers connected
^C[rosout-1] killing on exit
^C[master] killing on exit
^Cshutting down processing monitor...
... shutting down processing monitor complete
done
(igibson) ~/catkin_ws python3        
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:06:00) 
[GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from igibson.envs.igibson_env import iGibsonEnv

 _   _____  _  _
(_) / ____|(_)| |
 _ | |  __  _ | |__   ___   ___   _ __
| || | |_ || || '_ \ / __| / _ \ | '_ \
| || |__| || || |_) |\__ \| (_) || | | |
|_| \_____||_||_.__/ |___/ \___/ |_| |_|

torch is not available, falling back to rendering to memory (instead of tensor)
>>> 
jd730 commented 1 year ago

For your information, I manually copied igibson/ without example to igibson-ros to avoid

Traceback (most recent call last):
  File "/home/jdhwang/catkin_ws/src/igibson-ros/turtlebot_rgbd.py", line 19, in <module>
    from igibson.envs.igibson_env import iGibsonEnv
ModuleNotFoundError: No module named 'igibson'
[turtlebot_gibson_sim-4] process has died [pid 3158774, exit code 1, cmd /home/jdhwang/catkin_ws/src/igibson-ros/turtlebot_rgbd.py /mobile_base/commands/velocity:=/cmd_vel __name:=turtlebot_gibson_sim __log:=/home/jdhwang/.ros/log/bcb84bfc-35ea-11ee-adb7-d9fe9e8ecf75/turtlebot_gibson_sim-4.log].
log file: /home/jdhwang/.ros/log/bcb84bfc-35ea-11ee-adb7-d9fe9e8ecf75/turtlebot_gibson_sim-4*.log
jd730 commented 1 year ago

Solution: change https://github.com/StanfordVL/iGibson/blob/7d9598278b95ec1039e1f4366c66b45346521e44/igibson/examples/ros/igibson-ros/turtlebot_rgbd.py#L1 to #!/usr/bin/env python3