Donders-Institute / bidscoin

BIDScoin converts your source-level neuroimaging data to BIDS
https://bidscoin.readthedocs.io
GNU General Public License v3.0
129 stars 35 forks source link

Document How to Run Tests/Set up Env #247

Open bendhouseart opened 6 hours ago

bendhouseart commented 6 hours ago

General summary Unable to run tests with pytest

(venv) galassiae@MH02276145MLI bidscoin % pytest tests             
ImportError while loading conftest '/Users/galassiae/Projects/bidscoin/tests/conftest.py'.
tests/conftest.py:10: in <module>
    from bidscoin.utilities import dicomsort
E   ModuleNotFoundError: No module named 'bidscoin.utilities'

Additional detail Might be related to pip install failing:

(venv) galassiae@MH02276145MLI bidscoin % pip install bidscoin[dev]
zsh: no matches found: bidscoin[dev]
(venv) galassiae@MH02276145MLI bidscoin % pytest tests 
ImportError while loading conftest '/Users/galassiae/Projects/bidscoin/tests/conftest.py'.
tests/conftest.py:10: in <module>
    from bidscoin.utilities import dicomsort
E   ModuleNotFoundError: No module named 'bidscoin.utilities'

Currently working off of commit 527d97b6f2d from 2024-11-04 at donders-institute/bidscoin:master

marcelzwiers commented 5 hours ago

Are you perhaps in a py3.13 environment? Because that fails here too

bendhouseart commented 5 hours ago

I'm on Python 3.11.0 (v3.11.0:deaf509e8f, Oct 24 2022, 14:43:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin

What do you recommend?

marcelzwiers commented 5 hours ago

That should be ok, but it is unclear to me why your install fails? If you install without the dev extras, does that work?

marcelzwiers commented 5 hours ago

It works on GitHub...? https://github.com/Donders-Institute/bidscoin/actions/runs/11699151269/job/32580622420

bendhouseart commented 5 hours ago

Yeah, that's very odd....

I tried the same commands on the github runner for mac and got the same errors, but when I switch over to bash:

(venv) galassiae@MH02276145MLI bidscoin % pip install .[all] pytest    
zsh: no matches found: .[all]
(venv) galassiae@MH02276145MLI bidscoin % bash
bash: /Applications/freesurfer/7.2.0/SetUpFreeSurfer.sh: No such file or directory

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
(venv) %n@%m %1~ %# pip install .[all] pytest
Processing /Users/galassiae/Projects/bidscoin
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pytest
  Downloading pytest-8.3.3-py3-none-any.whl.metadata (7.5 kB)
Requirement already satisfied: pandas in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (2.2.3)
Requirement already satisfied: matplotlib in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (3.9.2)
Requirement already satisfied: numpy in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (1.26.4)
Requirement already satisfied: pydicom>=2 in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (2.4.4)
Requirement already satisfied: PyQt6 in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (6.7.1)
Requirement already satisfied: ruamel-yaml>0.17.2 in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (0.18.6)
Requirement already satisfied: coloredlogs in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (15.0.1)
Requirement already satisfied: tqdm>=4.60.0 in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (4.66.5)
Requirement already satisfied: multiecho>=0.25 in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (0.29)
Requirement already satisfied: python-dateutil in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (2.9.0.post0)
Requirement already satisfied: nibabel in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (5.3.2)
Requirement already satisfied: bids-validator in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (1.14.7.post0)
Requirement already satisfied: jsonschema in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (4.23.0)
Requirement already satisfied: bidsschematools in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (0.11.3)
Requirement already satisfied: drmaa in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (0.7.9)
Requirement already satisfied: duecredit in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (0.10.2)
Requirement already satisfied: pypet2bids in ./venv/lib/python3.11/site-packages (from bidscoin==4.5.0) (1.3.13)
Collecting iniconfig (from pytest)
  Downloading iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: packaging in ./venv/lib/python3.11/site-packages (from pytest) (24.1)
Collecting pluggy<2,>=1.5 (from pytest)
  Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in ./venv/lib/python3.11/site-packages (from ruamel-yaml>0.17.2->bidscoin==4.5.0) (0.2.12)
Requirement already satisfied: click in ./venv/lib/python3.11/site-packages (from bidsschematools->bidscoin==4.5.0) (8.1.7)
Requirement already satisfied: pyyaml in ./venv/lib/python3.11/site-packages (from bidsschematools->bidscoin==4.5.0) (6.0.2)
Collecting dcm2niix (from bidscoin==4.5.0)
  Downloading dcm2niix-1.0.20220715.tar.gz (451 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pydeface (from bidscoin==4.5.0)
  Downloading pydeface-2.0.2-py3-none-any.whl.metadata (1.8 kB)
Collecting spec2nii>=0.6.1 (from bidscoin==4.5.0)
  Downloading spec2nii-0.8.5-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: joblib<2.0.0,>=1.2.0 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (1.4.2)
Requirement already satisfied: json-maj<0.0.9,>=0.0.8 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (0.0.8)
Requirement already satisfied: openpyxl<4.0.0,>=3.0.9 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (3.1.5)
Requirement already satisfied: pyparsing<4.0.0,>=3.0.4 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (3.2.0)
Requirement already satisfied: python-dotenv<0.20.0,>=0.19.1 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (0.19.2)
Requirement already satisfied: pyxlsb<2.0.0,>=1.0.9 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (1.0.10)
Requirement already satisfied: scipy<2.0.0,>=1.7.1 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (1.14.1)
Requirement already satisfied: six<2.0.0,>=1.16.0 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (1.16.0)
Requirement already satisfied: toml>=0.10.2 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (0.10.2)
Requirement already satisfied: xlrd<3.0.0,>=2.0.1 in ./venv/lib/python3.11/site-packages (from pypet2bids->bidscoin==4.5.0) (2.0.1)
Requirement already satisfied: importlib-resources>=5.12 in ./venv/lib/python3.11/site-packages (from nibabel->bidscoin==4.5.0) (6.4.5)
Requirement already satisfied: typing-extensions>=4.6 in ./venv/lib/python3.11/site-packages (from nibabel->bidscoin==4.5.0) (4.12.2)
Requirement already satisfied: pytz>=2020.1 in ./venv/lib/python3.11/site-packages (from pandas->bidscoin==4.5.0) (2024.2)
Requirement already satisfied: tzdata>=2022.7 in ./venv/lib/python3.11/site-packages (from pandas->bidscoin==4.5.0) (2024.2)
Requirement already satisfied: humanfriendly>=9.1 in ./venv/lib/python3.11/site-packages (from coloredlogs->bidscoin==4.5.0) (10.0)
Requirement already satisfied: citeproc-py>=0.4 in ./venv/lib/python3.11/site-packages (from duecredit->bidscoin==4.5.0) (0.6.0)
Requirement already satisfied: looseversion in ./venv/lib/python3.11/site-packages (from duecredit->bidscoin==4.5.0) (1.3.0)
Requirement already satisfied: requests in ./venv/lib/python3.11/site-packages (from duecredit->bidscoin==4.5.0) (2.32.3)
Requirement already satisfied: attrs>=22.2.0 in ./venv/lib/python3.11/site-packages (from jsonschema->bidscoin==4.5.0) (24.2.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in ./venv/lib/python3.11/site-packages (from jsonschema->bidscoin==4.5.0) (2024.10.1)
Requirement already satisfied: referencing>=0.28.4 in ./venv/lib/python3.11/site-packages (from jsonschema->bidscoin==4.5.0) (0.35.1)
Requirement already satisfied: rpds-py>=0.7.1 in ./venv/lib/python3.11/site-packages (from jsonschema->bidscoin==4.5.0) (0.20.0)
Requirement already satisfied: contourpy>=1.0.1 in ./venv/lib/python3.11/site-packages (from matplotlib->bidscoin==4.5.0) (1.3.0)
Requirement already satisfied: cycler>=0.10 in ./venv/lib/python3.11/site-packages (from matplotlib->bidscoin==4.5.0) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in ./venv/lib/python3.11/site-packages (from matplotlib->bidscoin==4.5.0) (4.54.1)
Requirement already satisfied: kiwisolver>=1.3.1 in ./venv/lib/python3.11/site-packages (from matplotlib->bidscoin==4.5.0) (1.4.7)
Requirement already satisfied: pillow>=8 in ./venv/lib/python3.11/site-packages (from matplotlib->bidscoin==4.5.0) (11.0.0)
Requirement already satisfied: PyQt6-sip<14,>=13.8 in ./venv/lib/python3.11/site-packages (from PyQt6->bidscoin==4.5.0) (13.8.0)
Requirement already satisfied: PyQt6-Qt6<6.8.0,>=6.7.0 in ./venv/lib/python3.11/site-packages (from PyQt6->bidscoin==4.5.0) (6.7.3)
Requirement already satisfied: lxml in ./venv/lib/python3.11/site-packages (from citeproc-py>=0.4->duecredit->bidscoin==4.5.0) (5.3.0)
Requirement already satisfied: et-xmlfile in ./venv/lib/python3.11/site-packages (from openpyxl<4.0.0,>=3.0.9->pypet2bids->bidscoin==4.5.0) (1.1.0)
Collecting pyMapVBVD>=0.6.0 (from spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading pyMapVBVD-0.6.1-py3-none-any.whl.metadata (4.4 kB)
Collecting brukerapi>=0.1.8 (from spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading brukerapi-0.1.9-py3-none-any.whl.metadata (337 bytes)
Collecting nifti-mrs>=1.3.2 (from spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading nifti_mrs-1.3.2-py3-none-any.whl.metadata (5.4 kB)
INFO: pip is looking at multiple versions of spec2nii to determine which version is compatible with other requirements. This could take a while.
Collecting spec2nii>=0.6.1 (from bidscoin==4.5.0)
  Downloading spec2nii-0.8.4-py3-none-any.whl.metadata (11 kB)
Collecting scipy<2.0.0,>=1.7.1 (from pypet2bids->bidscoin==4.5.0)
  Downloading scipy-1.13.1-cp311-cp311-macosx_12_0_arm64.whl.metadata (60 kB)
Collecting spec2nii>=0.6.1 (from bidscoin==4.5.0)
  Downloading spec2nii-0.8.3-py3-none-any.whl.metadata (11 kB)
Collecting miutil[web] (from dcm2niix->bidscoin==4.5.0)
  Downloading miutil-0.12.0-py3-none-any.whl.metadata (4.7 kB)
Collecting nipype (from pydeface->bidscoin==4.5.0)
  Downloading nipype-1.9.0-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: setuptools in ./venv/lib/python3.11/site-packages (from pydeface->bidscoin==4.5.0) (65.5.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib/python3.11/site-packages (from requests->duecredit->bidscoin==4.5.0) (3.4.0)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.11/site-packages (from requests->duecredit->bidscoin==4.5.0) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv/lib/python3.11/site-packages (from requests->duecredit->bidscoin==4.5.0) (2.2.3)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.11/site-packages (from requests->duecredit->bidscoin==4.5.0) (2024.8.30)
Collecting fslpy (from nifti-mrs>=1.3.2->spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading fslpy-3.21.1-py3-none-any.whl.metadata (5.6 kB)
Collecting h5py (from pyMapVBVD>=0.6.0->spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading h5py-3.12.1-cp311-cp311-macosx_11_0_arm64.whl.metadata (2.5 kB)
Collecting networkx>=2.0 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading networkx-3.4.2-py3-none-any.whl.metadata (6.3 kB)
Collecting prov>=1.5.2 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading prov-2.0.1-py3-none-any.whl.metadata (3.6 kB)
Collecting pydot>=1.2.3 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading pydot-3.0.2-py3-none-any.whl.metadata (10 kB)
Collecting rdflib>=5.0.0 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading rdflib-7.1.1-py3-none-any.whl.metadata (11 kB)
Collecting simplejson>=3.8.0 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading simplejson-3.19.3-cp311-cp311-macosx_11_0_arm64.whl.metadata (3.2 kB)
Collecting traits!=5.0,>=4.6 (from nipype->pydeface->bidscoin==4.5.0)
  Downloading traits-6.4.3-cp311-cp311-macosx_10_9_universal2.whl.metadata (5.0 kB)
Collecting filelock>=3.0.0 (from nipype->pydeface->bidscoin==4.5.0)
  Using cached filelock-3.16.1-py3-none-any.whl.metadata (2.9 kB)
Collecting etelemetry>=0.2.0 (from nipype->pydeface->bidscoin==4.5.0)
  Using cached etelemetry-0.3.1-py3-none-any.whl.metadata (3.2 kB)
Collecting puremagic (from nipype->pydeface->bidscoin==4.5.0)
  Downloading puremagic-1.28-py3-none-any.whl.metadata (5.8 kB)
Collecting ci-info>=0.2 (from etelemetry>=0.2.0->nipype->pydeface->bidscoin==4.5.0)
  Using cached ci_info-0.3.0-py3-none-any.whl.metadata (6.1 kB)
Collecting rdflib>=5.0.0 (from nipype->pydeface->bidscoin==4.5.0)
  Using cached rdflib-6.3.2-py3-none-any.whl.metadata (11 kB)
Collecting isodate<0.7.0,>=0.6.0 (from rdflib>=5.0.0->nipype->pydeface->bidscoin==4.5.0)
  Using cached isodate-0.6.1-py2.py3-none-any.whl.metadata (9.6 kB)
Collecting dill (from fslpy->nifti-mrs>=1.3.2->spec2nii>=0.6.1->bidscoin==4.5.0)
  Downloading dill-0.3.9-py3-none-any.whl.metadata (10 kB)
Downloading pytest-8.3.3-py3-none-any.whl (342 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Downloading spec2nii-0.8.3-py3-none-any.whl (124 kB)
Downloading scipy-1.13.1-cp311-cp311-macosx_12_0_arm64.whl (30.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 30.3/30.3 MB 61.0 MB/s eta 0:00:00
Downloading pydeface-2.0.2-py3-none-any.whl (8.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.2/8.2 MB 61.5 MB/s eta 0:00:00
Downloading brukerapi-0.1.9-py3-none-any.whl (38 kB)
Downloading nifti_mrs-1.3.2-py3-none-any.whl (36 kB)
Downloading pyMapVBVD-0.6.1-py3-none-any.whl (28 kB)
Downloading nipype-1.9.0-py3-none-any.whl (3.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 61.1 MB/s eta 0:00:00
Using cached etelemetry-0.3.1-py3-none-any.whl (6.4 kB)
Using cached filelock-3.16.1-py3-none-any.whl (16 kB)
Downloading networkx-3.4.2-py3-none-any.whl (1.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 40.6 MB/s eta 0:00:00
Downloading prov-2.0.1-py3-none-any.whl (421 kB)
Downloading pydot-3.0.2-py3-none-any.whl (35 kB)
Using cached rdflib-6.3.2-py3-none-any.whl (528 kB)
Downloading simplejson-3.19.3-cp311-cp311-macosx_11_0_arm64.whl (74 kB)
Downloading traits-6.4.3-cp311-cp311-macosx_10_9_universal2.whl (5.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.0/5.0 MB 54.9 MB/s eta 0:00:00
Downloading fslpy-3.21.1-py3-none-any.whl (4.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 51.0 MB/s eta 0:00:00
Downloading h5py-3.12.1-cp311-cp311-macosx_11_0_arm64.whl (2.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 32.5 MB/s eta 0:00:00
Downloading miutil-0.12.0-py3-none-any.whl (18 kB)
Downloading puremagic-1.28-py3-none-any.whl (43 kB)
Using cached ci_info-0.3.0-py3-none-any.whl (7.8 kB)
Using cached isodate-0.6.1-py2.py3-none-any.whl (41 kB)
Downloading dill-0.3.9-py3-none-any.whl (119 kB)
Building wheels for collected packages: bidscoin, dcm2niix
  Building wheel for bidscoin (pyproject.toml) ... done
  Created wheel for bidscoin: filename=bidscoin-4.5.0-py3-none-any.whl size=759671 sha256=9bb45cebfad36749a28f41c554efb0de56fdbf8573b8c77e3ea85439402e95d1
  Stored in directory: /private/var/folders/5t/0cjjt4t10hz5_qk4tts9gkv40000gs/T/pip-ephem-wheel-cache-u6a2ktx2/wheels/1a/8c/f7/ef2d6820eb3bc359bfe9183dac437a42012870672461544f0a
  Building wheel for dcm2niix (pyproject.toml) ... /

It works fine...

bendhouseart commented 5 hours ago

Created PR #248 to close this.