google / subpar

Subpar is a utility for creating self-contained python executables. It is designed to work well with Bazel.
Apache License 2.0
567 stars 69 forks source link

Running `bazel-bin/*.par ` has ModuleNotFoundError: No module named issue #130

Closed Corezcy closed 3 years ago

Corezcy commented 3 years ago

like issue #89, Successfully build, but I get the problem when running the code bazel-bin/gui/main.par

Traceback (most recent call last):
  File "/Users/core/Documents/anaconda3/envs/DL/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/core/Documents/anaconda3/envs/DL/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "bazel-bin/gui/main.par/__main__.py", line 11, in <module>
ModuleNotFoundError: No module named 'choose_the_scene'

choose_the_scene is a py_library

when I running bazel-bin/gui/main , it's correct.

I dont know where is the problem ?

What I want to do is packging the project with .runfiles.So I can run this file on other computer.

Could you please give some advice? Thank you !

Here is my BUILD:

par_binary(
    name = "main",
    srcs = ["main.py"],
    main = "main.py",
    deps = [
        ":choose_the_scene",
        ":logger",
        ":start_simulation",
        ":check_report",
        ":scenario_run",
        # requirement("absl-py"),
    ],
)