Poetry raises a [TypeError]'encoding' is an invalid keyword argument for this function when running in Python2.7 virtual environment
See original GitHub issue-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option). -
OS version and name: Ubuntu 18.04
-
Poetry version: 0.12.17
-
Link of a Gist with the contents of your pyproject.toml file: I am not allowed due to company rules
Issue
When running poetry (command: poetry update
) from within a 2.7 virtual environment while parsing a package defined as a git repository the following error occurs:
[TypeError]
'encoding' is an invalid keyword argument for this function
when run with the -vvv option I get the following:
Exception trace:
/home/mroscoe/.poetry/lib/poetry/_vendor/py2.7/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/mroscoe/.poetry/lib/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/home/mroscoe/.poetry/lib/poetry/_vendor/py2.7/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/mroscoe/.poetry/lib/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/home/mroscoe/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/mroscoe/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/mroscoe/.poetry/lib/poetry/console/commands/update.py in handle() at line 41
return installer.run()
/home/mroscoe/.poetry/lib/poetry/installation/installer.py in run() at line 73
self._do_install(local_repo)
/home/mroscoe/.poetry/lib/poetry/installation/installer.py in _do_install() at line 290
self._execute(op)
/home/mroscoe/.poetry/lib/poetry/installation/installer.py in _execute() at line 306
getattr(self, "_execute_{}".format(method))(operation)
/home/mroscoe/.poetry/lib/poetry/installation/installer.py in _execute_install() at line 331
self._installer.install(operation.package)
/home/mroscoe/.poetry/lib/poetry/installation/pip_installer.py in install() at line 35
self.install_git(package)
/home/mroscoe/.poetry/lib/poetry/installation/pip_installer.py in install_git() at line 230
self.install_directory(pkg)
/home/mroscoe/.poetry/lib/poetry/installation/pip_installer.py in install_directory() at line 196
with open(setup, "w", encoding="utf-8") as f:
I was able to resolve the issue by adding the following import to the pip_installer.py
file:
from io import open
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Poetry raises a [TypeError]'encoding' is an invalid keyword ...
Poetry raises a [TypeError]'encoding' is an invalid keyword argument for this function when running in Python2.7 virtual environment #1290.
Read more >TypeError: 'encoding' is an invalid keyword argument for this ...
The terminal you are trying to run this on probably uses Python 2.x as standard. Try using the command "Python3" specifically in the ......
Read more >'encoding\' is an invalid keyword argument for this function ...
I have a tine code snippet and it gives me the following error: TypeError: 'encoding' is an invalid keyword argument for this function....
Read more >Python error TypeError encoding is an invalid keyword ...
I have a tine code snippet and it gives me the following error: TypeError: 'encoding' is an invalid keyword argument for this function....
Read more >Source code for xonsh.__amalgam
ArgumentParser ": """A bare-bones argparse builder from functions""" doc = get_doc(func) ... description="Python virtual environment manager for xonsh.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also ran into this issue, on Poetry version 1.0.5 on Ubuntu 18.04 and running poetry inside a conda environment.
Apparently this can be caused by an outdated
msgback-python
package documented here and here.I was able to solve this by running
pip install --upgrade --user msgpack-python
.Yes it is still relevant and needs to be fixed