<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75963>75963</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lit] Running lit with bazel fails for Python 3.11
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fzakaria
</td>
</tr>
</table>
<pre>
I noticed that running llvm's lit is failing for Python 3.11 but passes for Python 3.10 -- I am not sure why but I wanted to capture my investigation.
Here is a script of me running lit with bazel on Python 3.10 successfully and then switching to Python 3.11 and failing.
```console
❯ python -V
Python 3.11.5
❯ which python
/usr/local/google/home/fmzakari/code/github.com/openxla/stablehlo/venv3.11/bin/python
❯ bazel run @llvm-project//llvm:lit
INFO: Analyzed target @llvm-project//llvm:lit (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target @llvm-project//llvm:lit up-to-date:
bazel-bin/external/llvm-project/llvm/lit
INFO: Elapsed time: 0.137s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/llvm-project/llvm/lit
Traceback (most recent call last):
File "/usr/local/google/home/fmzakari/.cache/bazel/_bazel_fmzakari/17bce12c4b47a4a2fc75249afee05177/execroot/stablehlo/bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/lit.runfiles/llvm-project/llvm/utils/lit/lit.py", line 3, in <module>
from lit.main import main
ModuleNotFoundError: No module named 'lit'
❯ deactivate
❯ source venv310/bin/activate
❯ which python
/usr/local/google/home/fmzakari/code/github.com/openxla/stablehlo/venv310/bin/python
❯ python -V
Python 3.10.0
❯ bazel run @llvm-project//llvm:lit
INFO: Analyzed target @llvm-project//llvm:lit (1 packages loaded, 2 targets configured).
INFO: Found 1 target...
Target @llvm-project//llvm:lit up-to-date:
bazel-bin/external/llvm-project/llvm/lit
INFO: Elapsed time: 0.186s, Critical Path: 0.01s
INFO: 2 processes: 2 internal.
INFO: Build completed successfully, 2 total actions
INFO: Running command line: bazel-bin/external/llvm-project/llvm/lit
usage: lit [-h] [--version] [-j N] [--config-prefix NAME] [-D NAME=VAL] [-q] [-s] [-v] [-vv] [-a]
[-o PATH] [--no-progress-bar] [--show-excluded] [--show-skipped] [--show-unsupported]
[--show-pass] [--show-flakypass] [--show-xfail] [--gtest-sharding]
[--no-gtest-sharding] [--path PATH] [--vg] [--vg-leak] [--vg-arg ARG] [--time-tests]
[--no-execute] [--xunit-xml-output XUNIT_XML_OUTPUT]
[--resultdb-output RESULTDB_OUTPUT] [--time-trace-output TIME_TRACE_OUTPUT]
[--timeout MAXINDIVIDUALTESTTIME] [--max-failures MAX_FAILURES] [--allow-empty-runs]
[--per-test-coverage] [--ignore-fail] [--max-tests N] [--max-time N]
[--order {lexical,random,smart}] [--shuffle] [-i] [--filter REGEX] [--filter-out REGEX]
[--xfail LIST] [--xfail-not LIST] [--num-shards M] [--run-shard N] [--debug]
[--show-suites] [--show-tests] [--show-used-features]
TEST_PATH [TEST_PATH ...]
lit: error: the following arguments are required: TEST_PATH
```
We are using LLVM out of tree in https://github.com/openxla/stablehlo using `llvm_configure` starlark rule.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcF9tO40j2ayovR458SQh5yEMg8UwkYFp06O03VLaP7RrKVZ66AOmvXx07MUkauntH2l1pEILyud9PFbdWVApxwaZXbLoace9qbRblN_7EjeCjTBe7xQaUdiLHAlzNHRivlFAVSPncsHhmQQoHwkLJhSR4qQ182rlaK0jGUQSZd9Bya9GeoUIIAtgAb0g-WG8QXupdR7-BF64cadSQ89YRrtmBUM9onai4E1qNWbhi4bL_-zsaJCM42NyI1oEuocE3W4WDF-FqyPg3lKDViRnW5zlaW3opd8AV-YkK7ItweU3cTp84RBR7Zw82XIT9b66V1RL30HXM5iu2TKHtuYMvPeJI2Hh67MUbx0st8nrPt8fFqbeGxanUOZcsTiutK4ksTmvd0L-y6bPG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