nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
58 stars 15 forks source link

`python: command not found error` when calling runfile #271

Open vncntprvst opened 7 months ago

vncntprvst commented 7 months ago

I don't understand why but I have an issue where the python call in the runfile fails. The make_runfile function creates a runfile like this:

#!/bin/bash
export CONDA_PREFIX=/home/wanglab/mambaforge/envs/mescore
export CONDA_PYTHON_EXE=/home/wanglab/mambaforge/bin/python
export CONDA_PREFIX_1=/home/wanglab/mambaforge
export OPENBLAS_NUM_THREADS=1
export MKL_NUM_THREADS=1
python /home/wanglab/mambaforge/envs/mescore/lib/python3.10/site-packages/mesmerize_core/algorithms/mcorr.py --batch-path /home/wanglab/data/2P/run1/mesmerize/batch_20240206-180343.pickle --uuid 2b980e81-1875-4059-8506-9c7dda88e076 --data-path /home/wanglab/data/2P/run1/mesmerize

When it's executed, it fails like this:

Running batch item 0, id 2b980e81-1875-4059-8506-9c7dda88e076, algo mcorr.
/home/wanglab/data/2P/run1/mesmerize/2b980e81-1875-4059-8506-9c7dda88e076.runfile: line 7: python: command not found

It's as if python is not found in the path.

I fixed that issue by updating the code here

            if "CONDA_PREFIX" in os.environ.keys():
                f.write(f"$CONDA_PREFIX/bin/python {module_path} {args_str}")
            else:
                f.write(f"python {module_path} {args_str}")  # call the script to run

The environment is up to date with mesmerize.

mesmerize-core            0.3.0              pyhd8ed1ab_0    conda-forge
python                    3.10.9          he550d4f_0_cpython    conda-forge

Wondering if you've ever seen that issue ? Would you be open to include that fix, if we can't pinpoint the reason for this bug?

kushalkolar commented 6 months ago

I'm not sure why it's failing for you without the full path to the env python. I currently don't have the bandwidth to dig into this and test whether this breaks existing functionality. CI is currently broken because caiman made some weird changes a few months ago that broke things :disappointed: