ImportError: No module named moveit_commander
Further investigation suggests this is unique to my docker setup. When I build the image, it indicates that pyassimp and ros-kinetic-moveit-commander are installed, but when I run the container and apt-get install ros-kinetic-moveit-commander it installs additional code and, after that, moveit_commander imports successfully.
Here is the result of apt-get install ros-kinetic-moveit-commander from the original build:
Collecting pyassimp
Downloading pyassimp-3.3.tar.gz (94kB)
Installing collected packages: pyassimp
Running setup.py install for pyassimp: started
Running setup.py install for pyassimp: finished with status 'done'
Successfully installed pyassimp-3.3
Reading package lists...
Building dependency tree...
Reading state information...
libassimp-dev is already the newest version (3.2~dfsg-3).
libassimp-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 496 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libccd-dev libccd2 libfcl-0.5-dev libfcl0.5 libglew-dev libglew1.13
python-bs4 python-chardet python-html5lib python-lxml python-pyassimp
ros-kinetic-moveit-core ros-kinetic-moveit-kinematics
ros-kinetic-moveit-msgs ros-kinetic-moveit-ros-manipulation
ros-kinetic-moveit-ros-move-group ros-kinetic-moveit-ros-perception
ros-kinetic-moveit-ros-planning ros-kinetic-moveit-ros-planning-interface
ros-kinetic-moveit-ros-warehouse ros-kinetic-object-recognition-msgs
ros-kinetic-octomap-msgs ros-kinetic-srdfdom ros-kinetic-urdfdom-py
ros-kinetic-warehouse-ros
Suggested packages:
glew-utils python-genshi python-lxml-dbg python-lxml-doc
The following NEW packages will be installed:
libccd-dev libccd2 libfcl-0.5-dev libfcl0.5 libglew-dev libglew1.13
python-bs4 python-chardet python-html5lib python-lxml python-pyassimp
ros-kinetic-moveit-commander ros-kinetic-moveit-core
ros-kinetic-moveit-kinematics ros-kinetic-moveit-msgs
ros-kinetic-moveit-ros-manipulation ros-kinetic-moveit-ros-move-group
ros-kinetic-moveit-ros-perception ros-kinetic-moveit-ros-planning
ros-kinetic-moveit-ros-planning-interface ros-kinetic-moveit-ros-warehouse
ros-kinetic-object-recognition-msgs ros-kinetic-octomap-msgs
ros-kinetic-srdfdom ros-kinetic-urdfdom-py ros-kinetic-warehouse-ros
0 upgraded, 26 newly installed, 0 to remove and 496 not upgraded.
Need to get 6,764 kB of archives.
After this operation, 56.7 MB of additional disk space will be used.
Here is the result of apt-get install ros-kinetic-moveit-commander from the docker container, showing that it does not have moveit-commander installed. All the other moveit packages were installed. After this step, moveit_commander imports successfully.
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python-pyassimp
The following NEW packages will be installed:
python-pyassimp ros-kinetic-moveit-commander
0 upgraded, 2 newly installed, 0 to remove and 496 not upgraded.
Need to get 67.3 kB of archives.
After this operation, 345 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://packages.ros.org/ros/ubuntu xenial/main amd64 ros-kinetic-moveit-commander amd64 0.9.11-0xenial-20180125-180255-0800 [37.3 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python-pyassimp all 3.2~dfsg-3 [30.0 kB]
Fetched 67.3 kB in 0s (151 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package python-pyassimp.
(Reading database ... 100503 files and directories currently installed.)
Preparing to unpack .../python-pyassimp_3.2~dfsg-3_all.deb ...
Unpacking python-pyassimp (3.2~dfsg-3) ...
Selecting previously unselected package ros-kinetic-moveit-commander.
Preparing to unpack .../ros-kinetic-moveit-commander_0.9.11-0xenial-20180125-180255-0800_amd64.deb ...
Unpacking ros-kinetic-moveit-commander (0.9.11-0xenial-20180125-180255-0800) ...
Setting up python-pyassimp (3.2~dfsg-3) ...
Setting up ros-kinetic-moveit-commander (0.9.11-0xenial-20180125-180255-0800) ...
This is the start of the original question:
I was able to install moveit with binaries, as per the tutorial and it runs. However, when I try to use it in my own code, I get this error when importing moveit_commander.
ImportError: No module named moveit_commander
I am using Ubuntu 16.04 and ...
Just making sure: you're using regular, v2
python
, right (python --version
outputs something in the2.x.y
range). No Anaconda, etc?yes, python --version shows Python 2.7.12, no anaconda, but it is a docker build.
I edited the question, as I discovered that the problem has to do with the docker build rather than an overall system question. When building the docker image, it says it installs ros-kinetic-moveit-commander, but when the container is run, I have to install it again to make it work.
I'm confused: the first few lines of the "the original build" output shows (what appears to be) a
pip
installation ofpyassimp
. The rest showsapt-get
output. Do you build MoveIt from sources?moveit was installed from binaries. Apparently, pyassimp needs to be installed with pip. When I installed moveit-commander from inside the container, it installed both pyassimp and moveit-commander. For the docker build I tried it with and without the pip install and got the same import error.