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

Private repo install fails with "[TypeError] quote_from_bytes() expected bytes" #1768

Closed
3 tasks done
daniellehanks opened this issue Dec 18, 2019 · 9 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@daniellehanks
Copy link

  • 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

When running poetry install where I have a private repo, it usually fails (but sometimes works, can't seem to figure out why) with [TypeError] quote_from_bytes() expected bytes.

Using Python 3.7. Performing this inside a Docker container on CircleCI if that matters.

Example values below where values match what they should in pyproject.toml, but may be changed from the actual values we use. I have also tried this by setting POETRY_HTTP_BASIC_FOO_USERNAME and POETRY_HTTP_BASIC_FOO_PASSWORD as environment variables instead of with the config option with the same result.

PYPI_REPOSITORY=foo
PYPI_URL=https://pypicloud.redacted.com/simple/
PYPI_USERNAME=username
PYPI_PASSWORD=my_password
poetry config repositories."$PYPI_REPOSITORY" "$PYPI_URL" && poetry config http-basic."$PYPI_REPOSITORY" "$PYPI_USERNAME" "$PYPI_PASSWORD" && poetry install -vvv
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file


Package operations: 49 installs, 4 updates, 0 removals, 24 skipped

  - Skipping more-itertools (8.0.2) Already installed
  - Skipping idna (2.8) Already installed
  - Installing multidict (4.7.1)
  - Installing pyasn1 (0.4.8)
  - Skipping six (1.13.0) Already installed
  - Skipping zipp (0.6.0) Already installed
  - Installing async-timeout (3.0.1)
  - Skipping attrs (19.3.0) Already installed
  - Skipping certifi (2019.11.28) Already installed
  - Skipping chardet (3.0.4) Already installed
  - Installing ecdsa (0.14.1)
  - Updating importlib-metadata (0.23 -> 1.3.0)
  - Installing markupsafe (1.1.1)
  - Skipping pyparsing (2.4.5) Already installed
  - Installing rsa (4.0)
  - Skipping urllib3 (1.25.7) Already installed
  - Installing yarl (1.4.2)
  - Installing aiocontextvars (0.2.2)
  - Installing aiohttp (3.4.4)
  - Installing asyncpg (0.20.0)
  - Skipping atomicwrites (1.3.0) Not needed for the current environment
  - Installing cachetools (3.1.1)
  - Skipping click (7.0) Already installed
  - Skipping colorama (0.4.3) Not needed for the current environment
  - Installing decorator (4.4.1)
  - Installing jinja2 (2.10.3)
  - Installing msgpack-python (0.5.6)
  - Skipping packaging (19.2) Already installed
  - Skipping pluggy (0.13.1) Already installed
  - Skipping py (1.8.0) Already installed
  - Installing pyasn1-modules (0.2.7)
  - Installing pycryptodome (3.9.4)
  - Installing python-jose (3.1.0)
  - Installing pyyaml (3.13)
  - Skipping requests (2.22.0) Already installed
  - Installing sqlalchemy (1.3.12)
  - Skipping wcwidth (0.1.7) Already installed
  - Skipping wrapt (1.11.2) Already installed
  - Installing aiofiles (0.4.0)
  - Installing apistar (0.6.0)
  - Skipping appdirs (1.4.3) Already installed
  - Installing aspy.yaml (1.3.0)
  - Installing cfgv (2.0.1)
  - Installing datadog (0.26.0)
  - Installing ddtrace (0.17.1)
  - Installing gino (0.8.5)
  - Installing google-auth (1.10.0)
  - Installing h11 (0.9.0)
  - Installing httptools (0.0.13)
  - Installing identify (1.4.8)
  - Installing mako (1.1.0)
  - Installing nodeenv (1.3.3)
  - Skipping pathspec (0.6.0) Already installed
  - Updating pytest (5.3.1 -> 5.3.2)
  - Installing python-dateutil (2.8.1)
  - Installing python-editor (1.0.4)
  - Installing python-keycloak-client (0.2.1)
  - Installing python-rapidjson (0.6.3)
  - Updating regex (2019.12.9 -> 2019.12.19)
  - Installing starlette (0.9.10)
  - Skipping toml (0.10.0) Already installed
  - Skipping typed-ast (1.4.0) Already installed
  - Installing uvloop (0.11.3)
  - Installing virtualenv (16.7.9)
  - Installing websockets (8.1)
  - Installing aiomock (0.1.0)
  - Installing aioresponses (0.6.1)
  - Installing alembic (1.3.2)
  - Skipping black (19.10b0) Already installed
  - Updating coverage (4.5.4 -> 5.0)
  - Installing dumb-init (1.2.2)
  - Skipping isort (4.3.21) Already installed
  - Installing p***** (0.3.8)

[TypeError]
quote_from_bytes() expected bytes

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/usr/local/lib/python3.7/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/usr/local/lib/python3.7/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/usr/local/lib/python3.7/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/usr/local/lib/python3.7/site-packages/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/usr/local/lib/python3.7/site-packages/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/usr/local/lib/python3.7/site-packages/poetry/installation/installer.py", line 286, in _do_install
    self._execute(op)
  File "/usr/local/lib/python3.7/site-packages/poetry/installation/installer.py", line 302, in _execute
    getattr(self, '_execute_{}'.format(method))(operation)
  File "/usr/local/lib/python3.7/site-packages/poetry/installation/installer.py", line 327, in _execute_install
    self._installer.install(operation.package)
  File "/usr/local/lib/python3.7/site-packages/poetry/installation/pip_installer.py", line 63, in install
    index_url = repository.authenticated_url
  File "/usr/local/lib/python3.7/site-packages/poetry/repositories/legacy_repository.py", line 224, in authenticated_url
    password=quote(self._auth.auth.password),
  File "/usr/local/lib/python3.7/urllib/parse.py", line 834, in quote
    return quote_from_bytes(string, safe)
  File "/usr/local/lib/python3.7/urllib/parse.py", line 859, in quote_from_bytes
    raise TypeError('quote_from_bytes() expected bytes')


Exited with code exit status 1
@daniellehanks daniellehanks added the kind/bug Something isn't working as expected label Dec 18, 2019
@dephiros
Copy link

Ran into the same issues. Also sometimes work and sometimes error

@z0mbix
Copy link

z0mbix commented Dec 20, 2019

I'm having exactly the same issue too (Poetry version 1.0.0)

@oliver-charlesworth
Copy link

Likely related to #1600 .

@eliasmistler
Copy link

Having the same issue. Interestingly, the installation works fine locally (MacOS), but fails on our CI (inside an amazonlinux docker image)

@eliasmistler
Copy link

Likely related to #1600 .

Indeed, this answer fixed my issue.

@eliasmistler
Copy link

The fix to #1600 has fixed the issue for me (as of 1.0.2) -- I think we can close this.

@lxsameer
Copy link

Same issue on poetry 1.0.5

@andrmueller
Copy link

andrmueller commented Jun 23, 2020

Same issue on poetry 1.0.9
EDIT: I just recognized this error occurrs when ommitting POETRY_HTTP_BASIC_XXX_USERNAME but POETRY_HTTP_BASIC_XXX_PASSWORD has been set.

Copy link

github-actions bot commented Mar 3, 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 3, 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
Projects
None yet
Development

No branches or pull requests

8 participants