Donders-Institute / bidscoin

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

No module named 'pytest' while executing bidsmapper #193

Closed mateuszpawlik closed 1 year ago

mateuszpawlik commented 1 year ago

Describe the bug When executing bidsmapper I get No module named 'pytest' error. I see pytest in the optional dependencies.

To reproduce Steps to reproduce the behavior:

  1. Execute bidsmapper
  2. See error in the bidsmapper.log:
    ERROR | Could not import /root/.local/pipx/venvs/bidscoin/lib/python3.11/site-packages/bidscoin/plugins/dcm2niix2bids.py: No module named 'pytest'

Expected behavior I guess pytest should be installed as a dependency and the error shouldn't then happen.

Software version

mateuszpawlik commented 1 year ago

Maybe pipx causes troubles.

marcelzwiers commented 1 year ago

Thanks for reporting this, I will look into it when I am back from my holidays (the 10th of August)...


Sent from my phone

Op do 27 jul. 2023 19:17 schreef Mateusz Pawlik @.***>:

Maybe pipx causes troubles.

— Reply to this email directly, view it on GitHub https://github.com/Donders-Institute/bidscoin/issues/193#issuecomment-1654060338, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTUGL5JOHQMSZ7CQ4TPA3TXSKPCFANCNFSM6AAAAAA22K7VUM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mateuszpawlik commented 1 year ago

I used pipx to install BIDScoin in a Docker container. This is a recommended way to install Python applications by, for example, Debian 12. pipx creates a virtual environment in which it installs the application and all its Python dependencies. My guess is, pipx didn't know about the pytest dependency.

pipx kindly allows to install manually (pipx inject command) a missing module. Executing pipx inject bidscoin pytest solved the problem for me.

marcelzwiers commented 1 year ago

Mhhh, pytest is no longer used in bidscoin, but only when running bidscoin tests:

https://github.com/search?q=repo%3ADonders-Institute%2Fbidscoin%20%22import%20pytest%22&type=code

But this line in the dcm2niix2bids plugin has a pytest dependency, for which I now added a work-around (e55898274fd2f5d68a15afc425d95784e7278cd2). Does this solve your error?

mateuszpawlik commented 1 year ago

It seems to be fine now. I installed BIDScoin with pipx install git+https://github.com/Donders-Institute/bidscoin.git@e558982 and executed it. There were no complaints on pytest missing.

mateuszpawlik commented 1 year ago

Btw. pipx allows for a very quick installation and testing :-)