Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compatibility #337

Open
TamerGezici opened this issue Nov 23, 2020 · 7 comments
Open

Windows compatibility #337

TamerGezici opened this issue Nov 23, 2020 · 7 comments

Comments

@TamerGezici
Copy link

Does this work on Windows? I ask because I have SPM and MatLab. I tried adding an environment variable as SPM_DIR (not sure if I did it correct though) and I got these errors when trying the demo scripts:

(data) E:\IBC\pypreprocess\examples\easy_start>python nipype_preproc_spm_auditory.py
Traceback (most recent call last):
  File "nipype_preproc_spm_auditory.py", line 10, in <module>
    from pypreprocess.nipype_preproc_spm_utils import do_subjects_preproc
  File "D:\Anaconda\envs\data\lib\site-packages\pypreprocess\nipype_preproc_spm_utils.py", line 19, in <module>
    from .conf_parser import _generate_preproc_pipeline
  File "D:\Anaconda\envs\data\lib\site-packages\pypreprocess\conf_parser.py", line 19, in <module>
    from .subject_data import SubjectData
  File "D:\Anaconda\envs\data\lib\site-packages\pypreprocess\subject_data.py", line 26, in <module>
    from .reporting.preproc_reporter import (generate_tsdiffana_thumbnail,
  File "D:\Anaconda\envs\data\lib\site-packages\pypreprocess\reporting\preproc_reporter.py", line 26, in <module>
    from ..configure_spm import _configure_spm, _get_version_spm
  File "D:\Anaconda\envs\data\lib\site-packages\pypreprocess\configure_spm.py", line 70, in <module>
    os.path.join(os.environ.get('HOME'),
  File "D:\Anaconda\envs\data\lib\ntpath.py", line 78, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
@TamerGezici
Copy link
Author

TamerGezici commented Nov 23, 2020

I tried the easy_start python scripts on Linux and ran into an error like this:

tamer@tamer-VirtualBox:~/Desktop/IBC/pypreprocess-master/examples/easy_start$ python3 nipype_preproc_spm_auditory.py 
Traceback (most recent call last):
  File "nipype_preproc_spm_auditory.py", line 16, in <module>
    from nilearn.reporting import plot_design_matrix
ImportError: cannot import name 'plot_design_matrix' from 'nilearn.reporting' (/home/tamer/.local/lib/python3.8/site-packages/nilearn/reporting/__init__.py)

nilearn is already installed and seems to import with no issues but I get an error while importing plot_design_matrix

@bthirion
Copy link
Member

You probably need the lastest Nilearn (sorry...)

@swaythe
Copy link
Contributor

swaythe commented Nov 23, 2020

@TamerGezici Thanks for looking into pypreprocess! We currently only maintain it for Linux so I'm not sure if it works on Windows or not.

As for the error you get with Linux, a new nilearn version was released recently and we're updating the nilearn references in pypreprocess. Check back in a couple of days for a working version.

@TamerGezici
Copy link
Author

@swaythe

Thank you for your reply! I will wait for the nilearn update then. Can you please write a warning on the repository's main page about Linux compatibility? That would be much better as I wouldn't have tried it on windows then.

I guess it should be possible to provide SPM script directory directly inside the script (hardcode it) somehow. I searched for SPM_DIR in the repository using Visual Studio Code but failed to find it. If you can point me the exact place SPM_DIR is acquired (as an env variable) maybe I can get it to work on Windows as well.

@swaythe
Copy link
Contributor

swaythe commented Nov 30, 2020

@TamerGezici It's a little later than expected but a working version of pypreprocess is now available. Let me know if you run into any more issues.

@TamerGezici
Copy link
Author

TamerGezici commented Dec 5, 2020

@TamerGezici It's a little later than expected but a working version of pypreprocess is now available. Let me know if you run into any more issues.

Thank you.

I have a new error. Here's the message. If you want I can create a new issue.

Python version: 3.8.5

I think it has something to do with the new Python versions?

tamer@tamer-VirtualBox:~/Desktop/IBC/pypreprocess/examples/easy_start$ python3 nipype_preproc_spm_auditory.py
Using the following parameters for preprocessing:
	spm_dir=None
	matlab_exec=None
	report=True
	dataset_id=/home/tamer/nilearn_data/spm_auditory
	caching=True
	tsdiffana=True
	dataset_description=<a href=http://www.fil.ion.ucl.ac.uk/spm/data/auditory/>SPM Auditory
 (single-subject)</a>

	slice_timing_software=spm
	realign_software=spm
	coregister_software=spm
	smooth_software=spm
	deleteorient=False
	slice_timing=True
	TR=7.0
	TA=TR * (1 - 1 / nslices)
	slice_order=ascending
	interleaved=False
	realign=True
	realign_reslice=False
	register_to_mean=True
	coregister=True
	coregister_reslice=False
	coreg_anat_to_func=False
	segment=True
	newsegment=False
	normalize=False
	func_write_voxel_sizes=[3.0, 3.0, 3.0]
	anat_write_voxel_sizes=[1.0, 1.0, 1.0]
	dartel=False
	output_modulated_tpms=True
	fwhm=[5.0, 5.0, 5.0]
	anat_fwhm=0.0
	dataset_dir=/home/tamer/nilearn_data/spm_auditory
Traceback (most recent call last):
  File "nipype_preproc_spm_auditory.py", line 52, in <module>
    subject_data = do_subjects_preproc(jobfile, dataset_dir=dataset_dir)[0]
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/nipype_preproc_spm_utils.py", line 1754, in do_subjects_preproc
    log = get_dataset_report_log_html_template(
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/reporting/base_reporter.py", line 581, in get_dataset_report_log_html_template
    return _get_template(os.path.join(
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/reporting/base_reporter.py", line 508, in _get_template
    return HTMLTemplate(_text).substitute(**kwargs)
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 179, in substitute
    result, defs, inherit = self._interpret(ns)
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 190, in _interpret
    self._interpret_codes(self._parsed, ns, out=parts, defs=defs)
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 218, in _interpret_codes
    self._interpret_code(item, ns, out, defs)
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 242, in _interpret_code
    out.append(self._repr(base, pos))
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 489, in _repr
    return html_quote(plain)
  File "/home/tamer/.local/lib/python3.8/site-packages/pypreprocess/external/tempita/_tempita.py", line 446, in html_quote
    value = cgi.escape(value, 1)
AttributeError: module 'cgi' has no attribute 'escape'

@bthirion
Copy link
Member

bthirion commented Dec 5, 2020

Thx for reporting.
Well the current reporting module no longer works on any platform. We want to redesign it anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants