You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 24, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 24, 2022. It is now read-only.
When trying to pip3 install pygithub3 I get the following
bot@theender:~/EnderBot3/bin$ ./pip3 install pygithub3
Downloading/unpacking pygithub3
Downloading pygithub3-0.5.1.tar.gz
Running setup.py (path:/home/znc/EnderBot3/build/pygithub3/setup.py) egg_info for package pygithub3
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/znc/EnderBot3/build/pygithub3/setup.py", line 7, in <module>
import pygithub3
File "/home/znc/EnderBot3/build/pygithub3/pygithub3/__init__.py", line 10, in <module>
from github import Github
ImportError: No module named 'github'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/znc/EnderBot3/build/pygithub3/setup.py", line 7, in <module>
import pygithub3
File "/home/znc/EnderBot3/build/pygithub3/pygithub3/__init__.py", line 10, in <module>
from github import Github
ImportError: No module named 'github'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/znc/EnderBot3/build/pygithub3
Storing debug log for failure in /home/znc/.pip/pip.log
Is there perhaps another step for installing that the readme doesn't tell about?
Reacted by Jamie Bliss, Floyd, Gilson de Paula, Mike Shultz and Patryk
I got it working by running pip3 install pygithub first. I'm not sure if it depends directly on that library or if that one correctly specifies dependencies, but it does work.
Reacted by Roman Bobin, Claudiu Creanga, Hans Schülein, Jared Burrows and Steve
I found what's probably the root cause of the above errors and the reason why installing pygithub first seems to resolve it:
pygithub3 uses a relative import: from github import Github -- it wants its own local github.py, but relative imports are only supported in Python 2; in Python 3 all imports must be absolute, or else this module would've had to do from .github import Github to explicitly import the local module. By installing pygithub first, you actually mask the underlying problem. When the __init__.py wants to import the local ./github.py module, it instead actually imports the other module you installed (pygithub).
The API is different between the two modules. You might end up with an error like this:
Traceback (most recent call last):
File "./gitchangelog.py", line 309, in <module>
github.main(args)
File "./gitchangelog.py", line 38, in main
reset=args.init)
File "./gitchangelog.py", line 111, in authenticate
self.api = Github(user=user, token=token, repo=repo)
TypeError: __init__() got an unexpected keyword argument 'repo'
Note that if you're solving this issue by doing pip install pygithub, you may actually end up with a Frankenstein's monster of a Python module.
Just use pygithub rather than python-github3 until the issue is properly fixed in this module. Per my earlier comment, installing pygithub "fixes" the issue because python-github3 actually ends up importing pygithub's github.py module rather than its own github.py module... which causes the error to go away, but now you have this module using the other module in weird ways that will likely lead to further confusion.
Activity
jpverkamp commentedon Sep 8, 2015
I got it working by running
pip3 install pygithubfirst. I'm not sure if it depends directly on that library or if that one correctly specifies dependencies, but it does work.kirsle commentedon Mar 10, 2016
I found what's probably the root cause of the above errors and the reason why installing
pygithubfirst seems to resolve it:pygithub3 uses a relative import: from github import Github -- it wants its own local github.py, but relative imports are only supported in Python 2; in Python 3 all imports must be absolute, or else this module would've had to do
from .github import Githubto explicitly import the local module. By installingpygithubfirst, you actually mask the underlying problem. When the__init__.pywants to import the local./github.pymodule, it instead actually imports the other module you installed (pygithub).The API is different between the two modules. You might end up with an error like this:
jpverkamp commentedon Mar 10, 2016
Hmm, the install looks to be a suboptimal way to solve it then (although in limited cases such as what I was doing, it does work well enough).
chemelli74 commentedon Apr 26, 2022
Issue still valid.
Solved the same way:
pip install pygithubas prerequisiteSimone
kirsle commentedon May 9, 2022
Note that if you're solving this issue by doing
pip install pygithub, you may actually end up with a Frankenstein's monster of a Python module.Just use
pygithubrather thanpython-github3until the issue is properly fixed in this module. Per my earlier comment, installing pygithub "fixes" the issue because python-github3 actually ends up importing pygithub'sgithub.pymodule rather than its owngithub.pymodule... which causes the error to go away, but now you have this module using the other module in weird ways that will likely lead to further confusion.