It is currently Sat Aug 22, 2020 4:27 am


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Problem with Python Bindings
PostPosted: Sat Mar 22, 2014 6:50 pm 

Joined: Sat Mar 22, 2014 5:55 pm
Posts: 7
I'm trying to compile pyhton bindings from git source.

The bindings compile correctly but then, when trying to run the example I get:

Code:
Traceback (most recent call last):
  File "./PythonExample.py", line 29, in <module>
    import PolyVoxCore as pv
  File "../../library/bindings/PolyVoxCore.py", line 26, in <module>
    _PolyVoxCore = swig_import_helper()
  File "../../library/bindings/PolyVoxCore.py", line 22, in swig_import_helper
    _mod = imp.load_module('_PolyVoxCore', fp, pathname, description)
ImportError: dynamic module does not define init function (PyInit__PolyVoxCore)


Also, python related tests fail:

Code:
87% tests passed, 2 tests failed out of 15

Total Test time (real) = 289.53 sec

The following tests FAILED:
     1 - PythonSurfaceExtractorTest (Failed)
     2 - PythonRaycastTest (Failed)
Errors while running CTest
make: *** [test] Error 8


I'm using Python 3.2.3 on Ubuntu 12.04 LTS.

The rest of the examples work correctly. Any ideas?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with Python Bindings
PostPosted: Sun Mar 23, 2014 12:09 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
Ok, I just did a clean rebuild on my computer which means it should work and likely there's a configuration problem. The first, most likely problem is the SWIG version you're using. What version do you have and can you upgrade it? The PolyVox Python bindings only support Python3 so you need a version of SWIG which supports that too.

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with Python Bindings
PostPosted: Mon Mar 24, 2014 5:47 pm 

Joined: Sat Mar 22, 2014 5:55 pm
Posts: 7
I have Swig 2.0.4. I have python 2.7 and 3.2.3. What I just did, just to make sure, is making python default to 3.2.3 and rebuilding. But I'm having the same issue...

Should I try uninstalling python 2.7 completely? Should I try a different python version?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with Python Bindings
PostPosted: Sat Mar 29, 2014 2:28 pm 

Joined: Sat Mar 22, 2014 5:55 pm
Posts: 7
After updating Ubuntu I have the following problem:

Code:
Could NOT find PythonLibs: Found unsuitable version "2.7.3", but required is at least "3" (found /usr/lib/python2.7/config/libpython2.7.so)


But I do have file /usr/lib/python3.2/config-3.2mu/libpython3.2.so

However, if I uninstall python-dev, leaving only python3-dev installed, cmake detects PythonLibs correctly. But then, during make install:

Code:
[ 24%] Building CXX object library/bindings/CMakeFiles/_PolyVoxCorePython.dir/PolyVoxCorePYTHON_wrap.cxx.o
/home/pozzoe/Documents/polyvox/build/library/bindings/PolyVoxCorePYTHON_wrap.cxx:149:20: fatal error: Python.h: No such file or directory
compilation terminated.


What distribuition are you compiling under? What version of cmake do you use? Thank you


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with Python Bindings
PostPosted: Sun Mar 30, 2014 6:25 pm 

Joined: Sat Mar 22, 2014 5:55 pm
Posts: 7
I was able to solve the problem with cmake not finding PythonLibs > 3 and a compilation issue:

Code:
/home/pozzoe/Documents/polyvox/library/bindings/PolyVoxCore.i:4: Error: Unable to find 'Impl/TypeDef.h'
/home/pozzoe/Documents/polyvox/library/bindings/Vector.i:7: Error: Unable to find 'Vector.h'
/home/pozzoe/Documents/polyvox/library/bindings/DefaultMarchingCubesController.i:6: Error: Unable to find 'DefaultMarchingCubesController.h'
/home/pozzoe/Documents/polyvox/library/bindings/Region.i:16: Error: Unable to find 'Region.h'
/home/pozzoe/Documents/polyvox/library/bindings/Block.i:6: Error: Unable to find 'Block.h'
/home/pozzoe/Documents/polyvox/library/bindings/CompressedBlock.i:6: Error: Unable to find 'CompressedBlock.h'
/home/pozzoe/Documents/polyvox/library/bindings/UncompressedBlock.i:6: Error: Unable to find 'UncompressedBlock.h'
/home/pozzoe/Documents/polyvox/library/bindings/BlockCompressor.i:6: Error: Unable to find 'BlockCompressor.h'
/home/pozzoe/Documents/polyvox/library/bindings/Pager.i:6: Error: Unable to find 'Pager.h'
/home/pozzoe/Documents/polyvox/library/bindings/FilePager.i:6: Error: Unable to find 'FilePager.h'
/home/pozzoe/Documents/polyvox/library/bindings/MinizBlockCompressor.i:6: Error: Unable to find 'MinizBlockCompressor.h'
/home/pozzoe/Documents/polyvox/library/bindings/RLEBlockCompressor.i:6: Error: Unable to find 'RLEBlockCompressor.h'
/home/pozzoe/Documents/polyvox/library/bindings/BaseVolume.i:6: Error: Unable to find 'BaseVolume.h'
/home/pozzoe/Documents/polyvox/library/bindings/SimpleVolume.i:6: Error: Unable to find 'SimpleVolume.h'
/home/pozzoe/Documents/polyvox/library/bindings/RawVolume.i:6: Error: Unable to find 'RawVolume.h'
/home/pozzoe/Documents/polyvox/library/bindings/LargeVolume.i:6: Error: Unable to find 'LargeVolume.h'
/home/pozzoe/Documents/polyvox/library/bindings/VertexTypes.i:8: Error: Unable to find 'Impl/TypeDef.h'
/home/pozzoe/Documents/polyvox/library/bindings/VertexTypes.i:9: Error: Unable to find 'Vector.h'
/home/pozzoe/Documents/polyvox/library/bindings/VertexTypes.i:10: Error: Unable to find 'VertexTypes.h'
/home/pozzoe/Documents/polyvox/library/bindings/SurfaceMesh.i:8: Error: Unable to find 'Region.h'
/home/pozzoe/Documents/polyvox/library/bindings/SurfaceMesh.i:9: Error: Unable to find 'VertexTypes.h'
/home/pozzoe/Documents/polyvox/library/bindings/SurfaceMesh.i:10: Error: Unable to find 'SurfaceMesh.h'
/home/pozzoe/Documents/polyvox/library/bindings/MarchingCubesSurfaceExtractor.i:6: Error: Unable to find 'MarchingCubesSurfaceExtractor.h'
/home/pozzoe/Documents/polyvox/library/bindings/CubicSurfaceExtractor.i:6: Error: Unable to find 'CubicSurfaceExtractor.h'
/home/pozzoe/Documents/polyvox/library/bindings/CubicSurfaceExtractorWithNormals.i:6: Error: Unable to find 'CubicSurfaceExtractorWithNormals.h'
/home/pozzoe/Documents/polyvox/library/bindings/Raycast.i:52: Error: Unable to find 'Raycast.h'
/home/pozzoe/Documents/polyvox/library/bindings/Picking.i:6: Error: Unable to find 'Picking.h'
make[2]: *** [library/bindings/PolyVoxCoreCSHARP_wrap.cxx] Error 1
make[1]: *** [library/bindings/CMakeFiles/PolyVoxCoreCSharp.dir/all] Error 2
make: *** [all] Error 2


To do this I REMOVED libpython2.7-dev package and kept only libpython3-dev. After that, cmake is able to detect the installed version of libpython3

Code:
Found PythonLibs: /usr/lib/python3.3/config-3.3m-x86_64-linux-gnu/libpython3.3.so (Required is at least version "3")


But now I'm stucked at a different problem: PolyVox compiles, but then

Code:
Test project /home/pozzoe/Documents/polyvox/build
      Start  1: PythonSurfaceExtractorTest
 1/15 Test  #1: PythonSurfaceExtractorTest .......***Failed    0.31 sec
      Start  2: PythonRaycastTest
 2/15 Test  #2: PythonRaycastTest ................***Failed    0.12 sec
      Start  3: TestAmbientOcclusionGenerator
...
The following tests FAILED:
     1 - PythonSurfaceExtractorTest (Failed)
     2 - PythonRaycastTest (Failed)
Errors while running CTest


And

Code:
pozzoe@ubuntu:~/Documents/polyvox/build/examples/Python$ ./PythonExample.py
Traceback (most recent call last):
  File "./PythonExample.py", line 29, in <module>
    import PolyVoxCore as pv
  File "../../library/bindings/PolyVoxCore.py", line 26, in <module>
    _PolyVoxCore = swig_import_helper()
  File "../../library/bindings/PolyVoxCore.py", line 22, in swig_import_helper
    _mod = imp.load_module('_PolyVoxCore', fp, pathname, description)
  File "/usr/lib/python3.3/imp.py", line 188, in load_module
    return load_dynamic(name, filename, file)
ImportError: dynamic module does not define init function (PyInit__PolyVoxCore)


Googling "ImportError: dynamic module does not define init function" shows a variety of issues that could be causing this.

Swig version is 2.0.10. I'll appreciate any help you could give me.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Problem with Python Bindings
PostPosted: Mon Apr 14, 2014 9:30 am 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
I've just tested on Fedora 19 which has SWIG 2.0.10 and it's working there so at least it's not a SWIG version problem. Could you go to the build/library/bindings directory and run:
Code:
nm _PolyVoxCore.so | grep PyInit__PolyVoxCore
You should get an output like:
Code:
000000000021f7ad T PyInit__PolyVoxCore
0000000000674060 d _ZZ19PyInit__PolyVoxCoreE11SWIG_module
If not, could you let me know what you see?

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net