ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Python Import Error from rospack

asked 2019-04-12 12:57:31 -0500

maspe36 gravatar image

Hi peeps,

I'm following along with the ROS tutorials (Creating a Package) and when I run

rospack depends1 beginner_tutorials

I get this error

dev@dev-test-eth1:~/catkin_ws/src$ rospack depends1 beginner_tutorials
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/rosdep2/__init__.py", line 40, in <module>
    from .installers import InstallerContext, Installer, \
  File "/usr/lib/python2.7/dist-packages/rosdep2/installers.py", line 36, in <module>
    from rospkg.os_detect import OsDetect
  File "/usr/lib/python2.7/dist-packages/rospkg/__init__.py", line 41, in <module>
    from .manifest import InvalidManifest, Manifest, parse_manifest_file
  File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 40, in <module>
    import xml.dom.minidom as dom
  File "/home/dev/miniconda2/lib/python2.7/xml/dom/minidom.py", line 22, in <module>
    from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
  File "/home/dev/miniconda2/lib/python2.7/xml/dom/xmlbuilder.py", line 3, in <module>
    import copy
  File "/home/dev/miniconda2/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/home/dev/miniconda2/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/rosdep2/__init__.py", line 40, in <module>
    from .installers import InstallerContext, Installer, \
  File "/usr/lib/python2.7/dist-packages/rosdep2/installers.py", line 36, in <module>
    from rospkg.os_detect import OsDetect
  File "/usr/lib/python2.7/dist-packages/rospkg/__init__.py", line 41, in <module>
    from .manifest import InvalidManifest, Manifest, parse_manifest_file
  File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 40, in <module>
    import xml.dom.minidom as dom
  File "/home/dev/miniconda2/lib/python2.7/xml/dom/minidom.py", line 22, in <module>
    from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
  File "/home/dev/miniconda2/lib/python2.7/xml/dom/xmlbuilder.py", line 3, in <module>
    import copy
  File "/home/dev/miniconda2/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/home/dev/miniconda2/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
[rospack] Error: could not find python module 'rosdep2.rospack'. is rosdep up-to-date (at least 0.10.4)?

I have a miniconda environment configured and I verified that rospack is indeed using the correct interpreter (Edited the /usr/lib/python2.7/dist-packages/rosdep2/init.py file to print sys.executable). I can import these modules

dev@dev-test-eth1:~/catkin_ws/src$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from rosdep2 import rospack
>>> import weakref
>>> from _weakref import _remove_dead_weakref
>>>

Python Interpreter

dev@dev-test-eth1:~/catkin_ws/src$ which python
/home/dev/miniconda2/bin/python

Pip

dev@dev-test-eth1:~/catkin_ws/src$ which pip
/home/dev/miniconda2/bin/pip

Located rosdep2

dev@dev-test-eth1:~/catkin_ws/src$ locate rosdep2
/usr/lib/python2.7/dist-packages/rosdep2
/usr/lib/python2.7/dist-packages/rosdep2/__init__.py
/usr/lib/python2.7/dist-packages/rosdep2/__init__.pyc
/usr/lib/python2.7/dist-packages/rosdep2/_version.py
/usr ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-12 13:16:46 -0500

maspe36 gravatar image

For now I was able to get past this step by simply removing the miniconda2 python from my path var. So perhaps you will need to do a conda install for packages instead of pip?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-04-12 12:57:31 -0500

Seen: 484 times

Last updated: Apr 12 '19