python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.11k stars 2.25k forks source link

Not able to publish to private Nexus repo using 'poetry publish -r nexus' #3053

Closed rudolfsberzins closed 3 years ago

rudolfsberzins commented 3 years ago

Issue

My company has a custom Nexus server for distributing internal Python packages. Starting from today the bitbucket-pipelines.yml we use starts to fail when trying to publish a package using poetry.

I have deduced that the error arose from the update to version 1.1.0 because if I downgrade back to 1.0.10 the pipeline completes and can upload package to server.

Command sequence

> poetry build
> poetry config repositories.nexus https://nexus.COMPANYNAME.io/repository/pypi-internal/
> poetry config http-basic.nexus $NEXUS_WRITE_USERNAME $NEXUS_WRITE_PASSWORD
> poetry publish -r nexus

Expected Outcome I can still do this with version 1.0.10

> poetry publish -r nexus
Publishing ma_aws_tools (1.0.1) to nexus
 - Uploading ma_aws_tools-1.0.1-py3-none-any.whl 100%
 - Uploading ma_aws_tools-1.0.1.tar.gz 100%

Actual Outcome

>poetry publish -r nexus
Publishing ma_aws_tools (1.0.1) to nexus
 - Uploading ma_aws_tools-1.0.1-py3-none-any.whl 100%

  UploadError

  HTTP Error 404: Not Found

  at ~/.poetry/lib/poetry/publishing/uploader.py:216 in _upload
      212│                     self._register(session, url)
      213│                 except HTTPError as e:
      214│                     raise UploadError(e)
      215│
    → 216│             raise UploadError(e)
      217│
      218│     def _do_upload(
      219│         self, session, url, dry_run=False
      220│     ):  # type: (requests.Session, str, Optional[bool]) -> None

Full stack trace with '-vvv'

Publishing ma_aws_tools (1.0.1) to nexus
 - Uploading ma_aws_tools-1.0.1-py3-none-any.whl 100%

  Stack trace:

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

  6  ~/.poetry/lib/poetry/_vendor/py3.7/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():

  5  ~/.poetry/lib/poetry/_vendor/py3.7/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

  4  ~/.poetry/lib/poetry/_vendor/py3.7/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]

  3  ~/.poetry/lib/poetry/console/commands/publish.py:83 in handle
      81│             cert,
      82│             client_cert,
    → 83│             self.option("dry-run"),
      84│         )
      85│

  2  ~/.poetry/lib/poetry/publishing/publisher.py:97 in publish
      95│             cert=cert or get_cert(self._poetry.config, repository_name),
      96│             client_cert=resolved_client_cert,
    → 97│             dry_run=dry_run,
      98│         )
      99│

  1  ~/.poetry/lib/poetry/publishing/uploader.py:119 in upload
      117│
      118│         try:
    → 119│             self._upload(session, url, dry_run)
      120│         finally:
      121│             session.close()

  UploadError

  HTTP Error 404: Not Found

  at ~/.poetry/lib/poetry/publishing/uploader.py:216 in _upload
      212│                     self._register(session, url)
      213│                 except HTTPError as e:
      214│                     raise UploadError(e)
      215│
    → 216│             raise UploadError(e)
      217│
      218│     def _do_upload(
      219│         self, session, url, dry_run=False
      220│     ):  # type: (requests.Session, str, Optional[bool]) -> None

Temporary Solution

> poetry self update 1.0.10
> poetry build
> poetry config repositories.nexus https://nexus.COMPANYNAME.io/repository/pypi-internal/
> poetry config http-basic.nexus $NEXUS_WRITE_USERNAME $NEXUS_WRITE_PASSWORD
> poetry publish -r nexus
abn commented 3 years ago

Duplicate of #3052

github-actions[bot] commented 6 months ago

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.