Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry env install throws TypeError. #2028

Closed
3 tasks done
WoaDmulL opened this issue Feb 12, 2020 · 2 comments
Closed
3 tasks done

Poetry env install throws TypeError. #2028

WoaDmulL opened this issue Feb 12, 2020 · 2 comments
Labels
kind/bug Something isn't working as expected

Comments

@WoaDmulL
Copy link

  • 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: macOS Catalina 10.15.2

  • Poetry version: 1.0.3

  • Link of a Gist with the contents of your pyproject.toml file: Not needed

Issue

Whenever I try to install my env, it throws:

[TypeError]
expected string or bytes-like object

Traceback (most recent call last):
  File "/Users/woadmull/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/woadmull/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/woadmull/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/woadmull/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/woadmull/.poetry/lib/poetry/console/commands/install.py", line 48, in handle
    self.io, self.env, self.poetry.package, self.poetry.locker, self.poetry.pool
  File "/Users/woadmull/.poetry/lib/poetry/installation/installer.py", line 55, in __init__
    installed = self._get_installed()
  File "/Users/woadmull/.poetry/lib/poetry/installation/installer.py", line 488, in _get_installed
    return InstalledRepository.load(self._env)
  File "/Users/woadmull/.poetry/lib/poetry/repositories/installed_repository.py", line 26, in load
    package = Package(name, version, version)
  File "/Users/woadmull/.poetry/lib/poetry/packages/package.py", line 42, in __init__
    self._name = canonicalize_name(name)
  File "/Users/woadmull/.poetry/lib/poetry/utils/helpers.py", line 26, in canonicalize_name
    return _canonicalize_regex.sub('-', name).lower()

In the file poetry/lib/poetry/repositories/installed_repository.py there's a use for env.sys_path and the first entry for me is an empty string. As I can see from the docs https://docs.python.org/3/library/sys.html#sys.path

As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the interpreter is invoked interactively or if the script is read from standard input), path[0] is the empty string, which directs Python to search modules in the current directory first.

To get rid of the issue I had to skip over the empty entry by manually editing the file and skip the iteration that caused the issue.

@WoaDmulL WoaDmulL added the kind/bug Something isn't working as expected label Feb 12, 2020
@finswimmer
Copy link
Member

Hello @WoaDmulL,

I believe you hit the same problem as in #1953. And it looks like this issue isn't really a poetry issue but a virtualenv issue.

I will close yours as a duplicate. If you disagree feel free to leave a comment.

fin swimmer

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants