Error: Failed building wheel for executorch

nbansal90: <p>I am getting the following error, looking to set up <code>executorch</code> on my local Ubuntu Workstation.<br>
System Information:<br>
Ubuntu: 22.04<br>
g++ : 11.4.0</p>
<p>I am directly following instructions as mentioned at <a href="https://github.com/pytorch/executorch/issues/url" rel="noopener nofollow ugc">https://pytorch.org/executorch/stable/getting-started-setup.html</a>. I get the following error after executing the command: <code>./install_requirements.sh</code></p>
<p><strong>Error:</strong></p>
<pre><code class="lang-auto">-- Using python executable '/home/n.bansal1/anaconda3/envs/executorch/bin/python'
  -- Resolved buck2 as /home/n.bansal1/projects/executorch/pip-out/temp.linux-x86_64-cpython-310/cmake-out/buck2-bin/buck2-071372cfde6e9936c62eb92823742392af4a945570df5c5b34d3eed1b03813c3.
  -- Killing buck2 daemon
  -- executorch: Generating source lists
  -- executorch: Generating source file list /home/n.bansal1/projects/executorch/pip-out/temp.linux-x86_64-cpython-310/cmake-out/executorch_srcs.cmake
  Error while generating /home/n.bansal1/projects/executorch/pip-out/temp.linux-x86_64-cpython-310/cmake-out/executorch_srcs.cmake. Exit code: 1
  Output:

  Error:
  Traceback (most recent call last):
    File "/home/n.bansal1/projects/executorch/build/buck_util.py", line 26, in run
      cp: subprocess.CompletedProcess = subprocess.run(
    File "/home/n.bansal1/anaconda3/envs/executorch/lib/python3.10/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/home/n.bansal1/projects/executorch/pip-out/temp.linux-x86_64-cpython-310/cmake-out/buck2-bin/buck2-071372cfde6e9936c62eb92823742392af4a945570df5c5b34d3eed1b03813c3', 'cquery', "inputs(deps('//runtime/executor:program'))"]' returned non-zero exit status 1.

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "/home/n.bansal1/projects/executorch/build/extract_sources.py", line 218, in &lt;module&gt;
      main()
    File "/home/n.bansal1/projects/executorch/build/extract_sources.py", line 203, in main
      target_to_srcs[name] = sorted(target.get_sources(graph, runner))
    File "/home/n.bansal1/projects/executorch/build/extract_sources.py", line 116, in get_sources
      sources: set[str] = set(runner.run(["cquery", query]))
    File "/home/n.bansal1/projects/executorch/build/buck_util.py", line 31, in run
      raise RuntimeError(ex.stderr.decode("utf-8")) from ex
  RuntimeError: Command failed: Error creating cell resolver

  Caused by:
      Expected a HOME directory to be available


  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/n.bansal1/anaconda3/envs/executorch/bin/cmake' failed with exit code 1
  error: subprocess-exited-with-error
</code></pre>
<pre><code class="lang-auto">Building wheel for executorch (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─&gt; See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/n.bansal1/anaconda3/envs/executorch/bin/python /home/n.bansal1/anaconda3/envs/executorch/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpxqgivese
  cwd: /home/n.bansal1/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
</code></pre>
<p>Any help would be appreciated!<br>
Thank you.</p>

nbansal90: <p>Able to resolve this issue with the fix on this link : <a href="https://github.com/pytorch/executorch/pull/3507" rel="noopener nofollow ugc">Patch</a></p>