CUDA 9.2 for Ubuntu 18.04

Is it possible to port CUDA 9.2 for Ubuntu 18.04 especially debian packages including TensorRt and so on, or when will the next port will be done.

I was able to get 9.2 running on my 18.04 (Kubuntu specifically, but I doubt Kubuntu vs. Ubuntu makes a difference). But it didn’t work out of the box. From what I’ve heard, Ubuntu changed the package management system going into 18, and that change hasn’t worked its way into the nVIDIA installers. When I followed Section 3.6 of the 9.2.148 installation manual (, having already installed the driver from the Ubuntu repo, I ended up with two versions of the driver installed, and weird conflicts which caused

  1. Bad driver performance (glmark2 scores were worse than the CPU integrated graphics by far);
  2. Any CUDA sample code that used graphics, such as 5_Simulations/nbody, would crash as soon as the window popped up.

I purged everything and reinstalled, but this time, I first installed the driver from Ubuntu:

sudo ubuntu-drivers autoinstall

and it installed version 396.54. Then I went through the steps in 3.8 (installing from deb files), but in step 5, instead of installing “cuda,” I did:

sudo apt-get install cuda-toolkit-9-2

Both “cuda” and “cuda-toolkit-9-2” are meta=packages; the latter apparently installs everything the former does except the driver.

Then glmark2 reported good graphics perf (way above CPU graphics and GPU with the nouveau driver). And a sample of graphics-using samples, such as nbody and 2_Graphics/Mandelbrot, all seemed to work.

BTW, my GPU is a GeForce MX150 with capability 6.1.

So maybe this should be an open thread: what experiences have others had with CUDA on 18.04 (assuming a correct installation as described above)? If anyone has found problems with 18.04 that they didn’t have with 17.10 then post here. This will help nVIDIA debug their installers.

I hope 18.04 gets official support soon as 17.10 is already technically EOL whereas 18.04 is LTS.

Ok thx i will try this for ubuntu 18.04

Great! I haven’t used TensorRT – is that in the 18.04 repo? If you try it, can you post your findings here?

@markus.gruber4 @kevintheobald

There is a Solution:

I used to come to this forum a lot, every time I was stuck and unable to get my Ubuntu 16.04 to run or to bring up a GUI. So pretty much at least once a week. I don’t think I’ve been here to seek help in four-to=six months - maybe once or twice starting out with RHEL.

The reason I haven’t been here is that there’s a waaaayyyy better distro to use that is a variant on Ubuntu, which I assumed people in this forum would have heard of by now. Now I realize that people who have found it don’t need to come here so much. So, for those of you still here trying to figure out why synaptic won’t let you install the nvidia driver because it’s already installed (even though it’s NOT installed), guess what? Those days are over.

Here you go:

Go to System76 and download Pop_OS 18.04. And …
(bet you’ve never heard anybody use the following words together in a sentence…):

Be sure to select the NVIDIA Build of PopOS 18.04.

Yup. It is compiled for NVIDIA, and has considerable changes to the kernel code of Ubuntu, specifically tailored to make this Ubuntu-derivative play nice with NVIDIA hardware and drivers. It has many other kernel changes to get rid of other Ubuntisms that cause anyone in HPC / stats / AI with an NVIDIA GPU running on Ubuntu to live in perpetual fear of The Black Screen Loop. That does not happen on PopOS. I started using PoPOS in May on two machines, one is a System 76 Oryx Pro (with 1070 Ti), the other is a cheapo Acer Nitro 15" laptop with a discrete internal 1050Ti. And here’s some more words you’ve never heard used together in a sentence before:

In the four months from then until now I have never had a black screen loop, hang, or crash on either machine. If you have any experience with Ubuntu trying to run CUDA, I know you will have a hard time believing that.

And the setup is as easy or easier than setting up Windows 10, and much faster. They even have a simple and reliable flash burner. Works the first time. I swear.

Now I’m going to truly stretch the bounds of credibility. First, the set-up: in the six months prior to Feb 2018, I literally lost a month of productivity to Ubuntu: things like system-bricking stealth kernel updates (remember January?), or installing the latest CUDA and NVIDIA driver releases to support a new GPU - like what you’re trying to do now. Things that shouldn’t be a big deal were show-stoppers. As a result, in February of this year I switched my machines to RHEL 7 (Dev edition, which is free). That was a huge improvement: CUDA / driver updates on RHEL can still set you back a day, and when RHEL pushes system updates, CUDA users can usually count on a temporary console-only experience. But RHEL has doc, they’re prepared for the releases, and they publish procedures on what to do (as opposed to setting up “Ask Redhat”). So losing only a day or two per month with RHEL seemed like paradise, because using Ubuntu had set the bar so low.

Here’s what I do now to install the latest CUDA updates, NVIDIA drivers, and system updates (oh, and TensorFlow):

I set my Pop_OS systems to auto-download all package info as they are pushed, and that includes the latest NVidia Drivers, three (3) versions of CUDA (9.0, 9.1, and 9.2) which are selectable (along with the approprate gcc stack) by the update-alternatives system. Then I click the install button. Sometimes the system requests a reboot after install. And everything just keeps working.

When new NVIDIA drivers, or a new CUDA release, or both come out, you don’t have to install them. They’ll just be installed on your machine automatically with everything else**.

** There is one exception: you have to install the Samples yourself, because of a licensing issue with some images used in one of the samples, it cannot be redistributed. Fortunately, the NVidia runfile packaging has a flag that let’s you install just the sample files

The PopOS team do their own deb packaging, and write their own firmware, which helps to facilitate switching between GPU and on-chip graphics to save power.

PoP is deliberately designed to make it easy to install, use, and configure NVIDIA software, drivers, and utilities.

EDITORIAL OPINION, ENTIRELY MY PERSONAL VIEW: My experience has been that the Ubuntu organization appears to be trying to make it progressively harder to install, use, and configure NVIDIA software, drivers, and utilities. I will not comment on the legitimacy or bogosity of any grudge held against NVIDIA, but to the degree it exists, the pain is NOT being felt by NVIDIA so much as it is borne by scientific programmers and other HPC users who need to use Linux and NVIDIA GPUs, because those are the only pragmatic alternatives in their respective categories. The fact that in my case the pain went away when Ubuntu was removed from the equation is evidence that the cause was not NVIDIA.

… whew for a minute there i lost myself …
I believe you can switch between proprietary and OpenGL, not sure because I don’t use them much - not a graphics person.
I don’t personally know anybody who uses Nouveau, but if Linus Torvalds is coming over to personally inspect your computer, you can switch to Nouveau so that you don’t get in trouble.

Oh, did I forget to mention TensorFlow? No foolin’. PoP has its own packaging of the latest TF, full install with Keras, etc, that supports the python API, the C++ API, and the C API. Both the GPU and non-GPU versions, if you want to switch off your GPU while you’re on the plane to save power. Most people use TF in the cloud, or via conda/anaconda, because installing it proper is worse than installing CUDA etc on Ubuntu, which is actually a subset of the TF install process. Google’s packages are awful because they build with the godawful Bazel packaging system, primarily because it has Android support. The PoP version is built with CMake, so it’s much cleaner and more maintainable.

Now, think about it. How much pain and frustration have you expended trying to get the latest CUDA installed on Ubuntu, to say nothing of TensorFlow?
Would you believe me if I told you there an Ubuntu derivative that is compiled for NVIDIA GPUs, comes with the last few versions of CUDA installled, along with TensorFlow, and the latest graphics drivers, and keeps them updated automatically, and for bonus points fixes Ubuntu so that it works?
Oh, and the UI is suh-weeeet.

No, I wouldn’t believe it either, but there’s a way to verify:

You can boot PoP_OS full up from a flash drive on your computer without actually installing it.

Hopefully this will put an end to the suffering of many Data Scientists, and Real Scientists as well.

====>> Bourbakis Student, PhD



  1. I am not now, have never been, and am unlikely to become, an employee of System76 - I’m a quant in CA, not a systems dev in CO
  2. This is a free product and I hold no beneficial interest related to its adoption - if you can think of a way to change that let me know!

3) I am putting this up because I’ve gone through a huge amount of frustration and wasted time, and finally there’s a solution.
4) I had some seriously unhappy experiences with CUDA on Ubuntu that were … unnecessary.
5) I saw other people going through the same a year ago, and I see them still going through it. Now it’s REALLY unnecessary.

6) FULL DISCLOSURE: Starting in May/June of this year, I got involved in the CUDA portion of PoP through the open source process:
7) Specifically, when I first saw and downloaded PoP, it had CUDA support in theory, but was not what it is now.
8) PoP had an NVIDIA build and drivers, but relied on a Debian packaging of CUDA and a Debian packaging of NVIDIA graphics
9) I had never heard there was a Debian packaging of CUDA (have you?). Subsequent analysis explained why not.
10) So I launched an issue on Github, which is now closed but can be found and read. FYI, MM is literally a genius of first order AFAIK.