0

I'm getting the error ImportError: No module named oauth2client when I try to run a Python script that uses google-api-python-client

I had a lot going on in this computer in terms of Python installations, but as far as I can tell things look consistent now:

$ which python
/Users/bani/.pyenv/shims/python
$ which pip
/Users/bani/.pyenv/shims/pip
$ pyenv which python
/usr/local/bin/python
$ pip install --upgrade oauth2client
Requirement already up-to-date: oauth2client in /usr/local/lib/python2.7/site-packages

/Users/bani/.pyenv/shims is also the first thing in my PATH.

What am I missing?

Bani
  • 1,149
  • 2
  • 10
  • 17
  • How do you run the script? `python script` or just `script`? In the latter case what is the shebang line in the script? – phd Sep 14 '17 at 16:53
  • `python script` :( – Bani Sep 15 '17 at 04:31
  • What are the versions? `python --version` and `pip --version`. Does `python -c 'import oauth2client'` work from command line? – phd Sep 15 '17 at 10:21
  • @phd `$ python --version` `Python 2.7.12` `$ pip --version` `pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)` `$ python -c 'import oauth2client'` `ImportError: No module named oauth2client` – Bani Sep 16 '17 at 00:41
  • 1
    Is there `oauth2client` directory in `/usr/local/lib/python2.7/site-packages`? Directory `oauth2client-4.1.2.dist-info`? If there is the latter but not the former remove the latter and reinstall `oauth2client`. – phd Sep 16 '17 at 06:04
  • I have both directories. – Bani Sep 17 '17 at 00:37
  • Ok, I tried a pip uninstall followed by a pip install and that seemed to fix oauth! Now it's the next lib that is broken... any advice to clean up everything at once? – Bani Sep 17 '17 at 00:41
  • Nevermind, I just needed to do it with one more lib. Thanks for your help! – Bani Sep 17 '17 at 00:42

0 Answers0