It is currently Sat Aug 22, 2020 3:37 am


All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: python bindings
PostPosted: Wed Jan 18, 2017 5:53 pm 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
hi,
i cloned the polyvox lib. from bitbucket because i would to build the python bindings, but as i see it can only built the c-sharp binding, it's not possible anymore the python bindings? i remember that in a prev. version was possible, could you give me some hint, please? :)
Thank you

Edit, 21/01/2017: For anyone imterested to polyvox python bindings: use this commit in develop:

https://bitbucket.org/volumesoffun/poly ... 2db197eacb

and follow these instructions:

http://www.volumesoffun.com/python-bind ... x-preview/


Last edited by kalwalt on Sat Jan 21, 2017 1:43 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Thu Jan 19, 2017 11:16 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I think that the Python bindings depend on CMake finding Python installed on your system, and possibly some other criteria. CMake should print a summary of what it has found and enabled once it finishes executing. For example, on my machine it finishes with:

Quote:
...
...
...
-- The following features have been enabled:

* Examples , Examples of PolyVox usage
* Tests , Unit tests
* API docs , HTML documentation of the API

-- The following OPTIONAL packages have been found:

* Doxygen , API documentation generator , <http://www.doxygen.org>
Building the API documentation
* Qt5Gui (required version >= 5.6.2)
* Qt5Widgets (required version >= 5.6.2)
* Qt5Core (required version >= 5.6.2)
* Qt5Test (required version >= 5.2) , C++ framework , <http://qt-project.org>
Building the tests

-- The following RECOMMENDED packages have been found:

* Qt5OpenGL (required version >= 5.2) , C++ framework , <http://qt-project.org>
Building the examples

-- The following features have been disabled:

* Bindings , SWIG bindings
* Manual , HTML user's manual


Summary
-------
Build examples: ON
Build tests: ON
Build bindings: OFF
API Docs available: ON
Build manual: OFF

Configuring done


What does yours say?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Fri Jan 20, 2017 10:51 am 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
My say:

Quote:
Found `sphinx-build` at /usr/bin/sphinx-build
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3")

-- The following features have been enabled:

* Examples , Examples of PolyVox usage
* Tests , Unit tests
* Bindings , SWIG bindings
* API docs , HTML documentation of the API
* Manual , HTML user's manual

-- The following OPTIONAL packages have been found:

* Doxygen , API documentation generator , <http://www.doxygen.org>
Building the API documentation
* Qt5Gui (required version >= 5.5.1)
* Qt5Widgets (required version >= 5.5.1)
* Qt5Core (required version >= 5.5.1)
* Qt5Test (required version >= 5.2) , C++ framework , <http://qt-project.org>
Building the tests
* PythonInterp (required version >= 3) , Python Interpereter , <http://www.python.org>
Running the Python tests
* SWIG , Bindings generator , <http://www.swig.org>

-- The following RECOMMENDED packages have been found:

* Qt5OpenGL (required version >= 5.2) , C++ framework , <http://qt-project.org>
Building the examples

-- The following OPTIONAL packages have not been found:

* PythonLibs (required version >= 3) , Programming language , <http://www.python.org>


Summary
-------
Build examples: ON
Build tests: ON
Build bindings: ON
API Docs available: ON
Build manual: ON

Configuring done


Now i understood; i have python 2.7 and 3.4 installed, , i didn't see that warning before. Aniway i was able to build the "PolyVoxCore.py" file with a swig command like this:

Quote:
swig -python -c++ -I'/home/walter/polyvox-bitbucket/polyvox/include/PolyVox' PolyVoxCore.i


i need now only the _PolyVoxCore.so shared lib but i think may I do with cmake?
how can i set cmake to point to the right pyhon lib?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Fri Jan 20, 2017 11:05 am 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
Sorry, my fault, i didn't installed the
Code:
 libpython3-dev libpython3.5-dev libpython3-all-dev
after installed them i was able to regenerate the makefile and build the libs. :)
Should also install them in my system, right? i would try to use polyvox with blender, in particular with sverchok addon see here: https://github.com/nortikin/sverchok, im new to pytho so will see what can i do with it...
Many thanks David for the hint!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Fri Jan 20, 2017 11:20 am 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
Anyway build process fail with tests:

Code:
[ 73%] Building CXX object tests/CMakeFiles/TestCubicSurfaceExtractor.dir/TestCubicSurfaceExtractor_automoc.cpp.o
[ 73%] Linking CXX executable TestCubicSurfaceExtractor
CMakeFiles/TestCubicSurfaceExtractor.dir/TestCubicSurfaceExtractor.cpp.o: nella funzione "TestCubicSurfaceExtractor::testBehaviour()":
TestCubicSurfaceExtractor.cpp:(.text+0x21c0): riferimento non definito a "bool QTest::qCompare<unsigned long, unsigned int>(unsigned long const&, unsigned int const&, char const*, char const*, char const*, int)"
TestCubicSurfaceExtractor.cpp:(.text+0x2561): riferimento non definito a "bool QTest::qCompare<unsigned long, unsigned int>(unsigned long const&, unsigned int const&, char const*, char const*, char const*, int)"
TestCubicSurfaceExtractor.cpp:(.text+0x28c7): riferimento non definito a "bool QTest::qCompare<unsigned long, unsigned int>(unsigned long const&, unsigned int const&, char const*, char const*, char const*, int)"
TestCubicSurfaceExtractor.cpp:(.text+0x2c06): riferimento non definito a "bool QTest::qCompare<unsigned long, unsigned int>(unsigned long const&, unsigned int const&, char const*, char const*, char const*, int)"
collect2: error: ld returned 1 exit status
tests/CMakeFiles/TestCubicSurfaceExtractor.dir/build.make:122: set di istruzioni per l'obiettivo "tests/TestCubicSurfaceExtractor" non riuscito
make[2]: *** [tests/TestCubicSurfaceExtractor] Errore 1
CMakeFiles/Makefile2:1723: set di istruzioni per l'obiettivo "tests/CMakeFiles/TestCubicSurfaceExtractor.dir/all" non riuscito
make[1]: *** [tests/CMakeFiles/TestCubicSurfaceExtractor.dir/all] Errore 2
Makefile:160: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2


without testing building process is fine.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Fri Jan 20, 2017 1:08 pm 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
The python example need some changes:

Code:
import PolyVoxCore as pv

#Create a 64x64x64 volume of integers
r = pv.Region(pv.Vector3Dint32_t(0,0,0), pv.Vector3Dint32_t(63,63,63))
#vol = pv.SimpleVolumeuint8(r)
vol = pv.BaseVolumeint8(r)


but i get this error:
Code:
>>>
 RESTART: /home/walter/polyvox-bitbucket/polyvox/build/examples/Python/PythonExample.py
Traceback (most recent call last):
  File "/home/walter/polyvox-bitbucket/polyvox/build/examples/Python/PythonExample.py", line 38, in <module>
    vol = pv.BaseVolumeint8(r)
  File "/home/walter/polyvox-bitbucket/polyvox/build/bindings/PolyVoxCore.py", line 2062, in __init__
    raise AttributeError("No constructor defined")
AttributeError: No constructor defined
>>>


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Sat Jan 21, 2017 9:34 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I am aware that there are some problems, because I refactored PolyVox a lot without updating the bindings. For example:

https://bitbucket.org/volumesoffun/poly ... lly-broken

You might find you get better results in the master branch (rather than develop) though that is quite old now. Realistically I'm not going to fix the Python bindings myself because I'm not working on PolyVox any more, but I would like to see Python bindings added to Cubiquity 2 and intend the make the API a lot more binding-friendly (less/no templates).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Sat Jan 21, 2017 9:48 am 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
i saw that post, but i thought that maybe was fixed. So i have two options: to fix updating the bindings (that i feel not very smart with) or using the master branch. I think i will switch to the master branch, and eventually i will try to fix the develop bindings. :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Sat Jan 21, 2017 10:41 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Yes, that's basically the case.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: python bindings
PostPosted: Sat Jan 21, 2017 1:33 pm 

Joined: Mon Oct 15, 2012 4:33 pm
Posts: 52
:D ET Voilà!!!

Attachment:
Schermata del 2017-01-21 14-23-01.png
Schermata del 2017-01-21 14-23-01.png [ 179.75 KiB | Viewed 10986 times ]


I didn't used the master (because it fails...) but as described in your blog by Matt http://www.volumesoffun.com/python-bindings-for-polyvox-preview/ i switched to this commit

https://bitbucket.org/volumesoffun/poly ... 2db197eacb

and this work! :D

will see now what we can do with sverchok and blender!


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 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