Ask Your Question

"Permission denied" when importing tf

asked 2020-01-21 01:05:32 -0500

BV_Pradeep gravatar image

updated 2020-01-21 03:39:56 -0500

gvdhoorn gravatar image

Hi All,

I am using ros kinetic on ubuntu 16.04 xenial. while trying to import tf library in python code I get following error

Traceback (most recent call last):
  File "", line 13, in <module>
    import  tf
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/", line 28, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/", line 39, in <module>
    from .buffer_interface import *
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/", line 32, in <module>
    import roslib; roslib.load_manifest('tf2_ros')
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher

.py", line 62, in load_manifest
    sys.path = _generate_python_path(package_name, _rospack) + sys.path
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/", line 93, in _generate_python_path
    m = rospack.get_manifest(pkg)
  File "/usr/lib/python2.7/dist-packages/rospkg/", line 167, in get_manifest
    return self._load_manifest(name)
  File "/usr/lib/python2.7/dist-packages/rospkg/", line 211, in _load_manifest
    retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self)
  File "/usr/lib/python2.7/dist-packages/rospkg/", line 414, in parse_manifest_file
    _static_rosdep_view = init_rospack_interface()

  File "/usr/lib/python2.7/dist-packages/rosdep2/", line 59, in init_rospack_interface
    lookup = _get_default_RosdepLookup(Options())
  File "/usr/lib/python2.7/dist-packages/rosdep2/", line 134, in _get_default_RosdepLookup
  File "/usr/lib/python2.7/dist-packages/rosdep2/", line 585, in create_default
    sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose)
  File "/usr/lib/python2.7/dist-packages/rosdep2/", line 543, in load_cached_sources_list
    with open(cache_index, 'r') as f:
IOError: [Errno 13] Permission denied: '/home/rnd424/.ros/rosdep/sources.cache/index'

How to resolve this error ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-21 02:01:50 -0500

gvdhoorn gravatar image

The problem is not with tf, but with this:

IOError: [Errno 13] Permission denied: '/home/rnd424/.ros/rosdep/sources.cache/index'

it is likely you've run rosdep update with sudo some time in the past, which makes that directory (and the files in it) owned by root, not by your own user (probably: rnd424).

You should be able to fix it with:

sudo rosdep fix-permissions
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-21 01:05:32 -0500

Seen: 409 times

Last updated: Jan 21 '20