Skip to content

ModuleNotFoundError for keyring.util.escape in Docker image (poetry 1.0.0 and 1.0.0b9) #1719

@TheButlah

Description

@TheButlah
  • 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).
  • OS version and name: MacOS 10.14.6, running docker. Docker image is nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
  • Poetry version: Both 1.0.0b9 and 1.0.0

Issue

Attempted an install of poetry in my docker file. The install succeeds, but running any poetry commands gives a strange error. I've shown the docker build (trimmed down) along with the error below.

Docker Build output (Trimmed down for brevity):

Setting up container for folder or workspace: /Users/ryan.butler/Programming/robotics
Run: docker build -f /Users/ryan.butler/Programming/robotics/Dockerfile -t vsc-robotics-14e00cfc95af169a4eb8b5156cec6517 /Users/ryan.butler/Programming/robotics
Sending build context to Docker daemon  115.4MB
Step 1/44 : FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
 ---> 81c7dbc267d8
....................................
Step 11/44 : RUN  update-alternatives --install /usr/bin/python python /usr/bin/python3 10   && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10
 ---> Using cache
 ---> 0cb8d16b47b8
.....................................
Step 18/44 : USER ${USERNAME}
 ---> Using cache
 ---> e18c506cbcad
......................................
Step 27/44 : SHELL ["/bin/zsh", "-c"]
 ---> Using cache
 ---> 426fe465c653
.......................................
Step 33/44 : ENV PY_USER_BIN="/home/${USERNAME}/.local/bin"
 ---> Using cache
 ---> 28e257b22543
Step 34/44 : RUN echo "PY_USER_BIN=$PY_USER_BIN"
 ---> Using cache
 ---> 9f22bf26abcc
Step 35/44 : ENV PATH=$PY_USER_BIN:$PATH
 ---> Using cache
 ---> ef605d0626e3
Step 36/44 : RUN pip list | grep keyring
 ---> Running in 9528402aa43c
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
keyring (10.6.0)
keyrings.alt (3.0)
Removing intermediate container 9528402aa43c
 ---> 294fa116e934
Step 37/44 : ENV PATH="/home/${USERNAME}/.poetry/bin:$PATH"
 ---> Running in b1b79a218bcc
Removing intermediate container b1b79a218bcc
 ---> 596f1ba898f6
Step 38/44 : RUN which python && which pip
 ---> Running in a5f223ed10f2
/usr/bin/python
/usr/bin/pip
Removing intermediate container a5f223ed10f2
 ---> 6fd46b40f5ee
Step 39/44 : RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
 ---> Running in eb812cbd3c07
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.
.................................................

Poetry (1.0.0) is installed now. Great!

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run `source $HOME/.poetry/env`

Removing intermediate container eb812cbd3c07
 ---> b0cfd3ab6a72
Step 40/44 : RUN which poetry
 ---> Running in 459a6af62814
/home/saicny/.poetry/bin/poetry
Removing intermediate container 459a6af62814
 ---> 3e2a9b083675
Step 41/44 : RUN poetry
 ---> Running in be08c33c0095
Traceback (most recent call last):
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 203, in _load_plugins
    init_func = ep.load()
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/importlib_metadata/__init__.py", line 92, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/saicny/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/home/saicny/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/saicny/.poetry/lib/poetry/console/application.py", line 5, in <module>
    from .commands.about import AboutCommand
  File "/home/saicny/.poetry/lib/poetry/console/commands/__init__.py", line 4, in <module>
    from .check import CheckCommand
  File "/home/saicny/.poetry/lib/poetry/console/commands/check.py", line 1, in <module>
    from poetry.factory import Factory
  File "/home/saicny/.poetry/lib/poetry/factory.py", line 17, in <module>
    from .packages.dependency import Dependency
  File "/home/saicny/.poetry/lib/poetry/packages/__init__.py", line 7, in <module>
    from .dependency import Dependency
  File "/home/saicny/.poetry/lib/poetry/packages/dependency.py", line 10, in <module>
    from poetry.utils.helpers import canonicalize_name
  File "/home/saicny/.poetry/lib/poetry/utils/helpers.py", line 11, in <module>
    from keyring import delete_password
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/__init__.py", line 1, in <module>
    from .core import (
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/core.py", line 192, in <module>
    init_backend()
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/core.py", line 96, in init_backend
    filter(limit, backend.get_all_keyring()),
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/util/__init__.py", line 22, in wrapper
    func.always_returns = func(*args, **kwargs)
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 216, in get_all_keyring
    _load_plugins()
  File "/home/saicny/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 207, in _load_plugins
    log.exception("Error initializing plugin %s." % ep)
TypeError: not all arguments converted during string formatting
The command '/bin/zsh -c poetry' returned a non-zero code: 1
Failed: Building an image from the ../Dockerfile (this can take a while).
Command failed: docker build -f /Users/ryan.butler/Programming/robotics/Dockerfile -t vsc-robotics-14e00cfc95af169a4eb8b5156cec6517 /Users/ryan.butler/Programming/robotics

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docs/faqFrequently duplicated/potential addition to FAQkind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions