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

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 -0600

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

Comments

Hey there, I have the same problem on armhf Debian 10 for ROS2 Foxy.

pip3 install rospkg
tells me that the package is already the latest version

apt install python-rospkg tells me it can't find the package with:

"E: Failed to fetch http://ftp.us.debian.org/debian/pool/... 404 Not Found"

Am I guessing correctly that there are no debian packages for armhf available for python-rospkg?

I cross compiled ros2 myself for this armhf Debian 10..

Any help would be greatly appreciated.

Thank you

pennjamin gravatar image pennjamin  ( 2022-04-28 11:13:07 -0600 )edit

can you try apt install python3-rospkg? The ros2 distributions rely on python3.

ignacio gravatar image ignacio  ( 2022-05-10 03:20:23 -0600 )edit

5 Answers

Sort by ยป oldest newest most voted
2

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

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 -0600

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 -0600

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
0

answered 2022-04-28 10:13:28 -0600

ignacio gravatar image

if you don't have pip installed, you can also use apt install python-rospkg

edit flag offensive delete link more
0

answered 2022-03-01 13:49:08 -0600

bhomaidan gravatar image

This solution has worked for me:

  1. Installing last rospkg version pip3 install rospkg -U
  2. Then changing the version number in sudo nano /usr/local/bin/rosversion
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-06-11 06:51:06 -0600

Seen: 11,240 times

Last updated: Apr 28 '22