Giter Club home page Giter Club logo

Comments (8)

loli avatar loli commented on May 24, 2024

Mhh... since you found the .so file, the graphcut module compiled correctly. Why its not in the right location, I can't figure out right now (no access to my dev PC). Could you tell me with what command you installed MedPy? In develop mode? To user or system-wide library?

The follow up error seems to indicate that enery_label.py is missing. Can you find the file in the directory? But again, the search path seems to be the git clone, rather than the library path, which is strange.

Its unlikely, but from which folder are you trying to load MedPy? Its not /Users/<myusername>/medpy/ or a folder under this, is it? In such a case, the local python structure could shadow the global MedPy installation.

Please let me know the details and I'll try to help ypu further.

In general, the MedPy versions in the repository can be unstable and contain bugs. If you want to be on the save side, MedPy 0.2.2 is your right choice, although that version lacks much of the functionality found in the branch leading to the 0.3.0 release (whenever I find the time).

Best,
loli

from medpy.

sssomani avatar sssomani commented on May 24, 2024

For sure!

I installed MedPy using 'git clone...', and then 'python setup.py install' to my system-wide package directory ("//anaconda/lib").

Yes, I can find the 'energy_label.py' in the directory (both in the git clone directory and the installed package directory).

I'm loading MedPy from my 'anaconda/lib/python3.5/site-packages' directory.

With MedPy 0.2.2, I was still getting the same 'energy_label.py' problem :(

Hope some of this information helps! Happy to share anything else you may need.

from medpy.

loli avatar loli commented on May 24, 2024

I've looked into the matter and it seems to be largely a Python3 associated problem.

You might try to change the includes in medpy/graphcut/__init__.py to import .energy_label.py. But I won't promise anything.

MedPy has been designed for Python2, not for for Python3. Most parts should be portable, but some are not. There are many issues connected with the version upgrade.

During my testing right now, I e.g. figured out that the compilation of the maxflow module is done with libboost_python2 instead of libboost_python3 (whyever). Hence even if you manage to fix the import, it might not work!

I would suggest that you switch your anaconda to python2.7 (which should be easy, according to their page) and then install MedPy (whichever version you want) again. This will hopefully solve all your problems.

from medpy.

loli avatar loli commented on May 24, 2024

Notes to myself

Beside the import (@see here) there seems to be a libboost issue when compiling maxflow

Libboost and Python3 + Python2 problem
@see here
Compiling works with:
g++ maxflow.cpp wrapper.cpp graph.cpp -I/usr/include/python3.4m/ -I/usr/include/boost/ -lboost_python-py34 -lpython3.4m -o maxflow.so -shared -fPIC
Should be:
g++ maxflow.cpp wrapper.cpp graph.cpp -I/usr/include/python3.4m/ -I/usr/include/boost/ -lboost_python3 -lpython3.4m -o maxflow.so -shared -fPIC
And MedPy currently uses something like:
g++ maxflow.cpp wrapper.cpp graph.cpp -I/usr/include/python/ -I/usr/include/boost/ -lboost_python -lpython -o maxflow.so -shared -fPIC
which links against Python2, it seems.

from medpy.

loli avatar loli commented on May 24, 2024

The setup.py produces currently

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMAJOR_VERSION=0 -DMINOR_VERSION=1 -I/usr/include/python3.5m -I/home/loli/Workspace/python/medpy_release/python3/envp3/include/python3.5m -c lib/maxflow/src/maxflow.cpp -o build/temp.linux-x86_64-3.5/lib/maxflow/src/maxflow.o -O0

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMAJOR_VERSION=0 -DMINOR_VERSION=1 -I/usr/include/python3.5m -I/home/loli/Workspace/python/medpy_release/python3/envp3/include/python3.5m -c lib/maxflow/src/wrapper.cpp -o build/temp.linux-x86_64-3.5/lib/maxflow/src/wrapper.o -O0

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMAJOR_VERSION=0 -DMINOR_VERSION=1 -I/usr/include/python3.5m -I/home/loli/Workspace/python/medpy_release/python3/envp3/include/python3.5m -c lib/maxflow/src/graph.cpp -o build/temp.linux-x86_64-3.5/lib/maxflow/src/graph.o -O0

x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/lib/maxflow/src/maxflow.o build/temp.linux-x86_64-3.5/lib/maxflow/src/wrapper.o build/temp.linux-x86_64-3.5/lib/maxflow/src/graph.o -lboost_python -o build/lib.linux-x86_64-3.5/medpy/graphcut/maxflow.cpython-35m-x86_64-linux-gnu.so

in that order.

from medpy.

loli avatar loli commented on May 24, 2024

The alternate version
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 maxflow.o wrapper.o graph.o -lboost_python-py35 -o maxflow.so

works. I think I need sys.version_info.major (2/3) and sys.version_info.minor (7/5) do build this, as teh libboost_python.so invoked by -lboost_python can link to libboost_python-py27.so as well as libboost_python-py35.so.

from medpy.

loli avatar loli commented on May 24, 2024

Possible solution is to replace in the setup.py

maxflow = Extension('medpy.graphcut.maxflow',
                    define_macros = [('MAJOR_VERSION', '0'),
                                     ('MINOR_VERSION', '1')],
                    sources = ['lib/maxflow/src/maxflow.cpp', 'lib/maxflow/src/wrapper.cpp', 'lib/maxflow/src/graph.cpp'],
                    libraries = ['boost_python'],
                    extra_compile_args = ['-O0'])

by

maxflow = Extension('medpy.graphcut.maxflow',
                    define_macros = [('MAJOR_VERSION', '0'),
                                     ('MINOR_VERSION', '1')],
                    sources = ['lib/maxflow/src/maxflow.cpp', 'lib/maxflow/src/wrapper.cpp', 'lib/maxflow/src/graph.cpp'],
                    libraries = ['boost_python-py' + str(sys.version_info.major) + str(sys.version_info.minor)],
                    extra_compile_args = ['-O0'])

from medpy.

loli avatar loli commented on May 24, 2024

Fixed with 14c68d6 - I hope it does not cause other confusions!

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.