[PR #4201] [Other] setup: sycl/setup_intel.py started with the system Python runs again with .venv's (Permission denied on /usr/.strata-pip.json) #4946

Open
opened 2026-11-07 16:31:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4201
Author: @andersson82
Created: 10/26/2026
Status: 🔄 Open

Base: main ← Head: setup-intel-use-venv


📝 Commits (1)

  • 4329ac1 sycl: setup_intel.py started with the system Python runs again with .venv's (it wrote setup's pip stamp to /usr: Permission denied)

📊 Changes

2 files changed (+40 additions, -0 deletions)

View changed files

📝 sycl/setup_intel.py (+13 -0)
📝 tools/test_setup_sycl.py (+27 -0)

📄 Description

Problem and result: if you run python sycl/setup_intel.py directly, setup runs with the system Python. On Fedora 44 (Python 3.14, Arc 140T) it got to Step 3, ran pip and then stopped:

  File "/home/johan/Strata/setup.py", line 3399, in pip_install
    stamp.write_text(json.dumps(sorted(set(have) | set(need)), indent=0))
PermissionError: [Errno 13] Permission denied: '/usr/.strata-pip.json'

pip_install writes its stamp to sys.prefix, which is /usr for the system Python. With this change the script runs itself again with .venv/bin/python when it is not in a virtual environment. If there is no .venv, it says to run ./setup.sh --backend sycl and exits. Inside a virtual environment, such as through setup.sh or setup.py's --backend sycl hand-off, which both use the .venv Python, nothing changes.

Related discussion: none. I found no issue or PR about it.

Approach: a check in sycl/setup_intel.py's __main__, before install(). setup.py is not changed, so the SYCL port stays out of the shared files. The check is not run at import, so the tests that import the module are not affected.

Validation:
Passed: .venv/bin/python tools/test_setup_sycl.py on 4329ac1d (Fedora 44, Python 3.14.8): 26 tests OK. The new UseVenv test covers the hand-over to .venv, staying put inside a venv, and the message when there is no .venv.
Passed: python sycl/setup_intel.py --check with the system Python in a checkout without .venv prints This needs Strata's own Python environment. Run: ./setup.sh --backend sycl [setup's options] and exits 1.
Passed: in a checkout with .venv, starting the script with the system Python calls os.execv with .venv/bin/python, sycl/setup_intel.py and the same options. Checked with os.execv stubbed.
Failed: none observed.
Not run: a full setup run to the end after the hand-over. No engine build was needed, because no C++/SYCL file changed.

Limits: this only finds .venv in the checkout's root, the folder setup.sh creates. Another virtual environment the user has activated is used as it is. Packages that the system Python's pip installed before this fix stay where pip put them (usually ~/.local).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4201 **Author:** [@andersson82](https://github.com/andersson82) **Created:** 10/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `setup-intel-use-venv` --- ### 📝 Commits (1) - [`4329ac1`](https://github.com/Niko1221/Strata/commit/4329ac1d106044b6aff8b42436387a7b7f223654) sycl: setup_intel.py started with the system Python runs again with .venv's (it wrote setup's pip stamp to /usr: Permission denied) ### 📊 Changes **2 files changed** (+40 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `sycl/setup_intel.py` (+13 -0) 📝 `tools/test_setup_sycl.py` (+27 -0) </details> ### 📄 Description Problem and result: if you run `python sycl/setup_intel.py` directly, setup runs with the system Python. On Fedora 44 (Python 3.14, Arc 140T) it got to Step 3, ran pip and then stopped: ``` File "/home/johan/Strata/setup.py", line 3399, in pip_install stamp.write_text(json.dumps(sorted(set(have) | set(need)), indent=0)) PermissionError: [Errno 13] Permission denied: '/usr/.strata-pip.json' ``` `pip_install` writes its stamp to `sys.prefix`, which is `/usr` for the system Python. With this change the script runs itself again with `.venv/bin/python` when it is not in a virtual environment. If there is no `.venv`, it says to run `./setup.sh --backend sycl` and exits. Inside a virtual environment, such as through `setup.sh` or setup.py's `--backend sycl` hand-off, which both use the `.venv` Python, nothing changes. Related discussion: none. I found no issue or PR about it. Approach: a check in `sycl/setup_intel.py`'s `__main__`, before `install()`. `setup.py` is not changed, so the SYCL port stays out of the shared files. The check is not run at import, so the tests that import the module are not affected. Validation: Passed: `.venv/bin/python tools/test_setup_sycl.py` on 4329ac1d (Fedora 44, Python 3.14.8): 26 tests OK. The new `UseVenv` test covers the hand-over to .venv, staying put inside a venv, and the message when there is no .venv. Passed: `python sycl/setup_intel.py --check` with the system Python in a checkout without `.venv` prints `This needs Strata's own Python environment. Run: ./setup.sh --backend sycl [setup's options]` and exits 1. Passed: in a checkout with `.venv`, starting the script with the system Python calls `os.execv` with `.venv/bin/python`, `sycl/setup_intel.py` and the same options. Checked with `os.execv` stubbed. Failed: none observed. Not run: a full setup run to the end after the hand-over. No engine build was needed, because no C++/SYCL file changed. Limits: this only finds `.venv` in the checkout's root, the folder `setup.sh` creates. Another virtual environment the user has activated is used as it is. Packages that the system Python's pip installed before this fix stay where pip put them (usually `~/.local`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4946
No description provided.