Conversation
The "Open Phy" button failed on macOS with
zsh:1: permission denied: PythonScripts/open_phy.BAT
open_phy.BAT and open_suite2p.BAT are cmd.exe batch files, so MATLAB's
system() handed them to zsh, which tried to execute a non-executable
Windows file. Marking them executable would not have helped either, since
`@echo off` and `call conda activate` are not shell commands.
Both wrappers also assumed phy and suite2p lived in a conda env named on
the command line (iblenv). That assumption does not hold in practice: on
the reporting machine phy is installed in a separate `phy2` env and
iblenv has no phy at all.
Replace both with standalone launchers that declare their dependencies
inline (PEP 723) and run under uv, which the app already locates at
startup for the parameter helper scripts:
uv run --no-project PythonScripts/open_phy.py <sorting_output_dir>
phy (2.1.0) and suite2p (1.1.0) are both pinned from PyPI, so neither
tool needs conda now. They are deliberately kept out of the root
pyproject.toml: phy pins numpy<2 and pulls its own Qt stack, which cannot
coexist with the >=3.14 helper-script environment.
suite2p 1.1.0 still reads the older output layouts this pipeline has
produced (ops/stat/F/Fneu/spks/iscell written with allow_pickle) and
treats an absent optional redcell.npy as "no channel 2" rather than an
error, verified through its own gui.io.load_files entry point, so
pinning the current release does not strand existing results.
Also harden findUv for the cross-platform case. MATLAB's system()
inherits a minimal PATH, so on unix probe `$SHELL -l -c` first, which
sources the user's profile and sees the real PATH; the previous plain
probe found nothing under that minimal PATH while the login shell
resolves /opt/homebrew/bin/uv. Extend the fallback install locations to
cover linuxbrew, /usr/bin and /snap/bin.
Fix an unrelated latent bug in OpenExtGUI while touching the launch
path: when system() threw, `out` was never assigned, so the following
`if out ~= 0` raised its own error and masked the real failure. Move
the exit-status check inside the try block.
The IBL atlas GUI (OpenExtGUI2) still uses the iblenv conda env and is
left alone here; migrating iblapps is a larger change.
Assisted-by: ClaudeCode:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖
🤖 AI text below 🤖
Stacked on #2 — targets
feat/uv-python-env, notmain.The bug
Clicking Open Phy on macOS failed with:
open_phy.BATandopen_suite2p.BATare cmd.exe batch files, so MATLAB'ssystem()handed them to zsh, which tried to execute a non-executable Windows file. Setting the execute bit would not have helped either —@echo offandcall conda activateare not shell commands.Both wrappers also assumed phy and suite2p lived in a conda env named on the command line (
iblenv). That does not hold in practice: on the reporting machine phy is installed in a separatephy2env, andiblenvhas no phy at all.The fix
Replace both
.BATwrappers with standalone launchers that declare their dependencies inline (PEP 723) and run under uv — which the app already locates at startup for the parameter helper scripts:PythonScripts/open_phy.py—phy==2.1.0PythonScripts/open_suite2p.py—suite2p[gui]==1.1.0Both are pinned from PyPI, so neither tool needs conda now. They are deliberately kept out of the root
pyproject.toml: phy pinsnumpy<2and pulls its own Qt stack, which cannot coexist with the>=3.14helper-script environment. uv resolves each into its own cached environment on first use.OpenExtGUI.mnow builds the uv command from a newapp.py_uv, set alongsideapp.py_envingetPythonEnv.m, and reports a clear message when uv is unavailable rather than launching nothing.Cross-platform uv discovery
findUvnever assumed a fixed path, but MATLAB'ssystem()inherits a minimal PATH, which was the real failure mode. On unix it now probes$SHELL -l -cfirst, sourcing the user's profile:Fallback install locations now also cover linuxbrew,
/usr/binand/snap/bin.Drive-by bug fix
In
OpenExtGUI, whensystem()threw,outwas never assigned, so the followingif out ~= 0raised its own error and masked the real failure. The exit-status check moved inside thetryblock.Verification
phy --helpliststemplate-guienv -ienvironmentparams.pyinto array loading)find_statresolves all three suite2p nesting levels; an empty dir opens the GUI emptycheckcodeon all three modified.mfiles reports 0 syntax errors (the one remaining lint is a pre-existing unusedeventcallback argument)suite2p backwards compatibility
Confirmed, since it decided the pin. A legacy-format
plane0directory (ops/stat/F/Fneu/spks/iscell written withallow_pickle) was loaded through suite2p 1.1.0's real GUI entry point,suite2p.gui.io.load_files. All arrays returned correctly, and a missing optionalredcell.npydegraded to "no channel 2" rather than erroring. Pinning the current release does not strand existing results.Not included
OpenExtGUI2(IBL atlas GUI) still uses theiblenvconda env — migratingiblapps-masteris a larger change. Note it is currently broken on macOS for a related reason:getCondaEnvPythonmatches the Name column ofconda env list, which is blank when envs live outside the standard envs dir, soapp.py_ibl_envresolves to[].Assisted-by: ClaudeCode:claude-opus-5
🤖 Generated with Claude Code