Python 3.8 - "TypeError: expected string or bytes-like object" with poetry install
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: gitlab python3.8 docker image
-
Poetry version: 1.0.3
-
Link of a Gist with the contents of your pyproject.toml file: gitlab-ci report
Issue
I have a project using poetry that use Gitlab-CI and tox to run tests in several environments. The very same code works in python 3.5, 3.6 and 3.7, but produce the following error with python 3.8. The error message is not very clear so I am not sure what is going on.
You can view all the successful executions here and the failing one here. If it matters, you can see the tox configuration here and the poetry configuration here.
py38 run-test: commands[0] | poetry install -vvv --extras all
Using virtualenv: /builds/yaal/sheraf/.tox/py38
[TypeError]
expected string or bytes-like object
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/usr/local/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/usr/local/lib/python3.8/site-packages/poetry/console/commands/install.py", line 47, in handle
installer = Installer(
File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 55, in __init__
installed = self._get_installed()
File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 488, in _get_installed
return InstalledRepository.load(self._env)
File "/usr/local/lib/python3.8/site-packages/poetry/repositories/installed_repository.py", line 26, in load
package = Package(name, version, version)
File "/usr/local/lib/python3.8/site-packages/poetry/packages/package.py", line 42, in __init__
self._name = canonicalize_name(name)
File "/usr/local/lib/python3.8/site-packages/poetry/utils/helpers.py", line 26, in canonicalize_name
return _canonicalize_regex.sub("-", name).lower()
ERROR: InvocationError for command /usr/local/bin/poetry install -vvv --extras all (exited with code 1)
Thank you for your help
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:33 (7 by maintainers)
This will also happen if you somehow end up with an .egg-info file (presumably malformatted) in your project directory. I think I created one unintentionally while experimenting with dephell, but regardless of the source this is what you can expect to see:
What is the solution to this? This ticket is closed, but I am still getting the issue. I have read every comment here and did not see what allowed this to be closed. If this is fixed in some version of poetry, can someone please be explicit about which specific version of poetry this is fixed in? Thank you.