Repository: python-poetry/poetry

Issue:
Poetry does not handle trailing slashes in Git urls
<!--
    Hi there! Thank you for submitting a bug report!

    Before you submit your issue, please review and follow the instructions at
    https://python-poetry.org/docs/contributing/#reporting-bugs. Fully fill out the template below; insufficient
    information or bad reproduction instructions will impair the ability of others to help you.
-->

<!-- All the below information must be provided for others to understand and help with your issue. -->
- **Poetry version**: 1.3.1
- **Python version**: 3.7.3
- **OS version and name**: macOS 13.1
- **pyproject.toml**: https://gist.github.com/LK/761d690f1f119cfd60deb695580448d9

<!-- All the below steps should be completed before submitting your issue. Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) stable Poetry version, installed using a recommended method.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] I have consulted the [FAQ](https://python-poetry.org/docs/faq/) and [blog](https://python-poetry.org/blog/) for any relevant entries or release notes.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option) and have included the output below.

## Issue
<!-- Now feel free to write your issue, and please be as descriptive as possible! Make sure to include detailed reproduction steps. -->
<!-- Thanks again 🙌 ❤ -->
When installing multiple packages from git repositories, we see a few different failures modes when running `poetry install`. This seems like maybe some kind of race condition, because this doesn't reliably reproduce when the pyproject.toml only includes the git packages, so might have to do with how the installs are scheduled with this particular configuration of packages.

1. Failure 1 (Recoverable): this usually resolves itself by running `poetry install`.

<details>
<summary>Logs</summary>

```
❯ poetry install -vvv
Loading configuration file /Users/lennykhazan/Library/Preferences/pypoetry/config.toml
The currently activated Python version 3.7.3 is not supported by the project (3.9.15).
Trying to find and use a compatible version.
Trying python3
Trying python3.9
Using python3.9 (3.9.15)
Creating virtualenv api-server-apps-UDS0uKpv-py3.9 in /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs
Using virtualenv: /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 47 installs, 0 updates, 0 removals

  • Installing pyasn1 (0.4.8): Pending...
  • Installing pyasn1 (0.4.8): Installing...
  • Installing pyasn1 (0.4.8)
  • Installing cachetools (5.2.1): Pending...
  • Installing cachetools (5.2.1): Installing...
  • Installing cachetools (5.2.1)
  • Installing certifi (2022.12.7): Pending...
  • Installing certifi (2022.12.7): Installing...
  • Installing certifi (2022.12.7)
  • Installing chardet (4.0.0): Pending...
  • Installing chardet (4.0.0): Installing...
  • Installing chardet (4.0.0)
  • Installing idna (2.10): Pending...
  • Installing idna (2.10): Installing...
  • Installing idna (2.10)
  • Installing protobuf (3.20.3): Pending...
  • Installing protobuf (3.20.3): Installing...
  • Installing protobuf (3.20.3)
  • Installing pyasn1-modules (0.2.8): Pending...
  • Installing pyasn1-modules (0.2.8): Installing...
  • Installing pyasn1-modules (0.2.8)
  • Installing pycparser (2.21): Pending...
  • Installing pycparser (2.21): Installing...
  • Installing pycparser (2.21)
  • Installing rsa (4.9): Pending...
  • Installing rsa (4.9): Installing...
  • Installing rsa (4.9)
  • Installing six (1.16.0): Pending...
  • Installing six (1.16.0): Installing...
  • Installing six (1.16.0)
  • Installing urllib3 (1.26.13): Pending...
  • Installing urllib3 (1.26.13): Installing...
  • Installing urllib3 (1.26.13)
  • Installing cffi (1.15.1): Pending...
  • Installing cffi (1.15.1): Installing...
  • Installing cffi (1.15.1)
  • Installing google-auth (2.15.0): Pending...
  • Installing google-auth (2.15.0): Installing...
  • Installing google-auth (2.15.0)
  • Installing googleapis-common-protos (1.58.0): Pending...
  • Installing googleapis-common-protos (1.58.0): Installing...
  • Installing googleapis-common-protos (1.58.0)
  • Installing requests (2.25.1): Pending...
  • Installing requests (2.25.1): Installing...
  • Installing requests (2.25.1)
  • Installing async-timeout (4.0.2): Pending...
  • Installing async-timeout (4.0.2): Installing...
  • Installing async-timeout (4.0.2)
  • Installing bcrypt (4.0.1): Pending...
  • Installing bcrypt (4.0.1): Installing...
  • Installing bcrypt (4.0.1)
  • Installing cryptography (39.0.0): Pending...
  • Installing cryptography (39.0.0): Installing...
  • Installing cryptography (39.0.0)
  • Installing google-api-core (1.34.0): Pending...
  • Installing google-api-core (1.34.0): Installing...
  • Installing google-api-core (1.34.0)
  • Installing opencensus-context (0.2.dev0): Pending...
  • Installing opencensus-context (0.2.dev0): Installing...
  • Installing opencensus-context (0.2.dev0)
  • Installing pynacl (1.5.0): Pending...
  • Installing pynacl (1.5.0): Installing...
  • Installing pynacl (1.5.0)
  • Installing charset-normalizer (3.0.1): Pending...
  • Installing charset-normalizer (3.0.1): Installing...
  • Installing charset-normalizer (3.0.1)
  • Installing future (0.18.2): Pending...
  • Installing future (0.18.2): Installing...
  • Installing future (0.18.2)
  • Installing mypy-extensions (0.4.3): Pending...
  • Installing mypy-extensions (0.4.3): Installing...
  • Installing mypy-extensions (0.4.3)
  • Installing numpy (1.24.1): Pending...
  • Installing numpy (1.24.1): Installing...
  • Installing numpy (1.24.1)
  • Installing opencensus (0.8.dev0 ec72cd3): Pending...
  • Installing opencensus (0.8.dev0 ec72cd3): Cloning...
  • Installing opencensus (0.8.dev0 ec72cd3): Building...
  • Installing opencensus (0.8.dev0 ec72cd3)
  • Installing paramiko (2.12.0): Pending...
  • Installing paramiko (2.12.0): Installing...
  • Installing paramiko (2.12.0)
  • Installing probableparsing (0.0.1): Pending...
  • Installing probableparsing (0.0.1): Installing...
  • Installing probableparsing (0.0.1)
  • Installing prometheus-client (0.15.0): Pending...
  • Installing prometheus-client (0.15.0): Installing...
  • Installing prometheus-client (0.15.0)
  • Installing python-crfsuite (0.9.8): Pending...
  • Installing python-crfsuite (0.9.8): Installing...
  • Installing python-crfsuite (0.9.8)
  • Installing python-dateutil (2.8.2): Pending...
  • Installing python-dateutil (2.8.2): Installing...
  • Installing python-dateutil (2.8.2)
  • Installing pytz (2022.7): Pending...
  • Installing pytz (2022.7): Installing...
  • Installing pytz (2022.7)
  • Installing redis (4.4.1): Pending...
  • Installing redis (4.4.1): Installing...
  • Installing redis (4.4.1)
  • Installing testing-common-database (2.0.3): Pending...
  • Installing testing-common-database (2.0.3): Installing...
  • Installing testing-common-database (2.0.3)
  • Installing typed-ast (1.4.3): Pending...
  • Installing typed-ast (1.4.3): Installing...
  • Installing typed-ast (1.4.3)
  • Installing typing-extensions (4.4.0): Pending...
  • Installing typing-extensions (4.4.0): Installing...
  • Installing typing-extensions (4.4.0)
  • Installing docstring-parser (0.15): Pending...
  • Installing docstring-parser (0.15): Installing...
  • Installing docstring-parser (0.15)
  • Installing mock (4.0.3): Pending...
  • Installing mock (4.0.3): Installing...
  • Installing mock (4.0.3)
  • Installing mypy (0.812): Pending...
  • Installing mypy (0.812): Installing...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
  • Installing mypy (0.812)
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Building...
  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
       205│             )
  • Installing pandas (1.1.5)
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
       205│             )
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3)
  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pandas (1.1.5)
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
       205│             )
       206│             return result

   4  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/client.py:849 in fetch
        847│             raise
        848│         else:
     →  849│             commit()
        850│         target.update_shallow(result.new_shallow, result.new_unshallow)
        851│         return result

   3  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/client.py:828 in commit
        826│                 if f.tell():
        827│                     f.seek(0)
     →  828│                     target.object_store.add_thin_pack(f.read, None)
        829│                 f.close()
        830│

   2  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/object_store.py:856 in add_thin_pack
        854│         import tempfile
        855│
     →  856│         fd, path = tempfile.mkstemp(dir=self.path, prefix="tmp_pack_")
        857│         with os.fdopen(fd, "w+b") as f:
        858│             os.chmod(path, PACK_MODE)

   1  ~/.pyenv/versions/3.7.3/lib/python3.7/tempfile.py:340 in mkstemp
       338│         flags = _bin_openflags
       339│
     → 340│     return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
       341│
       342│

  FileNotFoundError

  [Errno 2] No such file or directory: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src/pdfminer.six.public/.git/objects/tmp_pack_bfjbllhk'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/tempfile.py:258 in _mkstemp_inner
      254│     for seq in range(TMP_MAX):
      255│         name = next(names)
      256│         file = _os.path.join(dir, pre + name + suf)
      257│         try:
    → 258│             fd = _os.open(file, flags, 0o600)
      259│         except FileExistsError:
      260│             continue    # try again
      261│         except PermissionError:
      262│             # This exception is thrown when a directory with the chosen name

  • Installing pysftp (0.2.9): Pending...
  • Installing pysftp (0.2.9): Installing...
  • Installing pysftp (0.2.9)
  • Installing testing-redis (1.1.1): Pending...
  • Installing testing-redis (1.1.1): Installing...
  • Installing testing-redis (1.1.1)
  • Installing usaddress (0.5.10): Pending...
  • Installing usaddress (0.5.10): Installing...
  • Installing usaddress (0.5.10)
  • Installing xxhash (3.2.0): Pending...
  • Installing xxhash (3.2.0): Installing...
  • Installing xxhash (3.2.0)
  • Installing zipcodes (1.2.0): Pending...
  • Installing zipcodes (1.2.0): Installing...
  • Installing zipcodes (1.2.0)
```

</details>

2. Failure 2 (Non-recoverable): most poetry command fail with `[Errno 13] Permission denied: 'src'`. Can only be fixed by `sudo rm -rf`ing the venv directory.

<details>
<summary>Logs</summary>

```
❯ poetry install -vvv
Loading configuration file /Users/lennykhazan/Library/Preferences/pypoetry/config.toml
The currently activated Python version 3.7.3 is not supported by the project (3.9.15).
Trying to find and use a compatible version.
Trying python3
Trying python3.9
Using python3.9 (3.9.15)
Creating virtualenv api-server-apps-UDS0uKpv-py3.9 in /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs
Using virtualenv: /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 47 installs, 0 updates, 0 removals

  • Installing pyasn1 (0.4.8): Pending...
  • Installing pyasn1 (0.4.8): Installing...
  • Installing pyasn1 (0.4.8)
  • Installing cachetools (5.2.1): Pending...
  • Installing cachetools (5.2.1): Installing...
  • Installing cachetools (5.2.1)
  • Installing certifi (2022.12.7): Pending...
  • Installing certifi (2022.12.7): Installing...
  • Installing certifi (2022.12.7)
  • Installing chardet (4.0.0): Pending...
  • Installing chardet (4.0.0): Installing...
  • Installing chardet (4.0.0)
  • Installing idna (2.10): Pending...
  • Installing idna (2.10): Installing...
  • Installing idna (2.10)
  • Installing protobuf (3.20.3): Pending...
  • Installing protobuf (3.20.3): Installing...
  • Installing protobuf (3.20.3)
  • Installing pyasn1-modules (0.2.8): Pending...
  • Installing pyasn1-modules (0.2.8): Installing...
  • Installing pyasn1-modules (0.2.8)
  • Installing pycparser (2.21): Pending...
  • Installing pycparser (2.21): Installing...
  • Installing pycparser (2.21)
  • Installing rsa (4.9): Pending...
  • Installing rsa (4.9): Installing...
  • Installing rsa (4.9)
  • Installing six (1.16.0): Pending...
  • Installing six (1.16.0): Installing...
  • Installing six (1.16.0)
  • Installing urllib3 (1.26.13): Pending...
  • Installing urllib3 (1.26.13): Installing...
  • Installing urllib3 (1.26.13)
  • Installing cffi (1.15.1): Pending...
  • Installing cffi (1.15.1): Installing...
  • Installing cffi (1.15.1)
  • Installing google-auth (2.15.0): Pending...
  • Installing google-auth (2.15.0): Installing...
  • Installing google-auth (2.15.0)
  • Installing googleapis-common-protos (1.58.0): Pending...
  • Installing googleapis-common-protos (1.58.0): Installing...
  • Installing googleapis-common-protos (1.58.0)
  • Installing requests (2.25.1): Pending...
  • Installing requests (2.25.1): Installing...
  • Installing requests (2.25.1)
  • Installing async-timeout (4.0.2): Pending...
  • Installing async-timeout (4.0.2): Installing...
  • Installing async-timeout (4.0.2)
  • Installing bcrypt (4.0.1): Pending...
  • Installing bcrypt (4.0.1): Installing...
  • Installing bcrypt (4.0.1)
  • Installing cryptography (39.0.0): Pending...
  • Installing cryptography (39.0.0): Installing...
  • Installing cryptography (39.0.0)
  • Installing google-api-core (1.34.0): Pending...
  • Installing google-api-core (1.34.0): Installing...
  • Installing google-api-core (1.34.0)
  • Installing opencensus-context (0.2.dev0): Pending...
  • Installing opencensus-context (0.2.dev0): Installing...
  • Installing opencensus-context (0.2.dev0)
  • Installing pynacl (1.5.0): Pending...
  • Installing pynacl (1.5.0): Installing...
  • Installing pynacl (1.5.0)
  • Installing charset-normalizer (3.0.1): Pending...
  • Installing charset-normalizer (3.0.1): Installing...
  • Installing charset-normalizer (3.0.1)
  • Installing future (0.18.2): Pending...
  • Installing future (0.18.2): Installing...
  • Installing future (0.18.2)
  • Installing mypy-extensions (0.4.3): Pending...
  • Installing mypy-extensions (0.4.3): Installing...
  • Installing mypy-extensions (0.4.3)
  • Installing numpy (1.24.1): Pending...
  • Installing numpy (1.24.1): Installing...
  • Installing numpy (1.24.1)
  • Installing opencensus (0.8.dev0 ec72cd3): Pending...
  • Installing opencensus (0.8.dev0 ec72cd3): Cloning...
  • Installing opencensus (0.8.dev0 ec72cd3): Building...
  • Installing opencensus (0.8.dev0 ec72cd3)
  • Installing paramiko (2.12.0): Pending...
  • Installing paramiko (2.12.0): Installing...
  • Installing paramiko (2.12.0)
  • Installing probableparsing (0.0.1): Pending...
  • Installing probableparsing (0.0.1): Installing...
  • Installing probableparsing (0.0.1)
  • Installing prometheus-client (0.15.0): Pending...
  • Installing prometheus-client (0.15.0): Installing...
  • Installing prometheus-client (0.15.0)
  • Installing python-crfsuite (0.9.8): Pending...
  • Installing python-crfsuite (0.9.8): Installing...
  • Installing python-crfsuite (0.9.8)
  • Installing python-dateutil (2.8.2): Pending...
  • Installing python-dateutil (2.8.2): Installing...
  • Installing python-dateutil (2.8.2)
  • Installing pytz (2022.7): Pending...
  • Installing pytz (2022.7): Installing...
  • Installing pytz (2022.7)
  • Installing redis (4.4.1): Pending...
  • Installing redis (4.4.1): Installing...
  • Installing redis (4.4.1)
  • Installing testing-common-database (2.0.3): Pending...
  • Installing testing-common-database (2.0.3): Installing...
  • Installing testing-common-database (2.0.3)
  • Installing typed-ast (1.4.3): Pending...
  • Installing typed-ast (1.4.3): Installing...
  • Installing typed-ast (1.4.3)
  • Installing typing-extensions (4.4.0): Pending...
  • Installing typing-extensions (4.4.0): Installing...
  • Installing typing-extensions (4.4.0)
  • Installing docstring-parser (0.15): Pending...
  • Installing docstring-parser (0.15): Installing...
  • Installing mock (4.0.3): Pending...
  • Installing mock (4.0.3): Installing...
  • Installing mypy (0.812): Pending...
  • Installing mypy (0.812): Installing...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Failed

  Stack trace:

  1  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:403 in clone
      401│                 # check if the current local copy matches the requested ref spec
      402│                 try:
    → 403│                     current_repo = Repo(str(target))
      404│
      405│                     with current_repo:

  NotGitRepository

  No git repository was found at /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/repo.py:1127 in __init__
      1123│                     and os.path.isdir(os.path.join(root, REFSDIR))):
      1124│                 bare = True
      1125│             else:
      1126│                 raise NotGitRepository(
    → 1127│                     "No git repository was found at %(path)s" % dict(path=root)
      1128│                 )
      1129│
      1130│         self.bare = bare
      1131│         if bare is False:

The following error occurred when trying to handle this error:


  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:493 in rmtree
       489│         try:
       490│             if os.path.samestat(orig_st, os.fstat(fd)):
       491│                 _rmtree_safe_fd(fd, path, onerror)
       492│                 try:
    →  493│                     os.rmdir(path)
       494│                 except OSError:
       495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

The following error occurred when trying to handle this error:


  Stack trace:

  8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
      261│
      262│             try:
    → 263│                 result = self._do_execute_operation(operation)
      264│             except EnvCommandError as e:
      265│                 if e.e.returncode == -2:

  7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
      332│             return 0
      333│
    → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
      335│
      336│         if result != 0:

  6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
      452│
      453│     def _execute_install(self, operation: Install | Update) -> int:
    → 454│         status_code = self._install(operation)
      455│
      456│         self._save_url_reference(operation)

  5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
      478│
      479│         if package.source_type == "git":
    → 480│             return self._install_git(operation)
      481│
      482│         if package.source_type == "file":
  • Installing docstring-parser (0.15)
  • Installing mock (4.0.3): Pending...
  • Installing mock (4.0.3): Installing...
  • Installing mypy (0.812): Pending...
  • Installing mypy (0.812): Installing...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Failed

  Stack trace:

  1  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:403 in clone
      401│                 # check if the current local copy matches the requested ref spec
      402│                 try:
    → 403│                     current_repo = Repo(str(target))
      404│
      405│                     with current_repo:

  NotGitRepository

  No git repository was found at /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/repo.py:1127 in __init__
      1123│                     and os.path.isdir(os.path.join(root, REFSDIR))):
      1124│                 bare = True
      1125│             else:
      1126│                 raise NotGitRepository(
    → 1127│                     "No git repository was found at %(path)s" % dict(path=root)
      1128│                 )
      1129│
      1130│         self.bare = bare
      1131│         if bare is False:

The following error occurred when trying to handle this error:


  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:493 in rmtree
       489│         try:
       490│             if os.path.samestat(orig_st, os.fstat(fd)):
       491│                 _rmtree_safe_fd(fd, path, onerror)
       492│                 try:
    →  493│                     os.rmdir(path)
       494│                 except OSError:
       495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

The following error occurred when trying to handle this error:


  Stack trace:

  8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
      261│
      262│             try:
    → 263│                 result = self._do_execute_operation(operation)
      264│             except EnvCommandError as e:
      265│                 if e.e.returncode == -2:

  7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
      332│             return 0
      333│
    → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
      335│
      336│         if result != 0:

  6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
      452│
      453│     def _execute_install(self, operation: Install | Update) -> int:
    → 454│         status_code = self._install(operation)
      455│
      456│         self._save_url_reference(operation)

  5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
      478│
      479│         if package.source_type == "git":
    → 480│             return self._install_git(operation)
      481│
      482│         if package.source_type == "file":

  • Installing mock (4.0.3)
  • Installing mypy (0.812): Pending...
  • Installing mypy (0.812): Installing...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Failed

  Stack trace:

  1  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:403 in clone
      401│                 # check if the current local copy matches the requested ref spec
      402│                 try:
    → 403│                     current_repo = Repo(str(target))
      404│
      405│                     with current_repo:

  NotGitRepository

  No git repository was found at /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/repo.py:1127 in __init__
      1123│                     and os.path.isdir(os.path.join(root, REFSDIR))):
      1124│                 bare = True
      1125│             else:
      1126│                 raise NotGitRepository(
    → 1127│                     "No git repository was found at %(path)s" % dict(path=root)
      1128│                 )
      1129│
      1130│         self.bare = bare
      1131│         if bare is False:

The following error occurred when trying to handle this error:


  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:493 in rmtree
       489│         try:
       490│             if os.path.samestat(orig_st, os.fstat(fd)):
       491│                 _rmtree_safe_fd(fd, path, onerror)
       492│                 try:
    →  493│                     os.rmdir(path)
       494│                 except OSError:
       495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

The following error occurred when trying to handle this error:


  Stack trace:

  8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
      261│
      262│             try:
    → 263│                 result = self._do_execute_operation(operation)
      264│             except EnvCommandError as e:
      265│                 if e.e.returncode == -2:

  7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
      332│             return 0
      333│
    → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
      335│
      336│         if result != 0:

  6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
      452│
      453│     def _execute_install(self, operation: Install | Update) -> int:
    → 454│         status_code = self._install(operation)
      455│
      456│         self._save_url_reference(operation)

  5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
      478│
      479│         if package.source_type == "git":
    → 480│             return self._install_git(operation)
      481│
      482│         if package.source_type == "file":

  4  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
      610│             url=package.source_url,
      611│             source_root=self._env.path / "src",
    → 612│             revision=package.source_resolved_reference or package.source_reference,
      613│         )
      614│

  3  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:409 in clone
      407│                 except (NotGitRepository, AssertionError, KeyError):
      408│                     # something is wrong with the current checkout, clean it
    → 409│                     remove_directory(target, force=True)
      410│                 else:
      411│                     if not is_revision_sha(revision=current_sha):

  2  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/utils/helpers.py:81 in remove_directory
       79│
       80│     kwargs["onerror"] = kwargs.pop("onerror", _on_rm_error if force else None)
    →  81│     shutil.rmtree(path, *args, **kwargs)
       82│
       83│

  1  ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:495 in rmtree
       493│                     os.rmdir(path)
       494│                 except OSError:
    →  495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/utils/helpers.py:64 in _on_rm_error
       60│     if not os.path.exists(path):
       61│         return
       62│
       63│     os.chmod(path, stat.S_IWRITE)
    →  64│     func(path)
       65│
       66│
       67│ def remove_directory(
       68│     path: Path | str, *args: Any, force: bool = False, **kwargs: Any

  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
  • Installing mypy (0.812)
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Pending...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Cloning...
  • Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3): Failed

  Stack trace:

  1  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:403 in clone
      401│                 # check if the current local copy matches the requested ref spec
      402│                 try:
    → 403│                     current_repo = Repo(str(target))
      404│
      405│                     with current_repo:

  NotGitRepository

  No git repository was found at /Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/repo.py:1127 in __init__
      1123│                     and os.path.isdir(os.path.join(root, REFSDIR))):
      1124│                 bare = True
      1125│             else:
      1126│                 raise NotGitRepository(
    → 1127│                     "No git repository was found at %(path)s" % dict(path=root)
      1128│                 )
      1129│
      1130│         self.bare = bare
      1131│         if bare is False:

The following error occurred when trying to handle this error:


  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:493 in rmtree
       489│         try:
       490│             if os.path.samestat(orig_st, os.fstat(fd)):
       491│                 _rmtree_safe_fd(fd, path, onerror)
       492│                 try:
    →  493│                     os.rmdir(path)
       494│                 except OSError:
       495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

The following error occurred when trying to handle this error:


  Stack trace:

  8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
      261│
      262│             try:
    → 263│                 result = self._do_execute_operation(operation)
      264│             except EnvCommandError as e:
      265│                 if e.e.returncode == -2:

  7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
      332│             return 0
      333│
    → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
      335│
      336│         if result != 0:

  6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
      452│
      453│     def _execute_install(self, operation: Install | Update) -> int:
    → 454│         status_code = self._install(operation)
      455│
      456│         self._save_url_reference(operation)

  5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
      478│
      479│         if package.source_type == "git":
    → 480│             return self._install_git(operation)
      481│
      482│         if package.source_type == "file":

  4  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
      610│             url=package.source_url,
      611│             source_root=self._env.path / "src",
    → 612│             revision=package.source_resolved_reference or package.source_reference,
      613│         )
      614│

  3  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:409 in clone
      407│                 except (NotGitRepository, AssertionError, KeyError):
      408│                     # something is wrong with the current checkout, clean it
    → 409│                     remove_directory(target, force=True)
      410│                 else:
      411│                     if not is_revision_sha(revision=current_sha):

  2  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/utils/helpers.py:81 in remove_directory
       79│
       80│     kwargs["onerror"] = kwargs.pop("onerror", _on_rm_error if force else None)
    →  81│     shutil.rmtree(path, *args, **kwargs)
       82│
       83│

  1  ~/.pyenv/versions/3.7.3/lib/python3.7/shutil.py:495 in rmtree
       493│                     os.rmdir(path)
       494│                 except OSError:
    →  495│                     onerror(os.rmdir, path, sys.exc_info())
       496│             else:
       497│                 try:

  OSError

  [Errno 66] Directory not empty: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src'

  at ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/utils/helpers.py:64 in _on_rm_error
       60│     if not os.path.exists(path):
       61│         return
       62│
       63│     os.chmod(path, stat.S_IWRITE)
    →  64│     func(path)
       65│
       66│
       67│ def remove_directory(
       68│     path: Path | str, *args: Any, force: bool = False, **kwargs: Any

  • Installing pandas (1.1.5): Pending...
  • Installing pandas (1.1.5): Installing...
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
       205│             )
  • Installing pandas (1.1.5)
  • Installing pdfminer-six (20221210 47baa0d): Pending...
  • Installing pdfminer-six (20221210 47baa0d): Cloning...
  • Installing pdfminer-six (20221210 47baa0d): Failed

  Stack trace:

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:263 in _execute_operation
       261│
       262│             try:
     → 263│                 result = self._do_execute_operation(operation)
       264│             except EnvCommandError as e:
       265│                 if e.e.returncode == -2:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:334 in _do_execute_operation
       332│             return 0
       333│
     → 334│         result: int = getattr(self, f"_execute_{method}")(operation)
       335│
       336│         if result != 0:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:454 in _execute_install
       452│
       453│     def _execute_install(self, operation: Install | Update) -> int:
     → 454│         status_code = self._install(operation)
       455│
       456│         self._save_url_reference(operation)

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:480 in _install
       478│
       479│         if package.source_type == "git":
     → 480│             return self._install_git(operation)
       481│
       482│         if package.source_type == "file":

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/installation/executor.py:612 in _install_git
       610│             url=package.source_url,
       611│             source_root=self._env.path / "src",
     → 612│             revision=package.source_resolved_reference or package.source_reference,
       613│         )
       614│

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:424 in clone
       422│         try:
       423│             if not cls.is_using_legacy_client():
     → 424│                 local = cls._clone(url=url, refspec=refspec, target=target)
       425│                 cls._clone_submodules(repo=local)
       426│                 return local

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:256 in _clone
       254│             local = Repo(str(target))
       255│
     → 256│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       257│
       258│         logger.debug(

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/poetry/vcs/git/backend.py:204 in _fetch_remote_refs
       202│                 path,
       203│                 local,
     → 204│                 determine_wants=local.object_store.determine_wants_all,
       205│             )
       206│             return result

   4  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/client.py:849 in fetch
        847│             raise
        848│         else:
     →  849│             commit()
        850│         target.update_shallow(result.new_shallow, result.new_unshallow)
        851│         return result

   3  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/client.py:828 in commit
        826│                 if f.tell():
        827│                     f.seek(0)
     →  828│                     target.object_store.add_thin_pack(f.read, None)
        829│                 f.close()
        830│

   2  ~/Library/Application Support/pypoetry/venv/lib/python3.7/site-packages/dulwich/object_store.py:856 in add_thin_pack
        854│         import tempfile
        855│
     →  856│         fd, path = tempfile.mkstemp(dir=self.path, prefix="tmp_pack_")
        857│         with os.fdopen(fd, "w+b") as f:
        858│             os.chmod(path, PACK_MODE)

   1  ~/.pyenv/versions/3.7.3/lib/python3.7/tempfile.py:340 in mkstemp
       338│         flags = _bin_openflags
       339│
     → 340│     return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
       341│
       342│

  PermissionError

  [Errno 13] Permission denied: '/Users/lennykhazan/Library/Caches/pypoetry/virtualenvs/api-server-apps-UDS0uKpv-py3.9/src/pdfminer.six.public/.git/objects/tmp_pack_pki1moyi'

  at ~/.pyenv/versions/3.7.3/lib/python3.7/tempfile.py:258 in _mkstemp_inner
      254│     for seq in range(TMP_MAX):
      255│         name = next(names)
      256│         file = _os.path.join(dir, pre + name + suf)
      257│         try:
    → 258│             fd = _os.open(file, flags, 0o600)
      259│         except FileExistsError:
      260│             continue    # try again
      261│         except PermissionError:
      262│             # This exception is thrown when a directory with the chosen name

  • Installing pysftp (0.2.9): Pending...
  • Installing pysftp (0.2.9): Installing...
  • Installing pysftp (0.2.9)
  • Installing testing-redis (1.1.1): Pending...
  • Installing testing-redis (1.1.1): Installing...
  • Installing testing-redis (1.1.1)
  • Installing usaddress (0.5.10): Pending...
  • Installing usaddress (0.5.10): Installing...
  • Installing usaddress (0.5.10)
  • Installing xxhash (3.2.0): Pending...
  • Installing xxhash (3.2.0): Installing...
  • Installing xxhash (3.2.0)
  • Installing zipcodes (1.2.0): Pending...
  • Installing zipcodes (1.2.0): Installing...
  • Installing zipcodes (1.2.0)
  ```
  </details>

This may be related to #7113, but we aren't installing any deps with `develop = true`, so I'm filing this separately.


Discussion:
the trailing slash is again likely to cause damage here, as in #7327
copying this [comment from the other issue](https://github.com/python-poetry/poetry/issues/7327#issuecomment-1376224614) - I don't expect to do anything with this myself; but if anyone does care to take a look at it they might as well have this

> Ah, it's the trailing slash on git = "https://github.com/instabase/opencensus-python/" - that causes poetry's Git.cls.get_name_from_source_url to get the wrong answer, from which the rest follows.
Unable to reproduce this issue with latest Poetry version. Closing for now. If issue still exists, please comment with additional information.

See logs below for successful install.

```sh
podman run --rm -i --entrypoint bash python:3.12 <<EOF
set -xe
python -m pip install --disable-pip-version-check -q poetry
install -d foobar
pushd foobar
cat > pyproject.toml <<TOML
[tool.poetry]
name = "api-server-apps"
version = "0.1.0"
description = ""
authors = []
readme = "README.md"
packages = []

[tool.poetry.dependencies]
python = "^3.12"
opencensus = {git = "https://github.com/instabase/opencensus-python", rev = "ec72cd39b431ec28ebcf72861852bccaef00c961"}
opencensus-ext-prometheus = {git = "https://github.com/instabase/opencensus-python/", rev = "ec72cd39b431ec28ebcf72861852bccaef00c961", subdirectory = "contrib/opencensus-ext-prometheus"}
"pdfminer.six" = {git = "https://github.com/instabase/pdfminer.six.public", rev = "47baa0dda534f8389a67c9c984c23b52bf4614e0"}


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
TOML
poetry install
EOF
```

<details>
<summary><b>console.log</b></summary>
<p>

```console
+ python -m pip install --disable-pip-version-check -q poetry
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ install -d foobar
+ pushd foobar
/foobar /
+ cat
+ poetry install
Creating virtualenv api-server-apps-lWDpn5M1-py3.12 in /root/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...

Package operations: 21 installs, 0 updates, 0 removals

  - Installing pyasn1 (0.5.1)
  - Installing cachetools (5.3.3)
  - Installing certifi (2024.2.2)
  - Installing charset-normalizer (3.3.2)
  - Installing idna (3.6)
  - Installing protobuf (3.20.3)
  - Installing pyasn1-modules (0.3.0)
  - Installing rsa (4.9)
  - Installing urllib3 (2.2.1)
  - Installing google-auth (2.29.0)
  - Installing googleapis-common-protos (1.63.0)
  - Installing pycparser (2.21)
  - Installing requests (2.31.0)
  - Installing cffi (1.16.0)
  - Installing google-api-core (1.34.1)
  - Installing opencensus-context (0.2.dev0)
  - Installing cryptography (42.0.5)
  - Installing opencensus (0.8.dev0 ec72cd3)
  - Installing prometheus-client (0.20.0)
Installing /root/.cache/pypoetry/virtualenvs/api-server-apps-lWDpn5M1-py3.12/lib/python3.12/site-packages/opencensus/__init__.py over existing file
Installing /root/.cache/pypoetry/virtualenvs/api-server-apps-lWDpn5M1-py3.12/lib/python3.12/site-packages/opencensus/common/__init__.py over existing file
  - Installing opencensus-ext-prometheus (0.3.dev0 ec72cd3)
  - Installing pdfminer-six (20221210 47baa0d)
Installing /root/.cache/pypoetry/virtualenvs/api-server-apps-lWDpn5M1-py3.12/lib/python3.12/site-packages/opencensus/__init__.py over existing file

Writing lock file

Installing the current project: api-server-apps (0.1.0)

Warning: The current project could not be installed: [Errno 2] No such file or directory: '/foobar/README.md'
If you do not want to install the current project use --no-root.
If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file.
In a future version of Poetry this warning will become an error!
```

</p>
</details>
the symptoms might have changed but `get_name_from_source_url()` is still broken for references that end in trailing slashes:
```
>>> from poetry.vcs.git.backend import Git
>>> Git.get_name_from_source_url("https://github.com/instabase/opencensus-python/")
''
```

eg after `poetry lock` on that `pyproject.toml` the git repository is wrongly cloned at the top-level `~/.virtualenvs/foo/src` and not as it should be at `~/.virtualenvs/foo/src/opencensus-python`.  (Though in this very particular case both are there, because of the second git dependency pointing at the same repo without the trailing slash)

probably wants re-opening, anyway something should track this

Resolving patch:
diff --git a/src/poetry/vcs/git/backend.py b/src/poetry/vcs/git/backend.py
--- a/src/poetry/vcs/git/backend.py
+++ b/src/poetry/vcs/git/backend.py
@@ -182,7 +182,7 @@ def info(cls, repo: Repo | Path) -> GitRepoLocalInfo:
 
     @staticmethod
     def get_name_from_source_url(url: str) -> str:
-        return re.sub(r"(.git)?$", "", url.rsplit("/", 1)[-1])
+        return re.sub(r"(.git)?$", "", url.rstrip("/").rsplit("/", 1)[-1])
 
     @classmethod
     def _fetch_remote_refs(cls, url: str, local: Repo) -> FetchPackResult:


Test patch:
diff --git a/tests/vcs/git/test_backend.py b/tests/vcs/git/test_backend.py
--- a/tests/vcs/git/test_backend.py
+++ b/tests/vcs/git/test_backend.py
@@ -1,5 +1,8 @@
 from __future__ import annotations
 
+import pytest
+
+from poetry.vcs.git.backend import Git
 from poetry.vcs.git.backend import is_revision_sha
 
 
@@ -24,3 +27,17 @@ def test_invalid_revision_sha_min_len() -> None:
 def test_invalid_revision_sha_max_len() -> None:
     result = is_revision_sha(VALID_SHA + "42")
     assert result is False
+
+
+@pytest.mark.parametrize(
+    ("url"),
+    [
+        "git@github.com:python-poetry/poetry.git",
+        "https://github.com/python-poetry/poetry.git",
+        "https://github.com/python-poetry/poetry",
+        "https://github.com/python-poetry/poetry/",
+    ],
+)
+def test_get_name_from_source_url(url: str) -> None:
+    name = Git.get_name_from_source_url(url)
+    assert name == "poetry"