Ask Your Question
1

pkg_resources.DistributionNotFound: The 'rospkg==1.2.3' distribution was not found and is required by the application

asked 2020-06-11 06:51:06 -0500

Rahul K R gravatar image

When is run 'roscore' command in my terminal, I get an error:

  .. logging to /home/rahul/.ros/log/1676e6fa-abd6-11ea-8f43-70c94eedebaf/roslaunch-rahul-ubuntu-18-384.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
Traceback (most recent call last):
  File "/home/rahul/.local/bin/rosversion", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 576, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 589, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'rospkg==1.2.3' distribution was not found and is required by the application
RLException: Invalid  tag: Cannot load command parameter [rosversion]: command [['rosversion', 'roslaunch']] returned with code [1]. 

Param xml is param command="rosversion roslaunch" name="rosversion" />  
The traceback for the exception was written to the log file

I'm running ROS melodic on Ubuntu 18.04. Kernel version: Linux 5.3.0-59-generic x86_64

This is what I get when I run 'printenv | grep ROS':

ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROS_PYTHON_VERSION=2
ROS_PACKAGE_PATH=/home/rahul/Desktop/edx_ws/src:/opt/ros/melodic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/rahul/Desktop/edx_ws/devel/share/common-lisp
ROS_DISTRO=melodic

I did 'pip install rospkg'. Even after installation I get the same error.

I'm a beginner in ROS. Thank you for your time.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2021-04-15 10:01:25 -0500

nkym gravatar image

I meet the same problem,sovled it by using

pip3 install rospkg==1.2.8
edit flag offensive delete link more
0

answered 2021-03-17 02:42:32 -0500

jxl gravatar image

I use sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/lsb_release -csmain" > /etc/apt/sources.list.d/ros-latest.list' mirro. My problem is pkg_resources.DistributionNotFound: The 'rospkg>=1.2.7' distribution was not found and is required by rosdep, solved with pip install rospkg==1.2.7 -i https://pypi.tuna.tsinghua.edu.cn/simple, hope to be useful.

edit flag offensive delete link more
0

answered 2020-06-11 23:47:12 -0500

Rahul K R gravatar image

The following command fixed the error for me.

$ sudo chown -R <your_username> ~/.ros

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

2 followers

Stats

Asked: 2020-06-11 06:51:06 -0500

Seen: 6,365 times

Last updated: Mar 17