Python modules CGkit on Linux

Hi,

I have used the CGkit python module in the BWF project
(https://blenderartists.org/forum/viewtopic.php?t=12324)

CGkit is on http://www.sourceforge.com/

I developed on Windows, and is all fine, but
people reported problems in installing it on Linux, and when I tried I too got plenty of errors.

I mean, for me CGkit compiles but cannot be loaded into python…

Anyone has ideas?

In any case CGKit noise, which is what I use, is not exceptional…
so I’m opened to alternatives.

Thanx in advance

Stefano

He, he, he…

This time it’s gonna be me helping you guys out with this… (j/k) :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

O.k.

First of all if I remember well, you have to compile the CGkit against the Python 2.2 modules in order to get it to work in the first place… If you compile it with older versions than that, it won’t compile at all… The reason is, that in Python 2.2 they changed the way how iterating over sequences work (by using iterators). So every C module that uses this
new feature won’t run on older Python versions. Since the new cgtypes module was rewritten using Pyrex which actually depends on those new Python 2.2.
stuff, the new cgtypes module won’t work together with a Python version less
than 2.2.

<EDIT> Make sure that you have Python-2.2 or even later than that, just to avoid this problem… If this is the case upgrade to at least 2.2</EDIT>

Now if I’m correct, Blender’s Python API up to version 2.27, was based on Python 2.0.1 or 2.1 (not sure… I’m an old man and my memory is playing nasty tricks on me some times…)… So if you can’t import cgtypes from within Blender, that’s the reason for it…

In such a case, I can suggest only two possible solutions:

  1. Install an older version of CGKIT, which is compiled against pure Python modules… In such a case, incompatibilities between Python/C API, are not an issue at all…

  2. The older modules are still present in the newer versions of CGKIT (you will see them hidden somewhere in your /usr/lib/pythonx.x/cgkit directory…)… You can try importing pycgtypes, instead of cgtypes, from within Blender…

I hope this solves the problem…

<EDIT> I’m not sure if I remember well, so chances are that this noise function you are most interested in may not be present in the old pycgtypes… Perhaps the Blenderpre2.28 would work much better with the newer cgtypes, don’t know for sure, cause it’s been since ages I’ve taken a look at cgkit, last time…</EDIT>

Spyros.

O.k. just forget what I’ve written in my previous post…

I think not only I have a memory problem but my brain is not functioning at all… :x

Sometimes it’s better to chew than to speak… :x

I didn’t remember very well, and i was refering to another problem I had, importing cgtypes from Blender a long time ago… :frowning:

Only the noise module is independant from cgtypes…

I’m really sorry…

I just given a look at the cgkit today and tried to see if I can make your script to work…

I got this error:

File bwf-0.6.0.py, line 28, in?

Import error: /usr/lib/python2.2/site-packages/noise.so: undefined symbol: __gxx_personality_v(0)

allthough there aren’t any problems importing noise from Python 2.2 interpreter…

Most probably the same error everybody gets…

You didn’t have any problems with Windows version, most probabbly because you used the precompiled windows binary version of it… (am I right???) so actually you didn’t have to deal with compiling CGKIT (and noise, as well…) against Pyrex…

But in linux things are slightly different… you have, only the sources and you have to go through compilation… Most probably The current Linux distros have a more up to date version of Pyrex, which allthough works well with Python2.2 (which explains why noise module works from Python2.2) causes incompatibility issues, between the older Blender’s Python Api…

Maybe Blender pre2.28 would work better, but I cannot recommend it since I haven’t tried it…

I may be right or I may be wrong…

The thing is, that only CGKIT’s creator can give you some answers, so it would be a good idea I think to contact him…

Sorry one more time for the possible confusion that I may have caused…

:expressionless: :expressionless: :expressionless:

This looks like a GCC issue. C++ binary compatibility was broken between 2.x & 3.x and again somewhere in the 3.x series. It now conforms to the standard, so shouldn’t be broken in the near future.

Anyway, it works on my box:
Blender CVS (exppython api)
Python 2.2.2
BWF 0.0.6
CGKit 1.0beta3

I have compiled python & blender from source, that might be the key…

The one thing I did have to do was ensure /usr/lib/python2.2/site-packages was in the python path.

Well, thanx guys,

I tried to contact the author, but got no reply

I’ll try again, then, being BSD licensed I think we can branch off our tree, according to license rules, isn’t it?

Stefano

if you are looking for an alternative noise function, have you considered eeshlo’s dynoise module?

as well as being a .dll and .so it’s also available as a standard .py file, which would solve all you platform specific problems.

also, i remember on it’s release that eeshlo demostrated it with a terrain generator, using noise functions orientated for terrain.

later
BEAT

Have you tried compiling blender from source ? Install the cgkit first then compilre blender 2.28. I finally got it to compuile and this fixed the problem.

Zaug