CyclotronResearchCentre / bidsme

Flexible bidsificator for multimodal datasets
GNU General Public License v2.0
8 stars 2 forks source link

bidsme installation #15

Closed Gluck-ABHA closed 2 months ago

Gluck-ABHA commented 4 months ago

Dear tool developers, We encountered a problem when installing bidsme toolkit: when installing, it requires a Python version of <3.8 and >3.11, but we have tried 3.8, 3.9, and 3.10 versions and could not install the tool. could please provide us with a solution? Thank you for your assistance in advance. Kind regards MRI team-Gluck Lab

ChristophePhillips commented 4 months ago

Dear @Gluck-ABHA ,

@nbeliy , the main developer and maintainer of bidsme is currently on holiday and will only be back in 2 weeks... Do not hesitate to ping him again later this month.

Best

nbeliy commented 4 months ago

Dear @Gluck-ABHA, can you tell me how did you try to install and if there were some errors or warnings?

Can you also tell me the OS you are using and if you use any virtual environments (conda, venv ets.)?

Normally, with pip bidsme should be installable for 3.8, 3.9, and 3.10; in github I did integration tests for all these versions.

As Christophe said, I'm on holiday, so I can't reply very often.

Gluck-ABHA commented 3 months ago

Hello, sorry for the late reply!

We tried installing in Windows 11 and in Ubuntu 22.04 (using WSL2). In both we made a conda virtual environment with python version 3.10.14, activated the environment and installed using pip with the command listed on the README:

python3 -m pip install git+https://github.com/CyclotronResearchCentre/bidsme.git

Importing bidsme in both a notebook or in an interactive python session yields the following error:

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Looking at the traceback it seems like it must be something about pandas. We tried just importing pandas and it also produces the same error. We have other conda environments which run pandas fine, so we don't think it is a problem with miniconda or the OS. Here's the full output of the cell:

{
    "name": "ValueError",
    "message": "numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject",
    "stack": "---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[5], line 1
----> 1 import bidsme

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/__init__.py:1
----> 1 from .main import init, main
      2 from .prepare import prepare
      3 from .mapper import mapper

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/main.py:34
     31 import bidsschematools as bst
     33 from bidsme import exceptions
---> 34 from bidsme.prepare import prepare
     35 from bidsme.process import process
     36 from bidsme.bidsify import bidsify

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/prepare.py:31
     28 import logging
     30 from bidsme import exceptions
---> 31 from bidsme import plugins
     32 from bidsme import Modules
     34 from bidsme.tools import tools

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/plugins/__init__.py:1
----> 1 from .plugins import ImportPlugins, InitPlugin, RunPlugin
      2 from .entry_points import entry_points
      3 from . import exceptions

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/plugins/plugins.py:31
     28 import importlib.util
     29 import logging
---> 31 from bidsme.tools.tools import check_type
     33 from . import exceptions
     34 from .entry_points import entry_points

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/bidsme/tools/tools.py:31
     28 import glob
     29 import logging
---> 31 import pandas
     32 import json
     34 logger = logging.getLogger(__name__)

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/__init__.py:22
     19 del hard_dependencies, dependency, missing_dependencies
     21 # numpy compat
---> 22 from pandas.compat import is_numpy_dev as _is_numpy_dev
     24 try:
     25     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/compat/__init__.py:15
     12 import sys
     14 from pandas._typing import F
---> 15 from pandas.compat.numpy import (
     16     is_numpy_dev,
     17     np_version_under1p19,
     18     np_version_under1p20,
     19 )
     20 from pandas.compat.pyarrow import (
     21     pa_version_under1p01,
     22     pa_version_under2p0,
     23     pa_version_under3p0,
     24     pa_version_under4p0,
     25 )
     27 PY39 = sys.version_info >= (3, 9)

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/compat/numpy/__init__.py:4
      1 \"\"\" support numpy compatibility across versions \"\"\"
      2 import numpy as np
----> 4 from pandas.util.version import Version
      6 # numpy versioning
      7 _np_version = np.__version__

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/util/__init__.py:1
----> 1 from pandas.util._decorators import (  # noqa:F401
      2     Appender,
      3     Substitution,
      4     cache_readonly,
      5 )
      7 from pandas.core.util.hashing import (  # noqa:F401
      8     hash_array,
      9     hash_pandas_object,
     10 )
     13 def __getattr__(name):

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/util/_decorators.py:14
      6 from typing import (
      7     Any,
      8     Callable,
      9     Mapping,
     10     cast,
     11 )
     12 import warnings
---> 14 from pandas._libs.properties import cache_readonly  # noqa:F401
     15 from pandas._typing import F
     18 def deprecate(
     19     name: str,
     20     alternative: Callable[..., Any],
   (...)
     25     msg: str | None = None,
     26 ) -> Callable[[F], F]:

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/_libs/__init__.py:13
      1 __all__ = [
      2     \"NaT\",
      3     \"NaTType\",
   (...)
      9     \"Interval\",
     10 ]
---> 13 from pandas._libs.interval import Interval
     14 from pandas._libs.tslibs import (
     15     NaT,
     16     NaTType,
   (...)
     21     iNaT,
     22 )

File ~/miniconda3/envs/bidsme_env/lib/python3.10/site-packages/pandas/_libs/interval.pyx:1, in init pandas._libs.interval()

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject"
}
nbeliy commented 3 months ago

Dear @Gluck-ABHA

I never encounter such issue, it seems to come from version of pandas and/or numpy version conflict. Can you please send me a pip freeze of your environment (and conda list, as you use conda)?

I'll look at this this (or maybe next) week.

nbeliy commented 3 months ago

It was the issue of numpy, and apparently it's not the first time it happens.

Forcing the installation of numpy 1.26.4 (latest before 2.0) fixes the issue. I'm working on patching bidsme with constrain of numpy version.

Gluck-ABHA commented 2 months ago

The fix worked great! Thank you very much!