locusrobotics / qgis_ros

ROS QGIS Plugin prototype
MIT License
45 stars 9 forks source link

Build issues / undocumented use with catkin_virtualenv #6

Closed kajep09 closed 5 years ago

kajep09 commented 5 years ago

Hello @ablakey

I was inspired by your ROSCon talk to recreate the wifi-heatmap with one of my robots but have run into issues while building the package. I have installed qgis as listed in the instructions, but I cannot build the qgis_ros package. I cloned and build catkin_virtualenv since it is listed as a dependency for qgis_ros (but this is not stated on in the readme file), but I am unsure if I need to do anything else in order to build the package.

I get the following error messages when building. Hope you can help!

Starting  >>> catkin_virtualenv                                                
Finished  <<< catkin_virtualenv                [ 0.1 seconds ]                 
Starting  >>> qgis_ros                                                         
_______________________________________________________________________________
Errors     << qgis_ros:make /home/kajep09/RCW_workspaces/safecop_ws/logs/qgis_ros/build.make.003.log
Traceback (most recent call last):
  File "/home/kajep09/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/catkin_virtualenv/catkin_virtualenv/cmake/build_venv.py", line 80, in <module>
    deploy.create_virtualenv()
  File "/home/kajep09/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/catkin_virtualenv/catkin_virtualenv/src/dh_virtualenv/deployment.py", line 169, in create_virtualenv
    Traceback (most recent call last):
subprocess.check_call(virtualenv)
  File "/usr/lib/python2.7/subprocess.py", line 536, in check_call
  File "/home/kajep09/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/catkin_virtualenv/catkin_virtualenv/cmake/build_venv.py", line 80, in <module>
    deploy.create_virtualenv()
  File "/home/kajep09/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/catkin_virtualenv/catkin_virtualenv/src/dh_virtualenv/deployment.py", line 169, in create_virtualenv
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 523, in call
    subprocess.check_call(virtualenv)
  File "/usr/lib/python2.7/subprocess.py", line 536, in check_call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 523, in call
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
    raise child_exception
OSError: [Errno 2] No such file or directory
make[2]: *** [/home/kajep09/RCW_workspaces/safecop_ws/devel/.private/qgis_ros/share/qgis_ros/venv] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [venv] Error 1
make[1]: *** [CMakeFiles/qgis_ros_generate_virtualenv.dir/all] Error 2
make: *** [all] Error 2
cd /home/kajep09/RCW_workspaces/safecop_ws/build/qgis_ros; catkin build --get-env qgis_ros | catkin env -si  /usr/bin/make --jobserver-fds=6,7 -j; cd -
...............................................................................
Failed     << qgis_ros:make                    [ Exited with code 2 ]          
Failed    <<< qgis_ros                         [ 0.1 seconds ]                 
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   76 packages were skipped or are blacklisted.              
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.4 seconds total.                                            
* Sourced workspace devel/setup.bash
ablakey commented 5 years ago

Hi @kajep09 thanks for trying it out.

I missed catkin_virtualenv in the instructions. I'll fix that.

I'm pretty sure I actually just need to remove it. By the end of prototyping, I no-longer had any dependencies left (which is why requirements.txt is missing)

Let me put a branch together and test it. If all is good, we can merge it.

kajep09 commented 5 years ago

Thanks for the record-breaking reaction time to my issue :) It seems you are correct - I removed the parts dealing with catkin_virtualenv from the cmakelists and I can build it now and run it with your start script. Now I just have to figure how everything works :)

ablakey commented 5 years ago

Great!

I've got a PR up that I'll merge then.

Yes, I am currently working on some documentation for non-GIS experts. You'll want to look for one of the many raster interpolation algorithms in the toolbox. For my presentation I used Ordinary Kriging.

You'll likely find it via. GRASS GIS (a GIS algorithm library that generally comes with QGIS).

kajep09 commented 5 years ago

Sorry for spamming, but it seems like the plugin was not loaded by default, and choosing it in the plugin-manager gave me the following error and I am not sure if it is just my ROS / Ubuntu environment that is messed up (and if so, why?) or if it has something to do with your package.

Couldn't load plugin 'qgis_ros' due to an error when calling its classFactory() method 

ImportError: No module named 'rospkg' 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 337, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/__init__.py", line 7, in classFactory
    from .qgis_ros_toolbox import QgisRos
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/qgis_ros_toolbox.py", line 6, in 
    from .ui import ROSMasterDialog, BagfileDialog
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/ui/__init__.py", line 1, in 
    from .data_loader_widget import DataLoaderWidget
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 9, in 
    from ..core import TranslatorRegistry
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/core/__init__.py", line 1, in 
    from .ros_vector_provider import ROSVectorProvider
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src/qgis_ros/core/ros_vector_provider.py", line 3, in 
    import rospy
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in 
    from .client import spin, myargv, init_node, \
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 52, in 
    import roslib
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in 
    from roslib.launcher import load_manifest
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in 
    import rospkg
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 674, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named 'rospkg'

Python version: 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] 
QGIS version: 3.2.3-Bonn Bonn, 9b17680 

Python Path:
/usr/share/qgis/python
/home/kaspercj/.local/share/QGIS/QGIS3/profiles/default/python
/home/kaspercj/RCW_workspaces/safecop_ws/src/mobile/utility_nodes/qgis_ros/src
/home/kaspercj/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/home/kaspercj/RCW_workspaces/cartographer_ws/install_isolated/lib/python2.7/dist-packages
/home/kaspercj/RCW_workspaces/safecop_ws/devel/lib/python2.7/dist-packages
/opt/ros/kinetic/lib/python2.7/dist-packages
/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-x86_64-linux-gnu
/usr/lib/python3.5/lib-dynload
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages
/home/kaspercj/.local/share/QGIS/QGIS3/profiles/default/python
ablakey commented 5 years ago

Oh my. Right. I think you need to pip3 install rospkg and maybe other ros dependencies. I think some of them only end up available in the python2 dist packages.

Maybe catkin_virtualenv is worth using for that reason. Though it's not a pre-built dependency available on rosdep so I'm hesitant to depend on it. May be easier to allow people to pip3 install or make their own virtualenv.

I'll explore this issue when I'm back at a computer.

No worries about the spam. I really appreciate you sharing these issues. Yours is the second computer this project has been installed on, so you'll hit these kinds of environment specific bugs.

Thank you.

masternibot commented 5 years ago

Hello @ablakey, I had the same issue with rospkg. After the pip3 install rospkg it was resolved, however there are other dependencies. Here is how I got it to stop generating errors on startup in Melodic:

pip3 install rospkg
pip3 install msgpack
pip3 install gnupg

Into my catkin ws:

git clone https://github.com/clearpathrobotics/wireless.git
git clone https://github.com/locusrobotics/json_transport.git
ablakey commented 5 years ago

Thanks. I'm going to make a ticket for this.