ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Unmet dependencies when installing Melodic on Ubuntu 18.04

asked 2018-08-01 02:26:32 -0600

apache8080 gravatar image

updated 2022-05-01 13:12:17 -0600

lucasw gravatar image

When running: sudo apt install ros-melodic-desktop-full

I get the following error:

The following packages have unmet dependencies:
 ros-melodic-desktop-full : Depends: ros-melodic-desktop but it is not going to be installed
                            Depends: ros-melodic-perception but it is not going to be installed
                            Depends: ros-melodic-simulators but it is not going to be installed
                            Depends: ros-melodic-urdf-sim-tutorial but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have followed the instructions here:

I am running Ubuntu 18.04

edit retag flag offensive close merge delete


Do you have Gazebo installed from the osrf repositories by any chance?

When running: sudo rm /var/cache/apt/archives/lock

don't you mean "after running .."? That command only deletes a file, it does not ask apt to install any packages.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-01 04:49:17 -0600 )edit

I accidentally put the wrong command in my question. I have now updated it.

apache8080 gravatar image apache8080  ( 2018-08-01 10:36:29 -0600 )edit

But did you install Gazebo sometime earlier and from the OSRF repositories?

gvdhoorn gravatar image gvdhoorn  ( 2018-08-02 02:53:25 -0600 )edit

Use aptitude as explained here. It guides you through fixing dependencies.

dslowik gravatar image dslowik  ( 2019-10-27 14:40:16 -0600 )edit

7 Answers

Sort by ยป oldest newest most voted

answered 2018-08-18 23:51:32 -0600

Catherine Wong gravatar image

I had the same problem. For me, I ran sudo apt-get install ros-desktop-full before I realized that is not Melodic. I removed that afterwards but I had the same error when I tried to install with sudo apt-get install ros-melodic-desktop-full.

I think the error came from the fact that I had rospkg 1.1.4 instead of 1.1.7 when I installed ros_desktop_full. I did

sudo apt-get remove gazebo9* catkin python-rospkg python-rospkg-modules

(Here, I also removed gazebo9 related packages and catkin that were installed with ros-desktop-full.) Afterwards, I tried to install the melodic desktop full version again and it worked for me.

edit flag offensive delete link more


Just for reference: you probably ran into UpstreamPackages.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-19 02:27:07 -0600 )edit

Same happened to me, accidentally first installed ros-desktop-full. Your command worked for me :)

sonjabrits gravatar image sonjabrits  ( 2020-04-21 07:29:42 -0600 )edit

answered 2020-05-05 02:53:44 -0600

Neeraj Patil gravatar image

I had encountered the same error. I overcome doing the following steps:-

1.This command will remove gazebo9 ,catkin , python-rospkg , python-rospkg-modules packages from your system

sudo apt-get remove gazebo9* catkin python-rospkg python-rospkg-modules

2.This command will remove packages from your system, for example, to remove ros related files:

sudo apt-get remove ros-*

3.This command will remove packages and their configuration files.

sudo apt-get purge ros-*

4.sudo apt-get remove ros-melodic-desktop-full

5.sudo apt-get purge ros-melodic-desktop-full

6.This command will remove dependencies that are no longer needed.

sudo apt-get autoremove

7.sudo apt-get install -f

8.sudo apt-get update

9.sudo apt-get upgrade

10.Now install ros-melodic-desktop-full

sudo apt install ros-melodic-desktop-full

References:link text

edit flag offensive delete link more

answered 2021-08-22 06:58:34 -0600

mobiiin gravatar image

Although I removed and purged all ros-kinetic packages prior to upgrading from Ubuntu 16 to 18, I still encountered this problem. in my case the issue was the conflicting python version which I've installed on Ubuntu 16 and got carried here. first off purge all ros and gazebo packages:

sudo apt-get purge ros-*
sudo apt-get remove gazebo* catkin python-rospkg python-rospkg-modules
sudo rm -r /opt/ros/
sudo apt autoremove

then remove and install the python library:

sudo rm -f /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa*
sudo apt remove libpython3.6-*
sudo apt update && sudo apt install -f && sudo apt upgrade
sudo apt install ubuntu-desktop

then restart and install the ros:

sudo apt install ros-melodic-desktop-full
edit flag offensive delete link more

answered 2021-05-07 18:26:06 -0600

Provide a possibility 1. Provide a possibility: check the software with the updated server and choose the right 2. Open all software updates and update them. After the update is complete it will reboot and try to install ROS again

edit flag offensive delete link more

answered 2021-02-26 13:51:00 -0600

I had this issue too and tried all these solutions, but these general solutions will give you clues and not fix the problem. The problem is usually caused by something you've done and you have to follow the clues. Here's what happened

Aptitude does give you more details than apt-get, so run it. i ran it and it said

The following actions will resolve these dependencies:

      Keep the following packages at their current version:
1)      libavcodec-dev [Not Installed]                     
2)      libavdevice-dev [Not Installed]                    
3)      libavfilter-dev [Not Installed]                    
4)      libavformat-dev [Not Installed]                    
5)      libavresample-dev [Not Installed]                  
6)      libgazebo9-dev [Not Installed]

..." up to 25 packages It did not succeed to install, and even when i clicked "Accept this solution Y" it still didnt work. But that list reminded me when I was fooling around with mpeg avcodec a while back . So i tried to install libavcodec-dev

I got:

The following packages have unmet dependencies:
 libavcodec-dev : Depends: libavutil-dev (= 7:3.4.8-0ubuntu0.2) but 7:4.1.3-0york1~18.04 is to be installed
                  Depends: libswresample-dev (= 7:3.4.8-0ubuntu0.2) but it is not going to be installed

So i tried sudo apt-get install libswresample-dev but got

The following packages have unmet dependencies:
 libswresample-dev : Depends: libavutil-dev (= 7:3.4.8-0ubuntu0.2) but 7:4.1.3-0york1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

So I tried

sudo apt-get install libavutil-dev
libavutil-dev is already the newest version (7:4.1.3-0york1~18.04).

NOW the issue is clear, when i was messing around with mpeg mp4 codecs I must have installed this york version (7:4.1.3-0york1~18.04) of the libavutil-dev package, which you can see from the errors will not work with libavcodec-dev, which blocks ros-melodic-desktop-full. So i removed that libavutil-dev and reinstalled it, which installed the correct package version (7:3.4.8-0ubuntu0.2) REMOVE BAD VERSION:

sudo apt-get remove libavutil-dev
The following packages will be REMOVED:
  libavutil-dev libswscale-dev
0 upgraded, 0 newly installed, 2 to remove and 103 not upgraded.
After this operation, 2,388 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 288297 files and directories currently installed.)
Removing libswscale-dev:amd64 (7:4.1.3-0york1~18.04) ...
Removing libavutil-dev:amd64 (7:4.1.3-0york1~18.04) ...


sudo apt-get install libavutil-dev 
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 103 not upgraded.
Get:1 bionic-updates/universe amd64 libavutil-dev amd64 7:3.4.8-0ubuntu0.2 [294 kB]
Preparing to unpack .../libavutil-dev_7%3a3.4.8-0ubuntu0.2_amd64.deb ...
Unpacking libavutil-dev:amd64 (7:3.4.8-0ubuntu0.2) ...
Setting up libavutil-dev:amd64 (7:3.4.8-0ubuntu0.2) ...


sudo apt-get install libswresample-dev
sudo apt-get install libavcodec-dev
sudo apt-get install ros-melodic-desktop-full


edit flag offensive delete link more

answered 2019-02-08 04:58:37 -0600

Configure your Ubuntu repositories properly and try further.

Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.

If not you can look into earlier python versions and dependencies.

edit flag offensive delete link more

answered 2021-09-20 07:49:22 -0600

nagda9 gravatar image

updated 2021-09-20 14:44:30 -0600

I tried all the solutions before, but none of them worked for me. I had a fresh ubuntu 18.04 install and I only run apt update and apt upgrade, and after this when I wanted to install ROS melodic this error occured. I solved the problem based on this stack overflow comment: link text


sudo aptitude install ros-melodic-desktop-full

Aptitude will display solutions, and just keep hitting 'n' until you get one that offers downgrades, and not leaving anything unresloved (otherwise ROS will not be installed).

edit flag offensive delete link more


you cannot install Kinetic on Ubuntu 18.04, it's not supported.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-20 09:24:37 -0600 )edit

Sry i mistyped, thanks for pointing it out.

nagda9 gravatar image nagda9  ( 2021-09-20 14:45:25 -0600 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2018-08-01 02:26:32 -0600

Seen: 15,727 times

Last updated: Sep 20 '21