Poetry: 1.1.4 regression custom repository does not work properly anymore.

Created on 27 Oct 2020  ยท  3Comments  ยท  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

We have a private custom PyPI repository set up using pywhaf.
The pywharf has a feature that it can redirect to an external index if a package is not found.
With latest version of poetry[1.1.4], this redirection seems not to work anymore.
Our primary PyPI is hosted at an internal url https://internal_url/simple
pip install works without any problem.

pip install --index-url https://internal_url/simple/ pandas

However, poetry fails to add the package. The log with -vvv:

Using virtualenv: /home/wqiu/.cache/pypoetry/virtualenvs/poetry-debug-ca-G0owh-py3.7
daozhi: 68 packages found for pandas *
PyPI: 68 packages found for pandas *
Using version ^1.1.3 for pandas

Updating dependencies
Resolving dependencies...
   1: fact: poetry-debug is 0.1.0
   1: derived: poetry-debug
   1: fact: poetry-debug depends on dzapi (^0.2.0)
   1: fact: poetry-debug depends on pandas (^1.1.3)
   1: fact: poetry-debug depends on pytest (^5.2)
   1: fact: poetry-debug depends on pytest (^5.2)
   1: selecting poetry-debug (0.1.0)
   1: derived: pytest (^5.2)
   1: derived: pandas (^1.1.3)
   1: derived: dzapi (^0.2.0)
daozhi: Downloading wheel: pytest-5.4.3-py3-none-any.whl
   1: Version solving took 0.321 seconds.
   1: Tried 1 solutions.

  Stack trace:

  25  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/clikit/console_application.py:131 in run
       129โ”‚             parsed_args = resolved_command.args
       130โ”‚
     โ†’ 131โ”‚             status_code = command.handle(parsed_args, io)
       132โ”‚         except KeyboardInterrupt:
       133โ”‚             status_code = 1

  24  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/clikit/api/command/command.py:120 in handle
       118โ”‚     def handle(self, args, io):  # type: (Args, IO) -> int
       119โ”‚         try:
     โ†’ 120โ”‚             status_code = self._do_handle(args, io)
       121โ”‚         except KeyboardInterrupt:
       122โ”‚             if io.is_debug():

  23  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/clikit/api/command/command.py:171 in _do_handle
       169โ”‚         handler_method = self._config.handler_method
       170โ”‚
     โ†’ 171โ”‚         return getattr(handler, handler_method)(args, io, self)
       172โ”‚
       173โ”‚     def __repr__(self):  # type: () -> str

  22  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/cleo/commands/command.py:92 in wrap_handle
        90โ”‚         self._command = command
        91โ”‚
     โ†’  92โ”‚         return self.handle()
        93โ”‚
        94โ”‚     def handle(self):  # type: () -> Optional[int]

  21  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/console/commands/add.py:174 in handle
       172โ”‚
       173โ”‚         try:
     โ†’ 174โ”‚             status = self._installer.run()
       175โ”‚         except Exception:
       176โ”‚             self.poetry.file.write(original_content)

  20  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/installation/installer.py:103 in run
       101โ”‚         local_repo = Repository()
       102โ”‚
     โ†’ 103โ”‚         return self._do_install(local_repo)
       104โ”‚
       105โ”‚     def dry_run(self, dry_run=True):  # type: (bool) -> Installer

  19  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/installation/installer.py:235 in _do_install
       233โ”‚             )
       234โ”‚
     โ†’ 235โ”‚             ops = solver.solve(use_latest=self._whitelist)
       236โ”‚         else:
       237โ”‚             self._io.write_line("Installing dependencies from lock file")

  18  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/puzzle/solver.py:65 in solve
        63โ”‚         with self._provider.progress():
        64โ”‚             start = time.time()
     โ†’  65โ”‚             packages, depths = self._solve(use_latest=use_latest)
        66โ”‚             end = time.time()
        67โ”‚

  17  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/puzzle/solver.py:234 in _solve
       232โ”‚         try:
       233โ”‚             result = resolve_version(
     โ†’ 234โ”‚                 self._package, self._provider, locked=locked, use_latest=use_latest
       235โ”‚             )
       236โ”‚

  16  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/mixology/__init__.py:7 in resolve_version
       5โ”‚     solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
       6โ”‚
     โ†’ 7โ”‚     return solver.solve()
       8โ”‚

  15  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/mixology/version_solver.py:84 in solve
        82โ”‚             while next is not None:
        83โ”‚                 self._propagate(next)
     โ†’  84โ”‚                 next = self._choose_package_version()
        85โ”‚
        86โ”‚             return self._result()

  14  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/mixology/version_solver.py:397 in _choose_package_version
       395โ”‚             version = locked
       396โ”‚
     โ†’ 397โ”‚         version = self._provider.complete_package(version)
       398โ”‚
       399โ”‚         conflict = False

  13  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/puzzle/provider.py:437 in complete_package
       435โ”‚                     package.version.text,
       436โ”‚                     extras=list(package.dependency.extras),
     โ†’ 437โ”‚                     repository=package.dependency.source_name,
       438โ”‚                 ),
       439โ”‚             )

  12  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pool.py:135 in package
       133โ”‚             for idx, repo in enumerate(self._repositories):
       134โ”‚                 try:
     โ†’ 135โ”‚                     package = repo.package(name, version, extras=extras)
       136โ”‚                 except PackageNotFound:
       137โ”‚                     continue

  11  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/legacy_repository.py:323 in package
       321โ”‚             return self._packages[index]
       322โ”‚         except ValueError:
     โ†’ 323โ”‚             package = super(LegacyRepository, self).package(name, version, extras)
       324โ”‚             package._source_type = "legacy"
       325โ”‚             package._source_url = self._url

  10  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:158 in package
       156โ”‚         extras=None,  # type: (Union[list, None])
       157โ”‚     ):  # type: (...) -> Package
     โ†’ 158โ”‚         return self.get_release_info(name, version).to_package(name=name, extras=extras)
       159โ”‚
       160โ”‚     def search(self, query):

   9  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:224 in get_release_info
       222โ”‚
       223โ”‚         cached = self._cache.remember_forever(
     โ†’ 224โ”‚             "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
       225โ”‚         )
       226โ”‚

   8  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/cachy/repository.py:174 in remember_forever
       172โ”‚             return val
       173โ”‚
     โ†’ 174โ”‚         val = value(callback)
       175โ”‚
       176โ”‚         self.forever(key, val)

   7  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/cachy/helpers.py:6 in value
       4โ”‚ def value(val):
       5โ”‚     if callable(val):
     โ†’ 6โ”‚         return val()
       7โ”‚
       8โ”‚     return val

   6  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:224 in <lambda>
       222โ”‚
       223โ”‚         cached = self._cache.remember_forever(
     โ†’ 224โ”‚             "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
       225โ”‚         )
       226โ”‚

   5  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/legacy_repository.py:377 in _get_release_info
       375โ”‚         data.files = files
       376โ”‚
     โ†’ 377โ”‚         info = self._get_info_from_urls(urls)
       378โ”‚
       379โ”‚         data.summary = info.summary

   4  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:410 in _get_info_from_urls
       408โ”‚             # Prefer non platform specific wheels
       409โ”‚             if universal_python3_wheel:
     โ†’ 410โ”‚                 return self._get_info_from_wheel(universal_python3_wheel)
       411โ”‚
       412โ”‚             if universal_python2_wheel:

   3  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:431 in _get_info_from_wheel
       429โ”‚         with temporary_directory() as temp_dir:
       430โ”‚             filepath = Path(temp_dir) / filename
     โ†’ 431โ”‚             self._download(url, str(filepath))
       432โ”‚
       433โ”‚             return PackageInfo.from_wheel(filepath)

   2  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/repositories/pypi_repository.py:450 in _download
       448โ”‚
       449โ”‚     def _download(self, url, dest):  # type: (str, str) -> None
     โ†’ 450โ”‚         return download_file(url, dest, session=self.session)
       451โ”‚
       452โ”‚     def _log(self, msg, level="info"):

   1  ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/poetry/utils/helpers.py:99 in download_file
        97โ”‚
        98โ”‚     with get(url, stream=True) as response:
     โ†’  99โ”‚         response.raise_for_status()
       100โ”‚
       101โ”‚         with open(dest, "wb") as f:

  HTTPError

  404 Client Error: Not Found for url: https://internal_url/packages/9f/f3/0a83558da436a081344aa6c8b85ea5b5f05071214106036ce341b7769b0b/pytest-5.4.3-py3-none-any.whl#sha256=5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1

  at ~/.cache/pypoetry/virtualenvs/playground-gu9jURa0-py3.7/lib/python3.7/site-packages/requests/models.py:941 in raise_for_status
      937โ”‚         elif 500 <= self.status_code < 600:
      938โ”‚             http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
      939โ”‚
      940โ”‚         if http_error_msg:
    โ†’ 941โ”‚             raise HTTPError(http_error_msg, response=self)
      942โ”‚
      943โ”‚     def close(self):
      944โ”‚
      945โ”‚         called the underlying ``raw`` object must not be accessed again.
Bug Repository Triage

Most helpful comment

All 3 comments

It appears so. The description and output matches exactly the issue I saw when I created #3198.

@qiuwei Did you get a chance to try the fix proposed in https://github.com/python-poetry/poetry/pull/3198 ?

Was this page helpful?
0 / 5 - 0 ratings