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

HTTP 400 when adding package hosted in a private PyPi #3597

Closed
3 tasks done
HugoManoMano opened this issue Jan 21, 2021 · 4 comments
Closed
3 tasks done

HTTP 400 when adding package hosted in a private PyPi #3597

HugoManoMano opened this issue Jan 21, 2021 · 4 comments
Labels
kind/bug Something isn't working as expected status/needs-reproduction Issue needs a minimal reproduction to be confirmed

Comments

@HugoManoMano
Copy link

HugoManoMano commented Jan 21, 2021

  • 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).

Issue

Hi folks 👋
I'm trying to add a private Python package as a dependency of my current project, as per specified in the gist above, but it fails with the trace below.

I have also set-up http identification like this:
poetry config http-basic.mypypi USER PASSWORD

Which is valid authentification (everything works fine with pip by adding the same conf in pip.conf file)

N.B. found this issue which seems the exact same one but on a previous poetry version, and which has been closed without being resolved apparently (the manual modification of poetry scripts is not OK for us because we need CI pipeline to run with poetry)

Here is the trace:

 Stack trace:

  25  ~/.poetry/lib/poetry/_vendor/py3.6/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  ~/.poetry/lib/poetry/_vendor/py3.6/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  ~/.poetry/lib/poetry/_vendor/py3.6/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  ~/.poetry/lib/poetry/_vendor/py3.6/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/poetry/_vendor/py3.6/cachy/repository.py:174 in remember_forever
       172│             return val
       173│ 
     → 174│         val = value(callback)
       175│ 
       176│         self.forever(key, val)

   7  ~/.poetry/lib/poetry/_vendor/py3.6/cachy/helpers.py:6 in value
       4│ def value(val):
       5│     if callable(val):
     → 6│         return val()
       7│ 
       8│     return val

   6  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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  ~/.poetry/lib/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

  400 Client Error: Bad Request for url: https://XXXXXX.s3.amazonaws.com/pypi/08ef/mypackage/mypackage-0.4.3-py3-none-any.whl?Expires=1611335583&Signature=XXX&AWSAccessKeyId=XXX&x-amz-security-token=XXX

  at ~/.poetry/lib/poetry/_vendor/py3.6/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.
@HugoManoMano HugoManoMano added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 21, 2021
@tharwan
Copy link

tharwan commented Jan 26, 2021

We ran into the same issue. We reverted back to the old version of poetry by pinning the version in our build chain.

@pkoch
Copy link

pkoch commented Mar 19, 2022

Same issue. On AWS CodeArtifact, even though that doesn't look like it'd make a difference.

@neersighted
Copy link
Member

Closing as I can't reproduce this against AWS on 1.2.x. If you are hitting this, please open an issue and stand up a test instance of your PyPI server if at all possible. If not, pairing with an interested maintainer and introspecting your local copy of Poetry is likely the next best bet, if at all possible.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2022
@neersighted neersighted added status/needs-reproduction Issue needs a minimal reproduction to be confirmed and removed status/triage This issue needs to be triaged labels Oct 4, 2022
Copy link

github-actions bot commented Mar 1, 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 1, 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 status/needs-reproduction Issue needs a minimal reproduction to be confirmed
Projects
None yet
Development

No branches or pull requests

4 participants