pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
2.08k stars 343 forks source link

Fail to Install Requirements: Could not build wheels for executorch, Could not build wheels for executorch, which is required to install pyproject.toml-based projects #3764

Open CannoChen opened 5 months ago

CannoChen commented 5 months ago

When i run './install_requirements.sh': An Error occured! The information is :


Command failed:
  Error looking up configured node root//runtime/executor:program (prelude//platforms:default#524f8da68ea2a374)

  Caused by:
      0: Error looking up configured node root//runtime/executor:program_no_prim_ops (prelude//platforms:default#524f8da68ea2a374)
      1: Error looking up configured node root//schema:program (prelude//platforms:default#524f8da68ea2a374)
      2: Error looking up configured node root//schema:generate_program (prelude//platforms:default#524f8da68ea2a374)
      3: Error looking up configured node root//third-party:flatc (prelude//platforms:default#524f8da68ea2a374)
      4: looking up unconfigured target node `root//third-party:flatc`
      5: Error loading targets in package `root//third-party` for target `root//third-party:flatc`
      6: Error evaluating build file: `root//third-party:TARGETS`
      7: Traceback (most recent call last):
           * third-party/TARGETS:9, in <module>
               define_gflags()
           * third-party/gflags.bzl:5, in define_gflags
               (exported_headers, headers, srcs) = gflags_sources(namespace = [
           * third-party/gflags_defs.bzl:8, in gflags_sources
               native.genrule(
         error: Error coercing attribute `srcs` of `root//third-party:gflags_declare_h`
           --> third-party/gflags_defs.bzl:8:5
            |
          8 |       native.genrule(
            |  _____^
          9 | |         name = "gflags_declare_h",
         10 | |         srcs = ["gflags/src/gflags_declare.h.in"],
         11 | |         out = "gflags/gflags_declare.h",
         12 | |         cmd = (common_preamble + "awk '{ " +
         13 | |                "gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); " +
         14 | |                "gsub(/@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@/, \"1\"); " +
         15 | |                "gsub(/@([A-Z0-9_]+)@/, \"0\"); " +
         16 | |                "print; }' $SRCS > $OUT"),
         17 | |     )
            | |_____^
            |

      8: Error coercing attribute `srcs` of type `attrs.one_of(attrs.dict(attrs.string(), attrs.source(), sorted=False), attrs.list(attrs.source()), default=[])`
      9: Error coercing ["gflags/src/gflags_declare.h.in"]
     10: one_of fails, the errors against each alternative in turn were:
         Expected value of type `dict`, got value with type `list` (value was `["gflags/src/gflags_declare.h.in"]`)
         Error coercing "gflags/src/gflags_declare.h.in": Couldn't coerce `gflags/src/gflags_declare.h.in` as a source.
           Error when treated as a target: Invalid absolute target pattern `gflags/src/gflags_declare.h.in` is not allowed: Expected a `:`, a trailing `/...` or the literal `...`.: Expected a `:`, a trailing `/...` or the literal `...`.: Expected a `:`, a trailing `/...` or the literal `...`.
           Error when treated as a path: Source file `gflags/src/gflags_declare.h.in` does not exist as a member of package `root//third-party`.

  CMake Error at build/Utils.cmake:161 (message):
    executorch: source list generation failed
  Call Stack (most recent call first):
    CMakeLists.txt:261 (extract_sources)

  -- Configuring incomplete, errors occurred!
  error: command '/home/chen/anaconda3/envs/executorch/bin/cmake' failed with exit code 1
  error: subprocess-exited-with-error

  × Building wheel for executorch (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/chen/anaconda3/envs/executorch/bin/python /home/chen/anaconda3/envs/executorch/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpz6um_q7n
  cwd: /home/chen/Projects/executorch
  Building wheel for executorch (pyproject.toml) ... error
  ERROR: Failed building wheel for executorch
Failed to build executorch
ERROR: Could not build wheels for executorch, which is required to install pyproject.toml-based `projects`

my env:

II see that problem #3589 is similar to mine, but we are still different from each other. How should I solve this problem?

mergennachin commented 5 months ago

@CannoChen

Can you try on a fresh conda environment and run git submodule sync and git submodule update --init

If that doesn't work, can you try uninstalling buck2?

We recently upgraded our buck2 requirement (https://github.com/pytorch/executorch/pull/3698)

Once you uninstall buck2, the build script should automatically downloads a correct buck2 version.

@GregoryComer what happens if the installed buck2 is older? Does it automatically update?

CannoChen commented 5 months ago

@mergennachin In fact, I followed the tutorial exactly. And I don't have buck2 installed on my computer.

I compiled successfully yesterday, but when I deleted my virtual environment and recreated it following the tutorial, it did not compile successfully!

The only clue I can offer is that I had changed the Cmake version. I followed the tutorial(https://pytorch.org/executorch/stable/demo-apps-android.html) and then upgraded my cmake version to the latest(3.29.3).

I know, I'm a rookie. But executorch is just too hard to use. I followed the tutorial almost every step of the way, but it didn't work.

I'm so tired (T.T).... i spent two weeks to learn this framework. But i can't get any reward from it.

CannoChen commented 5 months ago

update:

I tried exchage cmake to version 3.22.6. But it didn't work.

Next, i will try to install Buck2 on my computer.

CannoChen commented 5 months ago

update:

I tried to install Buck2. But nothing happened. It's not a nice solution for this problem.

czy2014hust commented 5 months ago

Try this version of Buck2: 2024-02-15

SimaNoma commented 4 months ago

Hey I am experiencing the same build issue running WSL2 trying to build with the XNN backend. Did installing that version of Buck2 fix the issue? @CannoChen

CannoChen commented 4 months ago

Hey I am experiencing the same build issue running WSL2 trying to build with the XNN backend. Did installing that version of Buck2 fix the issue? @CannoChen

No, the problem is not solved. I gave up using pytorch to deploy my model on edge devices. Because it is hard to use. For the more, it is a baby work for edge devices! Perhaps it will become easier to use in future iterations. But given the previous PytorchMobile failure, I chose to use TensorFlow Lite instead.

hsyodyssey commented 1 week ago

Facing the same problem when built it on WSL2.