open-discussion > SyntaxError: invalid syntax - Munkres
Showing 1-7 of 7 posts
Display:
Results per page:
Jun 15, 2020  02:06 PM | Lorenzo Pini
SyntaxError: invalid syntax - Munkres
Dear all,


I'm using your mICA toolbox with 14 subjects. When I run the reproducibility step the following error occurs:

FATAL ERROR ENCOUNTERED:
COMMAND:
/usr/local/fsl/bin/fsl_sub -N mICASplitHalf_step3 -T 30 -l /home/user/test_mICA/Reproducibility/tmp_log -j 7156 python ./py/ic_corr.py /home/user/test_mICA/Reproducibility 50 4-8
ERROR MESSAGE:
Traceback (most recent call last):
File "./py/ic_corr.py", line 39, in
from munkres import Munkres, make_cost_matrix
File "/usr/local/lib/python2.7/dist-packages/munkres.py", line 79
def pad_matrix(self, matrix: Matrix, pad_value: int=0) -> Matrix:
^
SyntaxError: invalid syntax
END OF ERROR MESSAGE

Any idea about this error?

Thanks,
Lorenzo
Jun 17, 2020  11:06 AM | Jorge Manuel Sánchez - Hannover Medical School
RE: SyntaxError: invalid syntax - Munkres
Dear Lorenzo,

It seems an error when loading the munkres package in Python. You could try upgrading munkres with "pip install --upgrade munkres" and then try again. Let me know if it helped!

Best wishes,

Jorge
Jun 19, 2020  06:06 PM | Lorenzo Pini
RE: SyntaxError: invalid syntax - Munkres
Dear Jorge,

I tried to upgrade munkres as you suggested, but the tool returned the same error.
Do you think it could be a pronlem due to python version?

Any suggestions?

Lorenzo
Jun 20, 2020  04:06 PM | Jorge Manuel Sánchez - Hannover Medical School
RE: SyntaxError: invalid syntax - Munkres
It could be a problem with your Python version. What version are you using? And Munkres?
Do you get the same error if you open the Python-terminal and only try to import munkres ("from munkres import Munkres, make_cost_matrix")?
Jun 23, 2020  06:06 AM | Lorenzo Pini
RE: SyntaxError: invalid syntax - Munkres
I'm using Python 2.7.17, and yes, I got the same error importing munkres from python terminal.
Jun 23, 2020  06:06 AM | Jorge Manuel Sánchez - Hannover Medical School
RE: SyntaxError: invalid syntax - Munkres
In our computers we are using

Python 2.7.6 and Munkres 1.0.8
Python 2.7.12 and Munkres 1.0.12

Looking at the Munkres documentation (http://software.clapper.org/munkres/#get...) I see the following:

"As of version 1.1.0, munkres no longer supports Python 2. If you need to use it with Python 2, install an earlier version (e.g., 1.0.12): pip install munkres==1.0.12"

What version of munkres do you have (pip show munkres)? You could try to install 1.0.12 to see if it works.
Jun 23, 2020  08:06 AM | Lorenzo Pini
RE: SyntaxError: invalid syntax - Munkres
I had Munkres 1.0.2. Now I installed version 1.0.12 and with python 2.7 it works.

Thanks a lot