Search code examples
pythongithub-apipygithub

Using PyGithub basic script complains "No module named 'requests'"


I am using PyGithub from https://github.com/PyGithub/PyGithub to try out the github API to collect data from my code repository.

I did the following to try install all that is needed.

sudo pip3 install PyGithub
sudo pip3 install requests
sudo pip3 install pipenv
pipenv run pip3 install requests

I am trying to run the following sample script:

import requests
import json
r = requests.get('https://api.github.com/repos/django/django')
if(r.ok):
    repoItem = json.loads(r.text or r.content)
    print "Django repository created: " + repoItem['created_at']

But I keep getting the following error

ModuleNotFoundError: No module named 'requests'

What am I missing?


Solution

  • Upgrading to python3.8 and pip3.8 resolved the issue