Anki Forums

[Bug] Building on Windows: py_deps - "Error in path: Not a regular file"

Adding this for searchability from Google.

INFO: Repository py_deps instantiated at:
  C:/github/anki-onboarding/anki/WORKSPACE:14:11: in <toplevel>
  C:/github/anki-onboarding/anki/defs.bzl:36:15: in setup_deps
Repository rule pip_import defined at:
  C:/bazel/anki/tjdcnedn/external/com_github_ali5h_rules_pip/defs.bzl:59:29: in <toplevel>
ERROR: An error occurred during the fetch of repository 'py_deps':
   Traceback (most recent call last):
        File "C:/bazel/anki/tjdcnedn/external/com_github_ali5h_rules_pip/defs.bzl", line 16, column 49, in _pip_import_impl
                python_interpreter = repository_ctx.path(repository_ctx.attr.python_runtime)
Error in path: Not a regular file: C:/bazel/anki/tjdcnedn/external/python/python
ERROR: Error fetching repository: Traceback (most recent call last):
        File "C:/bazel/anki/tjdcnedn/external/com_github_ali5h_rules_pip/defs.bzl", line 16, column 49, in _pip_import_impl
                python_interpreter = repository_ctx.path(repository_ctx.attr.python_runtime)
Error in path: Not a regular file: C:/bazel/anki/tjdcnedn/external/python/python
ERROR: no such package '@py_deps//': Not a regular file: C:/bazel/anki/tjdcnedn/external/python/python
INFO: Elapsed time: 205.066s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
1 Like

Cause:

py_runtime(
    name = "python_runtime",
    interpreter_path = "c:/python/python.exe",
    python_version = "PY3",
    visibility = ["//visibility:public"],
)

interpreter_path is hardcoded by

Ideally the path should be confirmed to be valid before continuing. Will put in a PR in the next week for this.

1 Like

Well, docs/windows.md does tell you so :slight_smile:

Download the 64 bit Python 3.8 from https://python.org. Run the installer,
and customize the installation. Select “install for all users”, and choose
the install path as c:\python. Currently the build scripts require
Python to be installed in that location.

Happy to accept a PR that adds a more informative message, and if you’ve confirmed overriding the location in user.bazelrc doesn’t cause problems, happy to have that in the docs as well.

3 Likes

Looking forward to your PR!

Did you find a solution? I’m having the same problem.