All the required packages have been successfully installed in the venv (including tree-sitter).
The error occurs because evaluate.py opens a sub-process which calls the system/global python executable instead of the local python executable in .venv/Scripts.
Example error log
Traceback (most recent call last):
File "<path-to-project>\jpamb\solutions\syntaxer.py", line 32, in <module>
import tree_sitter
ModuleNotFoundError: No module named 'tree_sitter'
Tool 'syntaxer' failed with Command '['python', 'solutions/syntaxer.py', 'jpamb.cases.Tricky.collatz:(I)V']' returned non-zero exit status 1.
#### Fails in all other cases as well. ####
Work-around
In this case, I was running syntaxer.py which was using the relative path to src/main/java for the srcfile path, but it works with the absolute path instead:
## Change line 27 in syntaxer.py from:
srcfile = (Path("src/main/java") / i["class_name"].replace(".", "/")).with_suffix(
".java"
)
## to
srcfile = ((Path(os.getcwd() + "/src/main/java") / i["class_name"]
.replace(".", "/"))
.with_suffix(".java"))
and to make sure that the sub-process in evaluate.py uses the venv python executable, I specified the relative path to that executable:
All the required packages have been successfully installed in the venv (including tree-sitter). The error occurs because evaluate.py opens a sub-process which calls the system/global python executable instead of the local python executable in .venv/Scripts.
Example error log
Work-around
In this case, I was running syntaxer.py which was using the relative path to src/main/java for the srcfile path, but it works with the absolute path instead:
and to make sure that the sub-process in evaluate.py uses the venv python executable, I specified the relative path to that executable:
A better work-around might be to activate the venv in the sub-process (in evaluate.py) before running the "tools" on the test cases.