9

I wrote a basic Python 3 script that uses the Google Sheets API. It works on a system that defaults to Python 3 (Arch). I'm trying to run the same script on an Ubuntu 14.04 system, but I'm unable to load the apiclient library. I installed with the recommended pip install --upgrade google-api-python-client But I noticed I can only load the library in python 2.

Here's what I'm observing:

~ $ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
>>> quit()
~ $ python3
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'googleapiclient'

Any advice?

blee
  • 566
  • 3
  • 6
  • 14

2 Answers2

18

The Googleapiclient is installed only on python2 (Which i guess is your default python version) not python3.

Install Googleapiclient in python3 env using the following:

pip3 install --upgrade google-api-python-client
2
python -m  pip install --upgrade google-api-python-client
4b0
  • 21,981
  • 30
  • 95
  • 142
  • 2
    Hi Nikhil, could you please detail your answer by explaining why you think that might be a valid solution? With maybe some references as well? :) – Ullaakut Jan 31 '20 at 10:31
  • 1
    Code-only answers are considered low quality: make sure to provide an explanation what your code does and how it solves the problem. It will help the asker and future readers both if you can add more information in your post. See also Explaining entirely code-based answers: https://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers – borchvm Jan 31 '20 at 10:48