0

I'm trying to run this Gazebo simulation: https://github.com/disaster-robotics-proalertas/usv_sim_lsa

I've followed along and installed ROS kinetic on my Ubuntu 16.04. But I keep getting an error for netifaces module not found, even though I've repeatedly installed it and can import netifaces when I launch python in the terminal.

I've tried installing python-netifaces and using

rosdep install --from-paths src --ignore-src --rosdistro groovy -y

it shows all required rosdeps are installed.

Just trying to run this line: roslaunch usv_sim airboat_scenario1.launch parse:=true

Here's the error I keep getting:

rameezs:~/catkin_ws$ roslaunch usv_sim airboat_scenario1.launch parse:=true ... logging to /home/rameezs/.ros/log/5cbbdbb0-c28f-11e9-bea5-88b111c4685a/roslaunch-thinkram-16846.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/init.py", line 306, in main p.start() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start self._start_infrastructure() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure self._load_config() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config roslaunch_strs=self.roslaunch_strs, verbose=self.verbose) File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 471, in load_config_default config.assign_machines() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 222, in assign_machines if [m for m in machine_unify_dict.values() if not is_machine_local(m)]: File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 222, in if [m for m in machine_unify_dict.values() if not is_machine_local(m)]: File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/core.py", line 97, in is_machine_local local_addresses = ['localhost'] + rosgraph.network.get_local_addresses() File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/network.py", line 217, in get_local_addresses import netifaces ModuleNotFoundError: No module named 'netifaces'

dustinos3
  • 934
  • 3
  • 17
  • 27
  • Can you show command that you use to install netifaces ? – W0RT4 Aug 20 '19 at 11:05
  • I just use sudo apt-get install python-netifaces – user2512219 Aug 20 '19 at 17:07
  • sudo apt install python3-netifaces can you try this ? – W0RT4 Aug 21 '19 at 07:46
  • Make sure python can see netifaces: `pip list | grep netifaces`, `python -c "exec(\"help('modules')\")" | grep netifaces`, `python -c "exec(\"help('netifaces')\")"` If it was installed with ros, via apt, as it should be, it should be under /usr/lib/python2.7/dist-packages/netifaces.so. If you've been running ros and not having this error, I find that interesting, I think. You can also try pip: `pip install netifaces` – JWCS Aug 21 '19 at 14:56
  • I've tried 'sudo apt-get install netifaces' and it seems to successfully install and yet the same issue. I didn't try python3-netifaces as it seems that it's trying to access python2.7 libraries right? Either way that doesn't seem to work either. netifaces does show up with 'pip list | grep netifaces'. But trying to install with 'pip install netifaces' results in a 'failed to build wheel error'. – user2512219 Aug 23 '19 at 14:04

1 Answers1

0

I believe it might a python path related issues. when you do such binary installations, in general those packages get installed in dist-package file of the respective python either python 2.7 or python 3. And ros-kinetic uses python 2.7 for its basic commands such as roslib and rospy. So please try to check whether the installed netifaces are in the same pythonpath, if not try to export python path before launching the file.

Als please try to check the python path from the terminal you are launching your file, that way you will know which python paths are imported, if python3 path is not imported, please try to export that path aswell.

Sai Raghava
  • 147
  • 1
  • 4
  • 13
  • I'm sorry, but how could I check if netifaces is in the pythonpath and how what path of netifaces would I add to pythonpath? – user2512219 Aug 23 '19 at 14:06
  • in the same terminal where you are launching your gazebo, try to check for ```echo $PYTHONPATH```, it displays all the paths that are added for that respective terminal window. In order to check the path where netifaces is installed you can use ```find_module``` function from the module ```imp```. Import that module and then use ```find_module("netifaces")```. This returns a tuple with path in it. – Sai Raghava Aug 24 '19 at 06:29
  • If bth the paths do no match then you must add the path where netifaces is installed to ros environment. For that try checking ```ROS_ENVIRONMENT_VARIABLES```. There is a command to export additional pythonpaths to ros environment. – Sai Raghava Aug 24 '19 at 06:30
  • Thanks @sai-raghava, so I've discovered the two directories differ, so I moved the netifaces installer and its preceding files to the correct directory. I now get a 'ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/netifaces.so: undefined symbol: _Py_ZeroStruct'. Sorry to keep bothering it just seems like there's barely any documented resolves to this issue or I'm not asking the right questions. Would you have any idea what this error could mean? – user2512219 Aug 25 '19 at 17:08
  • You're welcome. Dont worry, I face similar issues when first working with ROS. I have got this same symbol lookup error but in my case it was because of Gazebo_ros_control package. So I would first suggest you to go through your most recent ros-log file and check which particular package is causing this symbol lookup error. Incase you are not sure where the recent log file is, just run the simulation once again and when the simulation gets aborted because of this lookup error, it also displays a message saying you to check a particular log file in particular location for more details – Sai Raghava Aug 26 '19 at 15:34
  • once you find the log file, you can find which particular package is causing this error, please let me know whether you have binary installed that particular package or build it from source. – Sai Raghava Aug 26 '19 at 15:35
  • Just so you know, when i got such symbol lookup error, I have tried a lot to fix it and then I came to know such errors are also dependent on the operating systems and only thing that helped me resolve that error is, I updated my OS from ubuntu 16 to ubuntu 18 and re-installed suitable ROS. PS: Please try to post this symbol lookup issue as a new question and please post the link of that question here. That way, you can get more help from other people in the community. – Sai Raghava Aug 26 '19 at 15:38