qiboteam / qibo-client

Qibo remote connection client.
https://qibo.science
Apache License 2.0
3 stars 1 forks source link

`poetry install` fails due to a `KeyError` #94

Closed BrunoLiegiBastonLiegi closed 9 hours ago

BrunoLiegiBastonLiegi commented 10 hours ago

Running poetry install -vvv fails for me:

``` python (qibo) ➜ qibo-client git:(main) poetry install -vvv Using virtualenv: /Users/andrea/python_envs/qibo Stack trace: 20 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/application.py:327 in run 325│ 326│ try: → 327│ exit_code = self._run(io) 328│ except BrokenPipeError: 329│ # If we are piped to another process, it may close early and send a 19 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/console/application.py:190 in _run 188│ self._load_plugins(io) 189│ → 190│ exit_code: int = super()._run(io) 191│ return exit_code 192│ 18 ~/python_envs/qibo/lib/python3.11/site-packages/poethepoet/plugin.py:276 in _run 274│ tokens.insert(task_name_index, "--") 275│ → 276│ return continue_run(self, io) 277│ 278│ # Apply the patch 17 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/application.py:431 in _run 429│ io.input.interactive(interactive) 430│ → 431│ exit_code = self._run_command(command, io) 432│ self._running_command = None 433│ 16 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/application.py:473 in _run_command 471│ 472│ if error is not None: → 473│ raise error 474│ 475│ return terminate_event.exit_code 15 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/application.py:454 in _run_command 452│ 453│ try: → 454│ self._event_dispatcher.dispatch(command_event, COMMAND) 455│ 456│ if command_event.command_should_run(): 14 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:26 in dispatch 24│ 25│ if listeners: → 26│ self._do_dispatch(listeners, event_name, event) 27│ 28│ return event 13 ~/python_envs/qibo/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:85 in _do_dispatch 83│ break 84│ → 85│ listener(event, event_name, self) 86│ 87│ def _sort_listeners(self, event_name: str) -> None: 12 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/console/application.py:322 in configure_installer_for_event 320│ return 321│ → 322│ cls.configure_installer_for_command(command, event.io) 323│ 324│ @staticmethod 11 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/console/application.py:329 in configure_installer_for_command 327│ 328│ poetry = command.poetry → 329│ installer = Installer( 330│ io, 331│ command.env, 10 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/installation/installer.py:74 in __init__ 72│ 73│ if installed is None: → 74│ installed = self._get_installed() 75│ 76│ self._installed_repository = installed 9 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/installation/installer.py:443 in _get_installed 441│ 442│ def _get_installed(self) -> InstalledRepository: → 443│ return InstalledRepository.load(self._env) 444│ 8 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/repositories/installed_repository.py:274 in load 272│ continue 273│ → 274│ package = cls.create_package_from_distribution(distribution, env) 275│ 276│ if with_dependencies: 7 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/repositories/installed_repository.py:132 in create_package_from_distribution 130│ source_url, 131│ source_reference, → 132│ ) = cls.get_package_vcs_properties_from_path(src) 133│ break 134│ 6 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/repositories/installed_repository.py:80 in get_package_vcs_properties_from_path 78│ from poetry.vcs.git import Git 79│ → 80│ info = Git.info(repo=src) 81│ return "git", info.origin, info.revision 82│ 5 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/vcs/git/backend.py:181 in info 179│ @classmethod 180│ def info(cls, repo: Repo | Path) -> GitRepoLocalInfo: → 181│ return GitRepoLocalInfo(repo=repo) 182│ 183│ @staticmethod 4 :3 in __init__ 1│ 3 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/vcs/git/backend.py:153 in __post_init__ 151│ repo = Git.as_repo(repo=repo) if not isinstance(repo, Repo) else repo 152│ self.origin = Git.get_remote_url(repo=repo, remote="origin") → 153│ self.revision = Git.get_revision(repo=repo) 154│ 155│ 2 ~/python_envs/qibo/lib/python3.11/site-packages/poetry/vcs/git/backend.py:177 in get_revision 175│ def get_revision(repo: Repo) -> str: 176│ with repo: → 177│ return repo.head().decode("utf-8") 178│ 179│ @classmethod 1 ~/python_envs/qibo/lib/python3.11/site-packages/dulwich/repo.py:650 in head 648│ def head(self) -> bytes: 649│ """Return the SHA1 pointed at by HEAD.""" → 650│ return self.refs[b"HEAD"] 651│ 652│ def _get_object(self, sha, cls): KeyError b'HEAD' at ~/python_envs/qibo/lib/python3.11/site-packages/dulwich/refs.py:325 in __getitem__ 321│ This method follows all symbolic references. 322│ """ 323│ _, sha = self.follow(name) 324│ if sha is None: → 325│ raise KeyError(name) 326│ return sha 327│ 328│ def set_if_equals( 329│ self, ```

(edit: sorry forgot to mention that this is the verbose mode -vvv without it you just get a printed b"HEAD")

alecandido commented 9 hours ago

Ok, that's pretty peculiar. The suitable place to post it is actually https://github.com/orgs/python-poetry/discussions (Poetry should not spit an internal error in your face, no matter what - so that's close to a bug...), but I'm interested in the solution/explanation myself.

In any case, that's apparently not due to Poetry itself, since you're passing through poethepoet

  18  ~/python_envs/qibo/lib/python3.11/site-packages/poethepoet/plugin.py:276 in _run

(Poetry is loading it as a plugin, even if you're not invoking it directly).

So, as a first attempt, I'd try to uninstall poethepoet and rerun poetry install.

BrunoLiegiBastonLiegi commented 9 hours ago

yeah no ok this was a problem of mine, locally, deactivating and reactivating the environment apparently solved it...