GithubHelp home page GithubHelp logo

Comments (8)

loli avatar loli commented on June 20, 2024 1

Note to myself: Get the installation script to correctly identify the name of the shared libboost_python lib.

from medpy.

loli avatar loli commented on June 20, 2024

You can take a look at the logs of the installation process with:

pip install medpy --no-cache-dir --log LOG_FILE

Just remember to uninstall medpy before. And the --no-cache-dir flag is required to get pip to re-compile the medpy package from scratch.

Medpy is set up such that it will try to compile the graphcut extension. But when it fails at the task, it simply installs without it. In the logs you should see the failed compilation marked by the following lines:

2021-06-30T11:07:32,684   ***************************************************************************
2021-06-30T11:07:32,685   WARNING: The medpy.graphcut.maxflow external C++ package could not be compiled, all graphcut functionality will be disabled. You might be missing Boost.Python or some build essentials like g++.
2021-06-30T11:07:32,685   Failure information, if any, is above.
2021-06-30T11:07:32,685   I'm retrying the build without the graphcut C++ module now.
2021-06-30T11:07:32,685   ***************************************************************************

The error should be detailed in the lines just above.

One thing to look out for is to use Python 3. Ubuntu 20.04LTS still uses Python 2.7 as default, but supports Python 3. You can e.g. install medpy in a virtual environment.

Alternatively, there might be a problem with the linking of the (lib)boost_python3 lib. There are some inconsistent naming conventions around that medpy sometimes misses. At my local machine, the boost python package creates libboost_python38.so under /usr/lib/x86_64-linux-gnu, but medpy looks for a generic libboost_python3.so. This can be solved by entering the directory and creating a softlink with

sudo ln -s libboost_python38.so libboost_python3.so

Hope one of these solves your problems.

from medpy.

matthewdeancooper avatar matthewdeancooper commented on June 20, 2024

You were correct that libboost_python38.so was the only file present in /usr/lib/x86_64-linux-gnu/libboost_python*

After creating the symbolic link as outlined above i managed to get the import working. It would be nice fix for the 1.0.0 release as sudo ln -s requires containerisation in HPC environments.

However, pip install medpy --no-cache-dir was not successful.

Instead, use pip install medpy --no-cache-dir --force-reinstall.

Thanks for your help.

from medpy.

matthewdeancooper avatar matthewdeancooper commented on June 20, 2024

Does medpy currently support CentOS 7?

I have installed the deps

yum install -y \
        gcc \
        gcc-c++ \
        kernel-devel \
        make \
        boost \
        boost-devel \
        boost-doc \
        boost-python \

And created a symbolic link as follows

ln -s /lib64/libboost_python.so /lib64/libboost_python3.so

Installing medpy in a conda py38 environment

pip install --upgrade pip && pip install --no-cache-dir --force-reinstall \
        medpy

I receive the following output after installation

>>> import medpy.graphcut
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/medpy/graphcut/__init__.py", line 200, in <module>
    from .maxflow import GraphDouble, GraphFloat, GraphInt # this always triggers an error in Eclipse, but is right
ImportError: /opt/conda/lib/python3.8/site-packages/medpy/graphcut/maxflow.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

Again, I appreciate your help.

from medpy.

matthewdeancooper avatar matthewdeancooper commented on June 20, 2024

Ah, im suspecting that the CentOS install only included python2.so files for boost.

from medpy.

matthewdeancooper avatar matthewdeancooper commented on June 20, 2024

For others looking for a CentOS 7 solution. Yum does not include the python3 libs by default. You will need to add the epel repo to access them.

yum install epel-release -y \
    && yum repolist -y \
    && yum install -y \
        gcc \
        gcc-c++ \
        kernel-devel \
        make \
        boost*

This includes the correct file /lib64/libboost_python3.so that is discoverable by medpy without the need for a symbolic link.

from medpy.

loli avatar loli commented on June 20, 2024

Thanks for all the work on CentOs!

from medpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.