Google Certified Professional Data Engineer

Sign Up Free or Log In to participate!

ImportError: cannot import name pubsub_v1

ImportError: cannot import name pubsub_v1

I get this error when I run in my cloud shell. I tried updating the apt-get package etc as well, but no luck. 

Anyone else got this error?

3 Answers

Hi, sorry to hear you’re having trouble with the lab.

Did you run sudo pip3 install google-cloud-pubsub before executing the script?


i have the same problem, and yes i did run the same command sudo pip3…

You’re probably running old version of python on your VM. Try using python3 instead of python as a command.


i’m not sure, the instructor run the commands using python2, according to his console output.

Hi Leo, the behaviour of Cloud Shell seems to have changed since the lab was recorded (it does look like I was using python2, but it was apparently being more forgiving at the time!) Please try running python3 and it should work. Thanks!

Emerson Gomes

using python3 works! Thanks Tim!


It works with ‘python3’

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?