I am Charmie

メモとログ

cuda toolkit installation on Ubuntu 16.04 after upgrading from Ubuntu 14.04

This post explains how to upgrade cuda toolkit on ubuntu 16.04 after upgrading OS from ubuntu 14.04.

I got the following error when I tried to upgrade cuda toolkit from 7.5 to 8.0 by

sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb

on terminal outputs the following error.

Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 743925 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.44-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.44-1) ...
dpkg: error processing archive cuda-repo-ubuntu1604_8.0.44-1_amd64.deb (--install):
 trying to overwrite '/etc/apt/sources.list.d/cuda.list', which is also in package cuda-repo-ubuntu1404 8.0.44-1
Errors were encountered while processing:
 cuda-repo-ubuntu1604_8.0.44-1_amd64.deb

The above error indicates that there's a conflict between the current cuda-related repository (for ubuntu 14.04) and the new upgrade (for ubuntu 16.04).

My solution was first remove the repository settings for ubuntu 14.04 by typing

sudo dpkg --purge cuda-repo-ubuntu1404

and then install the toolkit as

  1. sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
  2. sudo apt-get update
  3. sudo apt-get install cuda