Skip to content

Steps to fix Windows Python Configuration issue manually #724

@jiuqiant

Description

@jiuqiant

If you see an unicode error when building MediaPipe on Windows:

ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
   Traceback (most recent call last):
        File "C:/users/username/_bazel_username/zbffnwmd/external/org_tensorflow/third_party/py/python_configure.bzl", line 210       
                _get_python_lib(repository_ctx, <1 more arguments>)
        File "C:/users/username/_bazel_username/zbffnwmd/external/org_tensorflow/third_party/py/python_configure.bzl", line 130, in _get_python_lib
                execute(repository_ctx, <1 more arguments>)
        File "C:/users/username/_bazel_username/zbffnwmd/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
                fail(<1 more arguments>)
Repository command failed
File "<string>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

please do the following steps to fix it manually.

Step 1. Open the python_configure.bzl file, in my example the file path is C:/users/username/_bazel_username/zbffnwmd/external/org_tensorflow/third_party/py/python_configure.bzl, and edit line 128 to be:

cmd += "system(\"%s script.py\");" % python_bin.replace("\\","/")

Step 2. Rerun the build command. Then, you can go further and see another error "invalid escape sequence".

ERROR
C:/users/username/_bazel_username/zbffnwmd/external/local_execution_config_python/BUILD:11:24: invalid escape sequence: \U     
ERROR: C:/users/username/_bazel_username/zbffnwmd/external/local_execution_config_python/BUILD:17:24: invalid escape sequence: \U 

Step 3. Open the BUILD file, in my example the file path is C:/users/username/_bazel_username/zbffnwmd/external/local_execution_config_python/BUILD, and replace every \ with \\ at line 11 and 17.

Step 4. Continue the build process.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions