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

could not install on ubuntu 18.04 due to LaPy error #123

Closed
pieper opened this issue Mar 20, 2022 · 10 comments
Closed

could not install on ubuntu 18.04 due to LaPy error #123

pieper opened this issue Mar 20, 2022 · 10 comments

Comments

@pieper
Copy link

pieper commented Mar 20, 2022

Description

The pip install step failed with this error:

Collecting lapy@ git+https://github.com/Deep-MI/LaPy.git (from -r requirements.txt (line 19))
  Could not find a version that satisfies the requirement lapy@ git+https://github.com/Deep-MI/LaPy.git (from -r requirements.txt (line 19)) (from versions: )
No matching distribution found for lapy@ git+https://github.com/Deep-MI/LaPy.git (from -r requirements.txt (line 19))

Steps to Reproduce

Starting with a fresh 18.04 instance running on a google cloud VM.

sudo apt-get install python3-pip
git clone https://github.com/Deep-MI/FastSurfer.git
cd FastSurfer/
pip3 install -r requirements.txt 

Results in the error above.

Expected Behavior

I'd like to be able to run on this or a similar OS on a VM.

Environment

This is the most recent commit of FastSurfer.

commit 6724ae0039621282dd72523d167db2fb6e12d708 (HEAD -> master, origin/master, origin/HEAD)
Merge: 98bda9c cb85b6f
Author: LeHenschel <31760921+LeHenschel@users.noreply.github.com>
Date:   Fri Mar 18 11:00:50 2022 +0100

    Merge pull request #122 from Deep-MI/fix-sphere_reg
    
    Fix for missing label directory in sphere reg fix
@m-reuter
Copy link
Member

Hmm, we'll take a look. In the meantime you could try conda instead (similar to how we do it in the docker): https://github.com/Deep-MI/FastSurfer/blob/6724ae0039621282dd72523d167db2fb6e12d708/Docker/Dockerfile

@m-reuter m-reuter added the needs-repro Still needs to be reproduced label Mar 20, 2022
@pieper
Copy link
Author

pieper commented Mar 20, 2022

Thank you for the quick response 👍

I tried:

pip3 install numpy
pip3 install cython
python3 -m pip install -U git+https://github.com/Deep-MI/LaPy.git#egg=lapy

but ended up with this error:

    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isksparse -I/home/pieper/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/include/suitesparse -I/usr/include/python3.6m -c sksparse/cholmod.c -o build/temp.linux-x86_64-3.6/sksparse/cholmod.o
    In file included from /home/pieper/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
                     from /home/pieper/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /home/pieper/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from sksparse/cholmod.c:713:
    /home/pieper/.local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    In file included from sksparse/cholmod.c:718:0:
    sksparse/cholmod_backward_compatible.h:1:10: fatal error: cholmod.h: No such file or directory
     #include "cholmod.h"
              ^~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ltmn0c_6/scikit-sparse/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-m_o2fi56-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-ltmn0c_6/scikit-sparse/

I'll try using the docker version for now as a workaround.

@LeHenschel
Copy link
Member

LeHenschel commented Mar 21, 2022

Hey,

the error occurs because scikit-sparse needs numpy and scipy pre-installed. Scikit-sparse is a dependency in lapy. If you install it with pip like this, it should work:

python3 -m pip install setuptools # (if not pre-installed inside the virtualenv)
python3 -m pip install numpy scipy cython
python3 -m pip install -U git+https://github.com/Deep-MI/LaPy.git#egg=lapy
python3 -m pip install -r requirements.txt # other FastSurfer requirements

or alternatively for FastSurfer as a whole:

  1. Change the lapy line in the requirements.txt to git+https://github.com/Deep-MI/LaPy.git#egg=lapy
  2. Install setuptools, numpy, scipy and cython
python3 -m pip install setuptools # (if not pre-installed inside the virtualenv)
python3 -m pip install numpy scipy cython
  1. Install FastSurfer dependencies via requirements.txt
python3 -m pip install -r requirements.txt

@pieper
Copy link
Author

pieper commented Mar 21, 2022

Thanks for your help with this.

If I run this the lapy build works:

python3 -m pip install setuptools
python3 -m pip install numpy scipy
python3 -m pip install -U git+https://github.com/Deep-MI/LaPy.git#egg=lapy

But this in requirements.txt

lapy @ git+https://github.com/Deep-MI/LaPy.git#egg=lapy

still leads to this error

Collecting lapy@ git+https://github.com/Deep-MI/LaPy.git#egg=lapy (from -r requirements.txt (line 19))
  Could not find a version that satisfies the requirement lapy@ git+https://github.com/Deep-MI/LaPy.git#egg=lapy (from -r requirements.txt (line 19)) (from versions: )
No matching distribution found for lapy@ git+https://github.com/Deep-MI/LaPy.git#egg=lapy (from -r requirements.txt (line 19))

If I install lapy outside of requirements.txt and then comment it out of requirements.txt the rest installs fine.

Once I do that it seems to be running fine. I was able to use the docker version, so the native install isn't critical for me, but I'll leave this open in case someone knows how to fix the requirements.txt.

@m-reuter
Copy link
Member

We have updated LaPy (see Deep-MI/LaPy#7 ) and removed the scikit-sparse requirement there to avoid setting off pip. Installing with conda should have worked. If users want to use the faster Cholmod method, they need to install scikit-sparse in a separate step after numpy and scipy. Otherwise the code will fall back to LU decomposition which is a little slower. FastSurfer currently always request LU decomposition for consistency and to remove the indirect scikit-sparse dependency (see #124 ).

@af-a
Copy link
Contributor

af-a commented Mar 21, 2022

The requirements.txt issue might be resolved by upgrading your pip version (for e.g. using pip install --upgrade pip).

I could only reproduce the error with a fairly old pip version (9.0.1). It seems like the older versions somehow do not support the syntax used in the line:

lapy @ git+https://github.com/Deep-MI/LaPy.git#egg=lapy

@pieper
Copy link
Author

pieper commented Mar 21, 2022

Yes, I used the default python3-pip for ubuntu 18.04.

$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

@m-reuter m-reuter removed the needs-repro Still needs to be reproduced label Mar 22, 2022
@m-reuter
Copy link
Member

The problem is that the requirements file gets automatically created, so I think we do not have a way to change that line to be compatible to older pip versions?
This means users have to upgrade their pip ? If that (and the merge above) fixes it, we can close this issue.

@pieper
Copy link
Author

pieper commented Mar 22, 2022

Yes, probably it's enough to specify in the readme a minimum version of pip that must be used. I don't know if it's possible, but it seems like you should be able to specify the pip version in requirements.txt.

@m-reuter
Copy link
Member

I think that will not work, as the pip version in requirements is going to be installed together with all other requirements (so they are installed by the old version of pip).
I added text to readme that one should first upgrade pip.

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

4 participants