billbrod/spatial-frequency-preferences

Neuropythy version 0.9.3 not compatible with six anymore

Closed this issue · 0 comments

[Issue]

I remember the neuropythy version defined in the environment.yml worked well without any issue, but for some reason when I tried toimport sfpor run the snakemake's figure generating rules, it threw an error saying:


import neuropythy as ny
Traceback (most recent call last):
  File "/Users/jh7685/opt/miniconda3/envs/sfp/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-63-f78909f49e8c>", line 1, in <module>
    import neuropythy as ny
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jh7685/opt/miniconda3/envs/sfp/lib/python3.7/site-packages/neuropythy/__init__.py", line 64, in <module>
    from   .util       import (config, is_image, library_path, to_affine, is_address, address_data,
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jh7685/opt/miniconda3/envs/sfp/lib/python3.7/site-packages/neuropythy/util/__init__.py", line 5, in <module>
    from .core     import (ObjectWithMetaData, normalize, denormalize,
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/jh7685/opt/miniconda3/envs/sfp/lib/python3.7/site-packages/neuropythy/util/core.py", line 19, in <module>
    default_rtol = inspect.getargspec(np.isclose)[3][0]
TypeError: 'NoneType' object is not subscriptable
ny.__version__
Traceback (most recent call last):
  File "/Users/jh7685/opt/miniconda3/envs/sfp/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-64-44fa4c916004>", line 1, in <module>

[Trouble shooting]

This error seemed to happen when neuropythy tries to import six in its util/core.py.
The version of the six package that was not compatible with neuropythy==0.9.3 was:

import six
six.__version__
Out[66]: ‘1.16.0’

Luckily another conda environment of mine was able to run neuropythy without any problem, so I checked their versions too:

$ conda activate vwm
(vwm)
jh7685 at jwlab05m in ~/Documents/Github/hcp-annot-vc/code (main●●)
$ python
Python 3.8.13 (default, Mar 28 2022, 06:16:26)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import neuropythy as ny
>>> ny.__version__
‘0.12.6’
>>> import six
>>> six.__version__
‘1.16.0’
>>>

which shows the same version of six like the sfp environment's.

[Fix]

So, I upgraded neuropythy using pip command like pip install --upgrade neuropythy==0.12.6 and it started to work again.