Skip to content

ImportError: No module named moves.urllib.parse #1022

Closed
@raulAtNines

Description

@raulAtNines

Hi,

I am trying to publish a java image from our bazel 0.28.1 build. I can build the image locally without issues with bazel run mytarget. However, when I try to publish the image with container_push, I run into an issue with six:

Traceback (most recent call last):
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/tools/image_digester_.py", line 28, in <module>
    from containerregistry.client.v2_2 import docker_image as v2_2_image
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/client/__init__.py", line 19, in <module>
    from containerregistry.client import docker_name_
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/client/docker_name_.py", line 23, in <module>
    import six.moves.urllib.parse
ImportError: No module named moves.urllib.parse
----------------
Note: The failure of target @containerregistry//:digester (with exit code 1) may have been caused by the fact that it is running under Python 2 instead of Python 3. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY3, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------

Earlier today I got the environment to work with PY2, which I think is required here. However, I tried with PY3 and the issue was similar:

Traceback (most recent call last):
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/tools/image_digester_.py", line 28, in <module>
    from containerregistry.client.v2_2 import docker_image as v2_2_image
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/client/__init__.py", line 19, in <module>
    from containerregistry.client import docker_name_
  File "/mypath/bazel-out/host/bin/external/containerregistry/digester.runfiles/containerregistry/client/docker_name_.py", line 23, in <module>
    import six.moves.urllib.parse
ImportError: No module named moves.urllib.parse

Except the PY3 message goes away.

Any hints on how to work around this? Is this something for containerregistry to fix?

Thanks,
Raul.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions