ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.34k stars 324 forks source link

pip install fails on python3.8 #216

Closed hobson closed 3 years ago

hobson commented 3 years ago

Environment

Ubuntu 20.04 Python 3.7.9: conda create -n py38 'python>=3.8,<3.9' && conda activate py38

Reproduce

  1. activate a python 3.8+ environment
  2. pip install from pypi or from source: git clone git@github.com:ejwa/gitinspector && cd gitinspector && pip install -e .

Traceback

$ git clone git@github.com:ejwa/gitinspector && cd gitinspector
$ conda create -n py38 'python>=3.8,<3.9' && conda activate py38
$ python --version
Python 3.8.5
$ pip install .
Processing /home/hobs/code/tangibleai/gitinspector
    ERROR: Command errored out with exit status 1:
     command: /home/hobs/anaconda3/envs/py38/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-0blcltb3/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-0blcltb3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-kmx4x74r
         cwd: /tmp/pip-req-build-0blcltb3/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-0blcltb3/setup.py", line 22, in <module>
        from gitinspector.version import __version__
      File "/tmp/pip-req-build-0blcltb3/gitinspector/version.py", line 23, in <module>
        localization.init()
      File "/tmp/pip-req-build-0blcltb3/gitinspector/localization.py", line 71, in init
        __translation__.install(True)
      File "/home/hobs/anaconda3/envs/py38/lib/python3.8/gettext.py", line 352, in install
        for name in allowed & set(names):
    TypeError: 'bool' object is not iterable
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Workaround

downgrade to python <3.8

maccuaa commented 3 years ago

Removing True from that line worked for me - localization.py:71

- __translation__.install(True)
+ __translation__.install()

Python 3.9.0 macOS 10.14.6

adam-waldenberg commented 3 years ago

Yep - seems the API changed here in more recent bindings of gettext. Will take a proper look for the next release. Thank you for the report and solution.

adam-waldenberg commented 3 years ago

Closing this, as it is a duplicate. See #213 for the original reported issue.

thiagodp commented 3 years ago

Python 3.9.4 on Windows 10 20H2

It still gives the following error after making the change proposed by @maccuaa

C:\dev\python\lib\subprocess.py:941: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)
Traceback (most recent call last):
  File "C:\Users\Thiago\AppData\Roaming\npm\node_modules\gitinspector\gitinspector.py", line 24, in <module>
    gitinspector.main()
  File "C:\Users\Thiago\AppData\Roaming\npm\node_modules\gitinspector\gitinspector\gitinspector.py", line 206, in main
    run.process(repos)
  File "C:\Users\Thiago\AppData\Roaming\npm\node_modules\gitinspector\gitinspector\gitinspector.py", line 58, in process
    localization.disable()
  File "C:\Users\Thiago\AppData\Roaming\npm\node_modules\gitinspector\gitinspector\localization.py", line 106, in disable
    gettext.NullTranslations().install(True)
  File "C:\dev\python\lib\gettext.py", line 354, in install
    for name in allowed & set(names):
TypeError: 'bool' object is not iterable

Removing True from localization.py:106 worked for me, although still receiving the following warning:

C:\dev\python\lib\subprocess.py:941: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)