daducci / AMICO

Accelerated Microstructure Imaging via Convex Optimization (AMICO) from diffusion MRI data
Other
98 stars 62 forks source link

installation problem #164

Open zeffiro opened 1 year ago

zeffiro commented 1 year ago

When attempting to install dMRI-AMICO in Ubuntu I get an error:

tz@ALPINE:/mnt/e$ pip install dmri-amico Defaulting to user installation because normal site-packages is not writeable Collecting dmri-amico Using cached dmri_amico-1.5.4-py3-none-any.whl Collecting dipy>=1.0 (from dmri-amico) Using cached dipy-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB) Collecting joblib>=1.0.1 (from dmri-amico) Using cached joblib-1.2.0-py3-none-any.whl (297 kB) Requirement already satisfied: numpy>=1.12 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.24.3) Collecting packaging (from dmri-amico) Using cached packaging-23.1-py3-none-any.whl (48 kB) Requirement already satisfied: scipy>=1.0 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.10.1) Collecting spams>=2.6.5.2 (from dmri-amico) Using cached spams-2.6.5.4.tar.gz (2.0 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting tqdm>=4.56.0 (from dmri-amico) Using cached tqdm-4.65.0-py3-none-any.whl (77 kB) Collecting nibabel>=3.0.0 (from dipy>=1.0->dmri-amico) Using cached nibabel-5.1.0-py3-none-any.whl (3.3 MB) Collecting h5py>=2.8.0 (from dipy>=1.0->dmri-amico) Using cached h5py-3.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB) Collecting Pillow>=6.0 (from spams>=2.6.5.2->dmri-amico) Using cached Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB) Building wheels for collected packages: spams Building wheel for spams (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for spams (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [214 lines of output] running bdist_wheel running build running build_py creating build ..... Have you seen this before?

nightwnvol commented 1 year ago

Hi @zeffiro,

The problem is related to the installation of the spams package. I would need the full log to catch the error, but usually it fails because the spams package needs a BLAS/LAPACK library installed on your system.

Try running sudo apt install libblas-dev liblapack-dev gfortran, then try reinstalling AMICO.

Let me know if this solve your issue.

zeffiro commented 1 year ago

I started again from a fresh Ubuntu-22.04 install in WSL2. I also installed the Visual C++ package. This time I got no error until I started python and tried to import AMICO.

tz@ALPINE:/mnt/e$ sudo apt install libblas-dev liblapack-dev gfortran Reading package lists... Done Building dependency tree... Done Reading state information... Done gfortran is already the newest version (4:11.2.0-1ubuntu1). libblas-dev is already the newest version (3.10.0-2ubuntu1). liblapack-dev is already the newest version (3.10.0-2ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. tz@ALPINE:/mnt/e$ pip install dmri-amico Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: dmri-amico in /usr/local/lib/python3.10/dist-packages (1.5.4) Requirement already satisfied: dipy>=1.0 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.7.0) Requirement already satisfied: joblib>=1.0.1 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.2.0) Requirement already satisfied: numpy>=1.12 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.24.3) Requirement already satisfied: packaging in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (23.1) Requirement already satisfied: scipy>=1.0 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (1.10.1) Requirement already satisfied: spams>=2.6.5.2 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (2.6.5.4) Requirement already satisfied: tqdm>=4.56.0 in /home/tz/.local/lib/python3.10/site-packages (from dmri-amico) (4.65.0) Requirement already satisfied: nibabel>=3.0.0 in /home/tz/.local/lib/python3.10/site-packages (from dipy>=1.0->dmri-amico) (5.1.0) Requirement already satisfied: h5py>=2.8.0 in /home/tz/.local/lib/python3.10/site-packages (from dipy>=1.0->dmri-amico) (3.8.0) Requirement already satisfied: Pillow>=6.0 in /home/tz/.local/lib/python3.10/site-packages (from spams>=2.6.5.2->dmri-amico) (9.5.0) tz@ALPINE:/mnt/e$ python3 amico python3: can't open file '/mnt/e/amico': [Errno 2] No such file or directory tz@ALPINE:/mnt/e$ python3 Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import amico Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.10/dist-packages/amico/init.py", line 3, in from .core import Evaluation, setup File "/usr/local/lib/python3.10/dist-packages/amico/core.py", line 16, in import amico.models File "/usr/local/lib/python3.10/dist-packages/amico/models.py", line 20, in import spams File "/home/tz/.local/lib/python3.10/site-packages/spams/init.py", line 6, in from .spams import File "/home/tz/.local/lib/python3.10/site-packages/spams/spams.py", line 6, in import spams_wrap File "/home/tz/.local/lib/python3.10/site-packages/spams_wrap/init.py", line 6, in from .spams_wrap import File "/home/tz/.local/lib/python3.10/site-packages/spams_wrap/spams_wrap.py", line 193, in _spams_wrap.L1COEFFS_swigconstant(_spams_wrap) AttributeError: module '_spams_wrap' has no attribute 'L1COEFFS_swigconstant'

nightwnvol commented 1 year ago

@zeffiro, this time it seems that the spams package has some problems (although the installation succeeded without errors).

I would suggest you to reinstall AMICO forcing the reinstallation of all its requirements: pip install dmri-amico --no-cache-dir --force-reinstall

zeffiro commented 1 year ago

I tried that, but got the same problem when I tried to import AMICO. Any other suggestions?

tz@ALPINE:/mnt/e$ pip install dmri-amico --no-cache-dir --force-reinstall Defaulting to user installation because normal site-packages is not writeable Collecting dmri-amico Downloading dmri-amico-1.5.4.tar.gz (3.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 19.4 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting packaging (from dmri-amico) Downloading packaging-23.1-py3-none-any.whl (48 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 725.9 MB/s eta 0:00:00 Collecting numpy>=1.12 (from dmri-amico) Downloading numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 89.9 MB/s eta 0:00:00 Collecting scipy>=1.0 (from dmri-amico) Downloading scipy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 34.4/34.4 MB 61.2 MB/s eta 0:00:00 Collecting dipy>=1.0 (from dmri-amico) Downloading dipy-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.7/8.7 MB 63.1 MB/s eta 0:00:00 Collecting spams>=2.6.5.2 (from dmri-amico) Downloading spams-2.6.5.4.tar.gz (2.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 68.0 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting tqdm>=4.56.0 (from dmri-amico) Downloading tqdm-4.65.0-py3-none-any.whl (77 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.1/77.1 kB 744.4 MB/s eta 0:00:00 Collecting joblib>=1.0.1 (from dmri-amico) Downloading joblib-1.2.0-py3-none-any.whl (297 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 298.0/298.0 kB 197.7 MB/s eta 0:00:00 Collecting nibabel>=3.0.0 (from dipy>=1.0->dmri-amico) Downloading nibabel-5.1.0-py3-none-any.whl (3.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 86.8 MB/s eta 0:00:00 Collecting h5py>=2.8.0 (from dipy>=1.0->dmri-amico) Downloading h5py-3.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.6/4.6 MB 85.4 MB/s eta 0:00:00 Collecting Pillow>=6.0 (from spams>=2.6.5.2->dmri-amico) Downloading Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 88.2 MB/s eta 0:00:00 Building wheels for collected packages: dmri-amico, spams Building wheel for dmri-amico (setup.py) ... done Created wheel for dmri-amico: filename=dmri_amico-1.5.4-py3-none-any.whl size=3032985 sha256=8e5cf0b5085769a93b03fd0832399a87b8abb0e282869f95e926a650871d9a6b Stored in directory: /tmp/pip-ephem-wheel-cache-b7428whp/wheels/d8/ba/fb/d28ad0beb0bcfa570169a7e871483a8d70d8c991d29ba35d69 Building wheel for spams (pyproject.toml) ... done Created wheel for spams: filename=spams-2.6.5.4-cp310-cp310-linux_x86_64.whl size=3931429 sha256=80f90066eb7161d4aedb1b649bc5fe8c6b15b1a09eff279491f244b3de013b21 Stored in directory: /tmp/pip-ephem-wheel-cache-b7428whp/wheels/67/9d/1f/60a6c60785b07ad4f087297f04b723e665a97afcd5112ffb06 Successfully built dmri-amico spams Installing collected packages: tqdm, Pillow, packaging, numpy, joblib, scipy, nibabel, h5py, spams, dipy, dmri-amico Attempting uninstall: tqdm Found existing installation: tqdm 4.65.0 Uninstalling tqdm-4.65.0: Successfully uninstalled tqdm-4.65.0 Attempting uninstall: Pillow Found existing installation: Pillow 9.5.0 Uninstalling Pillow-9.5.0: Successfully uninstalled Pillow-9.5.0 Attempting uninstall: packaging Found existing installation: packaging 23.1 Uninstalling packaging-23.1: Successfully uninstalled packaging-23.1 Attempting uninstall: numpy Found existing installation: numpy 1.24.3 Uninstalling numpy-1.24.3: Successfully uninstalled numpy-1.24.3 Attempting uninstall: joblib Found existing installation: joblib 1.2.0 Uninstalling joblib-1.2.0: Successfully uninstalled joblib-1.2.0 Attempting uninstall: scipy Found existing installation: scipy 1.10.1 Uninstalling scipy-1.10.1: Successfully uninstalled scipy-1.10.1 Attempting uninstall: nibabel Found existing installation: nibabel 5.1.0 Uninstalling nibabel-5.1.0: Successfully uninstalled nibabel-5.1.0 Attempting uninstall: h5py Found existing installation: h5py 3.8.0 Uninstalling h5py-3.8.0: Successfully uninstalled h5py-3.8.0 Attempting uninstall: spams Found existing installation: spams 2.6.5.4 Uninstalling spams-2.6.5.4: Successfully uninstalled spams-2.6.5.4 Attempting uninstall: dipy Found existing installation: dipy 1.7.0 Uninstalling dipy-1.7.0: Successfully uninstalled dipy-1.7.0 Successfully installed Pillow-9.5.0 dipy-1.7.0 dmri-amico-1.5.4 h5py-3.8.0 joblib-1.2.0 nibabel-5.1.0 numpy-1.24.3 packaging-23.1 scipy-1.10.1 spams-2.6.5.4 tqdm-4.65.0 tz@ALPINE:/mnt/e$ python3 Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import amico Traceback (most recent call last): File "", line 1, in File "/home/tz/.local/lib/python3.10/site-packages/amico/init.py", line 3, in from .core import Evaluation, setup File "/home/tz/.local/lib/python3.10/site-packages/amico/core.py", line 16, in import amico.models File "/home/tz/.local/lib/python3.10/site-packages/amico/models.py", line 20, in import spams File "/home/tz/.local/lib/python3.10/site-packages/spams/init.py", line 6, in from .spams import File "/home/tz/.local/lib/python3.10/site-packages/spams/spams.py", line 6, in import spams_wrap File "/home/tz/.local/lib/python3.10/site-packages/spams_wrap/init.py", line 6, in from .spams_wrap import File "/home/tz/.local/lib/python3.10/site-packages/spams_wrap/spams_wrap.py", line 193, in _spams_wrap.L1COEFFS_swigconstant(_spams_wrap) AttributeError: module '_spams_wrap' has no attribute 'L1COEFFS_swigconstant'

For the moment I have the older MATLAB version running smoothly, but I would like to transition to the python version if possible. Thanks for the help..

nightwnvol commented 1 year ago

Have you tried installing it in a virtual environment?

Try the following steps:

daducci commented 1 year ago

I suspect 'pip' and 'python3' do not point to the same Python installation, i.e. 'pip' actually installing all packages in a different Python installation than the one pointed by the 'python3' command.

nightwnvol commented 9 months ago

Hi @zeffiro,

We've just released AMICO v2.0 and have published pre-built wheels on PyPI for both Windows and Linux systems. You should no longer encounter installation problems.

To install the new version, simply run pip install --upgrade dmri-amico.