Closed aribesik closed 11 months ago
Thanks for looking into this, it has to do something with whether pytest is installed or not. I'll see if I can figure out what is going on...
Can you perhaps try using python > 3.8?
I think I should either patch that import statement (it's something minor) or set bidscoin to require python > 3.8, see:
https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files
I patched it now, but I think your errors will go away if you do pip install pytest
or use python>3.8. You can close this issue if you can confirm that
Hi there, sorry for the really late reply - very hectic time + I actually finished working at the lab last week lol ( i ended up just reverting them to the old version I was using so they had a working version before i left).
But I tested it now anyway and 3.9 appears to be working! Ubuntu 20.04 users will have to have admin privs for 3.9 to work though or have someone with admin privs install missing libraries with the command: sudo apt install libxcb-cursor0 before 3.9 will work.
Thanks for your help + the fix! Take care
Describe the bug When testing bidscoin (version 4.2.1) install with bidscoin -t on Ubuntu 20.04, dcm2niixbids.py plugin runs into an error:
ERROR | Could not import /home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/dcm2niix2bids.py: cannot import name 'files' from 'importlib.resources' (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/importlib/resources.py) ERROR | Invalid plugin: 'dcm2niix2bids'
So does nibabel2bids :
ERROR | Could not import /home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/nibabel2bids.py: cannot import name 'files' from 'importlib.resources' (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/importlib/resources.py) ERROR | Invalid plugin: 'nibabel2bids'
Full output:
(bidscoin-env3.8) relsayed_local@kdavis35:/home/local$ bidscoin -t INFO | --------- Testing the BIDScoin's core functionality --------- INFO | Running bidsmap checks: INFO | Reading: /home/relsayed_local/.bidscoin/4.2.1/templates/bidsmap_dccn.yaml VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/dcm2niix2bids.py' ERROR | Could not import /home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/dcm2niix2bids.py: cannot import name 'files' from 'importlib.resources' (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/importlib/resources.py) INFO | Checking the bidsmap run-items: INFO | Could not validate every run-item in the bidsmap INFO | Checking the bidsmap datatypes: SUCCESS | All datatypes in the bidsmap are valid INFO | Testing the PyQt GUI setup: qt.qpa.theme.dbus: Session DBus not running. qt.qpa.theme.dbus: Application will not react to setting changes. Check your DBus installation.
(python3.8:3727): dbind-WARNING **: 11:21:26.074: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. SUCCESS | The GUI seems to work OK INFO | Executable BIDScoin tools: INFO | - bidscoin INFO | - bidscoiner INFO | - bidseditor INFO | - bidsmapper INFO | - bidsparticipants INFO | - deface INFO | - dicomsort INFO | - echocombine INFO | - medeface INFO | - physio2tsv INFO | - plotphysio INFO | - rawmapper INFO | - skullstrip INFO | - slicereport INFO | Installed template bidsmaps (/home/relsayed_local/.bidscoin/4.2.1/templates): INFO | - bidsmap_sst INFO | - bidsmap_dccn (default) INFO | Installed plugins (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins): INFO | - spec2nii2bids INFO | - phys2bidscoin INFO | - pet2bids INFO | - dcm2niix2bids INFO | - nibabel2bids INFO | --------- Testing the 'spec2nii2bids' plugin --------- VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/spec2nii2bids.py' INFO | Testing the spec2nii2bids installation: INFO | Command: spec2nii -v INFO | Output: 0.7.2
SUCCESS | The 'spec2nii2bids' plugin functioned correctly INFO | --------- Testing the 'phys2bidscoin' plugin --------- VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/phys2bidscoin.py' INFO | This is the phys2bids-plugin WIP test routine SUCCESS | The 'phys2bidscoin' plugin functioned correctly INFO | --------- Testing the 'pet2bids' plugin --------- VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/pet2bids.py' INFO | Testing the dcm2niix4pet installation: WARNING | The 'pet2bids' plugin did not function correctly WARNING | Failed test: pet2bids INFO | --------- Testing the 'dcm2niix2bids' plugin --------- VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/dcm2niix2bids.py' ERROR | Could not import /home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/dcm2niix2bids.py: cannot import name 'files' from 'importlib.resources' (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/importlib/resources.py) ERROR | Invalid plugin: 'dcm2niix2bids' WARNING | Failed test: dcm2niix2bids INFO | --------- Testing the 'nibabel2bids' plugin --------- VERBOSE | Importing plugin: '/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/nibabel2bids.py' ERROR | Could not import /home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/site-packages/bidscoin/plugins/nibabel2bids.py: cannot import name 'files' from 'importlib.resources' (/home/relsayed_local/anaconda3/envs/bidscoin-env3.8/lib/python3.8/importlib/resources.py) ERROR | Invalid plugin: 'nibabel2bids' WARNING | Failed test: nibabel2bids WARNING | Not all tests finishd successfully (this may be ok, but check the output above)
To reproduce the dbus errors can be ignored - I am troubleshooting for another user remotely.
bidscoin for this user was setup in an anaconda environment as follows: bash Anaconda3-2023.03-Linux-x86_64.sh source /home/$USER/anaconda3/bin/activate conda init conda config --set auto_activate_base False conda config --add channels conda-forge conda deactivate #exit base conda environment
then run this update line at least twice so it fully updates conda. It should say All requested packages already installed
conda update -n base -c conda-forge conda
Create a conda virtual environment for BIDScoin
conda create python=3.8 -c conda-forge -n bidscoin-env
Activate the virtual environment and install bidscoin inside it
conda activate bidscoin-env pip install bidscoin pip install -U scikit-learn
have tried rebooting pc after these steps then running
bidscoin -t
still get problems
I don't think the issue is caused by the version difference between their bids version and the bidsmap.yaml file - It seems more like importlib.resources isn't playing nice, or is missing something required (whatever 'files' is?)
In a previous commit, https://github.com/Donders-Institute/bidscoin/commit/e55898274fd2f5d68a15afc425d95784e7278cd2 , this importlib.resources files line was added.
my personal user is using an older version of bidscoin (4.0.0) and does not get this error, so I am wondering if something about this previous commit is causing issues?
thanks for your help!