Python2.7 pipenv install failed: TypeError: 'encoding' is an invalid keyword argument for this function
Closed this issue · 1 comments
echocho commented
Steps to reproduce:
-
mkdir test-install-elasticmock && cd test-install-elasticmock
-
pipenv --two && pipenv shell
Using /usr/local/bin/python2.7 (2.7.17) to create virtualenv... -
pipenv install elasticmock
-
Error shows up
Error: An error occurred while installing elasticmock!
Error text: Collecting elasticmock
Using cached ElasticMock-1.6.1.tar.gz (13 kB)
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Command errored out with exit status 1:
command: /Users/zzheng/.local/share/virtualenvs/test-install-elasticmock-pvSvxvgZ/bin/python2.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sk/9mxz4q1x1pg9xb9vkws028s40000gn/T/pip-install-maD_Va/elasticmock/setup.py'"'"'; __file__='"'"'/private/var/folders/sk/9mxz4q1x1pg9xb9vkws028s40000gn/T/pip-install-maD_Va/elasticmock/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 /private/var/folders/sk/9mxz4q1x1pg9xb9vkws028s40000gn/T/pip-pip-egg-info-ECi5s2
cwd: /private/var/folders/sk/9mxz4q1x1pg9xb9vkws028s40000gn/T/pip-install-maD_Va/elasticmock/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/sk/9mxz4q1x1pg9xb9vkws028s40000gn/T/pip-install-maD_Va/elasticmock/setup.py", line 10, in <module>
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is likely caused by a bug in elasticmock. Report this to its maintainers.
Suggestion:
In python2 open()
doesn't not have parameter encoding
. Should add from io import open
to avoid this error.
echocho commented
Sorry, just realized that older versions don't have this issue.