question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:8

github_iconTop GitHub Comments

2reactions
lxsameercommented, Mar 16, 2020

Same issue on poetry 1.0.5

2reactions
dephiroscommented, Dec 19, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Troubelshooting raise TypeError("quote_from_bytes ...
and the error is raise TypeError("quote_from_bytes() expected bytes") TypeError: quote_from_bytes() expected bytes. Help is much appreciated.
Read more >
Key Pair Auth error - Issues · GitLab Data / Permifrost
I created my encrypted private and public keys following the steps ... () expected bytes") TypeError: quote_from_bytes() expected bytes.
Read more >
PSet8: I am getting a TypeError("quote_from_bytes() expected ...
PSet8: I am getting a TypeError("quote_from_bytes() expected bytes") when trying to pass on request.form.get("symbol") to lookup() in line 122 of...
Read more >
Troubleshooting OS Login | Compute Engine Documentation
This document describes how to troubleshoot OS Login using the metadata server. For information about setting up OS Login or for step-by-step instructions, ......
Read more >
Misc/HISTORY - external/github.com/python/cpython
Issue #17828: Output type errors in str.encode(), bytes.decode() and ... Issue #19448: Add private API to SSL module to lookup ASN.1 objects by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found