DigitalSlideArchive / HistomicsTK

A Python toolkit for pathology image analysis algorithms.
https://digitalslidearchive.github.io/HistomicsTK/
Apache License 2.0
393 stars 117 forks source link

Problems during installation on linux #898

Closed Naomi1009 closed 1 year ago

Naomi1009 commented 3 years ago

I met the same problem for several times during installation on linux and have no idea how to solve this when I run python -m pip install -e .

_ERROR: Command errored out with exit status 1:
     command: /home/lianqiuyu/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wu2k721r/python-javabridge_5d7b2d8af62842c8875ab526c4ce1bee/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wu2k721r/python-javabridge_5d7b2d8af62842c8875ab526c4ce1bee/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ihuvetlh
         cwd: /tmp/pip-install-wu2k721r/python-javabridge_5d7b2d8af62842c8875ab526c4ce1bee/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-wu2k721r/python-javabridge_5d7b2d8af62842c8875ab526c4ce1bee/setup.py", line 412, in <module>
        ext_modules=ext_modules(),
      File "/tmp/pip-install-wu2k721r/python-javabridge_5d7b2d8af62842c8875ab526c4ce1bee/setup.py", line 142, in ext_modules
        library_dirs = [os.path.dirname(jvm_so)]
      File "/home/lianqiuyu/anaconda3/lib/python3.7/posixpath.py", line 156, in dirname
        p = os.fspath(p)
    TypeError: expected str, bytes or os.PathLike object, not NoneType
    ----------------------------------------_
Naomi1009 commented 3 years ago

image

manthey commented 3 years ago

The tile sources have complex library dependencies. You can either install those libraries via our python wheels by adding --find-links https://girder.github.io/large_image_wheels to the pip install command, install fewer tile sources (by modifying the setup.py requirements, or manually install whatever library versions you prefer.

kheffah commented 3 years ago

Hi @manthey , I have a related, but not quite the same problem. I'm trying to install from source on a new machine and I am getting this error .. seems to stem from CMAKE compilation .. any idea what might be happening? Thanks!

Running setup.py develop for histomicstk
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/opt/mtageld/HistomicsTK/setup.py'"'"'; __file__='"'"'/opt/mtageld/HistomicsTK/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: /opt/mtageld/HistomicsTK/
    Complete output (106 lines):
    Not searching for unused variables given on the command line.
    CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.

    -- The C compiler identification is GNU 7.5.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- The CXX compiler identification is GNU 7.5.0
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /opt/mtageld/HistomicsTK/_cmake_test_compile/build
    -- The C compiler identification is GNU 7.5.0
    -- The CXX compiler identification is GNU 7.5.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: /usr/bin/python (found version "3.8.10")
    -- Found PythonLibs: libpython3.8.a
    -- Found Cython: /tmp/pip-build-env-_b8oxhp6/overlay/bin/cython
    -- Found NumPy: /tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/numpy/core/include (found version "1.20.3")
    -- Performing Test Weak Link MODULE -> SHARED (gnu_ld_ignore) - Success
    _modinit_prefix:PyInit_
    _modinit_prefix:PyInit_
    NUMPY_INCLUDE_DIRS:/tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/numpy/core/include
    _modinit_prefix:PyInit_
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:

        SKBUILD

    -- Build files have been written to: /opt/mtageld/HistomicsTK/_skbuild/linux-x86_64-3.8/cmake-build
    [1/10] Generating CXX source histomicstk/features/_compute_marginal_glcm_probs_cython.cxx
    [2/10] Building CXX object histomicstk/features/CMakeFiles/_compute_marginal_glcm_probs_cython.dir/_compute_marginal_glcm_probs_cython.cxx.o
    FAILED: histomicstk/features/CMakeFiles/_compute_marginal_glcm_probs_cython.dir/_compute_marginal_glcm_probs_cython.cxx.o
    /usr/bin/c++ -D_compute_marginal_glcm_probs_cython_EXPORTS -I/usr/include/python3.8 -I/tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/numpy/core/include -O3 -DNDEBUG -fPIC -MD -MT histomicstk/features/CMakeFiles/_compute_marginal_glcm_probs_cython.dir/_compute_marginal_glcm_probs_cython.cxx.o -MF histomicstk/features/CMakeFiles/_compute_marginal_glcm_probs_cython.dir/_compute_marginal_glcm_probs_cython.cxx.o.d -o histomicstk/features/CMakeFiles/_compute_marginal_glcm_probs_cython.dir/_compute_marginal_glcm_probs_cython.cxx.o -c histomicstk/features/_compute_marginal_glcm_probs_cython.cxx
    histomicstk/features/_compute_marginal_glcm_probs_cython.cxx:6:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    [3/10] Generating CXX source histomicstk/segmentation/nuclear/_max_clustering_cython.cxx
    [4/10] Generating CXX source histomicstk/segmentation/label/_trace_object_boundaries_cython.cxx
    ninja: build stopped: subcommand failed.
      File "/tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 589, in setup
        cmkr.make(make_args, env=env)
      File "/tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/skbuild/cmaker.py", line 496, in make
        raise SKBuildError(
    An error occurred while building with CMake.
      Command:
        cmake --build . --target install --config Release --
      Source directory:
        /opt/mtageld/HistomicsTK
      Working directory:
        /opt/mtageld/HistomicsTK/_skbuild/linux-x86_64-3.8/cmake-build
    Please see CMake's output for more information.

    --------------------------------------------------------------------------------
    -- Trying "Ninja" generator
    --------------------------------
    ---------------------------
    ----------------------
    -----------------
    ------------
    -------
    --
    --
    -------
    ------------
    -----------------
    ----------------------
    ---------------------------
    --------------------------------
    -- Trying "Ninja" generator - success
    --------------------------------------------------------------------------------

    Configuring Project
      Working directory:
        /opt/mtageld/HistomicsTK/_skbuild/linux-x86_64-3.8/cmake-build
      Command:
        cmake /opt/mtageld/HistomicsTK -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/opt/mtageld/HistomicsTK/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.10 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=libpython3.8.a -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-_b8oxhp6/overlay/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release

    Traceback (most recent call last):

    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/opt/mtageld/HistomicsTK/setup.py'"'"'; __file__='"'"'/opt/mtageld/HistomicsTK/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.
The command '/bin/bash -c git clone https://github.com/DigitalSlideArchive/HistomicsTK/ &&     cd HistomicsTK/ &&     python -m pip install setuptools-scm Cython>=0.25.2 scikit-build>=0.8.1         cmake>=0.6.0 numpy>=1.12.1  &&     python -m pip install -e . --find-links https://girder.github.io/large_image_wheels' returned a non-zero code: 1
manthey commented 3 years ago

Since you are building from source, you need to install the python-dev package (in ubuntu -- it is probably named python-devel in CentOS).

kheffah commented 3 years ago

@manthey Thanks. Unfortunately that still did not solve the issue. I'll check if there are any path issues.

kheffah commented 3 years ago

@manthey Thank you, now it's fixed. Turns out I had a specific python version and needed python3.8-dev specifically.