Can we use Python 2.7 with Blender 2.6x ?

Problem with this unittest:


 >>> d1 = {1:[1,1,1,'one'], 2:[2,4,6,8], 4:4, 8:['eight']} #PKHG the firs 1 was 'ones' ==>error not allowed in 3.2
    >>> for x in dictCombinations(d1): print(sorted(x.items()))  #PKHG this tests dictCombinations
    [(2, 2), (4, 4), (8, 'eight'), ('ones', 1)]
    [(2, 4), (4, 4), (8, 'eight'), ('ones', 1)]
    [(2, 6), (4, 4), (8, 'eight'), ('ones', 1)]
    [(2, 8), (4, 4), (8, 'eight'), ('ones', 1)]
    [(2, 2), (4, 4), (8, 'eight'), ('ones', 'one')]
    [(2, 4), (4, 4), (8, 'eight'), ('ones', 'one')]
    [(2, 6), (4, 4), (8, 'eight'), ('ones', 'one')]
    [(2, 8), (4, 4), (8, 'eight'), ('ones', 'one')]

This works
thus ‘ones’ is not allowed => replaced by 1

And a problem, the keys ‘must be’ strings! in utilities.py of pybrain :wink: at least at this moment

Change recursive code is this:


def dictCombinations(listdict):
    """ Iterates over dictionaries that go through every possible combination
    of key-value pairs as specified in the lists of values for each key in listdict."""
    listdict = listdict.copy()
    if len(listdict) == 0:
        return [{}]
    k, vs = listdict.popitem()
    print("PKHG L681 in utilities ",k,vs)
    res = dictCombinations(listdict)
    print("L683 res k vs new ",res,k,vs)
    
    if isinstance(vs, list) or isinstance(vs, tuple):
        res = [dict(d, **{str(k):v}) for d in res for v in sorted(set(vs))] #PKHG str added!
    else:
        res = [dict(d, **{str(k):vs}) for d in res]  #PKHG str added!
    return res


original: **{k:v} gives error:

File “C:\Python32\lib\site-packages\pybrain-0.3-py3.2.egg\pybrain\utilities.py”, line 686, in <listcomp>
res = [dict(d, **{k:v}) for d in res for v in sorted(set(vs))]
TypeError: keyword arguments must be strings

d1 = {1:[1,2], 2:[2,4,6,8], 4:4, 8:[‘eight’,‘4’]}
for x in res: print(sorted(x.items()))

giving:
[(‘1’, 1), (‘2’, 2), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 1), (‘2’, 2), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 2), (‘2’, 2), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 2), (‘2’, 2), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 1), (‘2’, 4), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 1), (‘2’, 4), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 2), (‘2’, 4), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 2), (‘2’, 4), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 1), (‘2’, 6), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 1), (‘2’, 6), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 2), (‘2’, 6), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 2), (‘2’, 6), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 1), (‘2’, 8), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 1), (‘2’, 8), (‘4’, 4), (‘8’, ‘eight’)]
[(‘1’, 2), (‘2’, 8), (‘4’, 4), (‘8’, ‘4’)]
[(‘1’, 2), (‘2’, 8), (‘4’, 4), (‘8’, ‘eight’)]

SO Alain, do you ever need this???

Two tests more running now :wink:

C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests>\Python32\python.exe runtests.py
INFO Tests found: pybrain.tests.unittests.auxiliary.test_pca
INFO Tests found: pybrain.tests.unittests.datasets.test_datasets_datasets
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\optimization
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\rl
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\structure
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\supervised
WARNING Module pybrain.tests.unittests.tools.test_rlgluebridge is missing dependencies: rlglue
INFO Tests found: pybrain.tests.unittests.tools.test_ibp_leftordered
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\unsupervised
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests_pycache_
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\auxiliary_pycache_
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\datasets_pycache_
INFO Tests found: pybrain.tests.unittests.optimization.populationbased.test_pso_ring
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\optimization_pycache_
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\optimization\populationbased_pycache_
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\rl\environments
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\rl_pycache_
INFO Tests found: pybrain.tests.unittests.rl.environments.twoplayergames.test_capture_game
INFO Tests found: pybrain.tests.unittests.rl.environments.twoplayergames.test_pente
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\rl\environments_pycache_
INFO No tests found in C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests\unittests\rl\environments woplayergames_pycache_
INFO Tests found: pybrain.tests.unittests.structure.connections.test_shared_connections
INFO Tests found: pybrain.tests.unittests.structure.connections.test_sliced_connections
INFO Tests found: pybrain.tests.unittests.structure.connections.test_subsampling_connection
…INFO No fast networks available:

Ran 6 tests in 0.586s

ALL unittests succeeded :smiley: just a minute ago :slight_smile:

From docs (old one I got) networks.py
adjusted:


############################################################################
# PyBrain Tutorial "Networks, Modules, Connections"
#
# Author: Tom Schaul, tom@idsia.ch
############################################################################

__author__ = 'Tom Schaul, tom@idsia.ch'

from pybrain.structure.networks import FeedForwardNetwork
from pybrain.structure.modules.linearlayer import LinearLayer
from pybrain.structure.modules.sigmoidlayer import SigmoidLayer
from pybrain.structure.connections.full import FullConnection
from pybrain.structure.networks.recurrent import RecurrentNetwork
from pybrain.tools.shortcuts import buildNetwork

""" This tutorial will attempt to guide you for using one of PyBrain's most basic structural elements:
Networks, and with them Modules and Connections.

Let us start with a simple example, building a multi-layer-perceptron (MLP).

First we make a new network object: """

n = FeedForwardNetwork()

""" Next, we're constructing the input, hidden and output layers. """

inLayer = LinearLayer(2)
hiddenLayer = SigmoidLayer(3)
outLayer = LinearLayer(1)

""" (Note that we could also have used a hidden layer of type TanhLayer, LinearLayer, etc.)

Let's add them to the network: """

n.addInputModule(inLayer)
n.addModule(hiddenLayer)
n.addOutputModule(outLayer)

""" We still need to explicitly determine how they should be connected. For this we use the most
common connection type, which produces a full connectivity between two layers (or Modules, in general):
the 'FullConnection'. """

in2hidden = FullConnection(inLayer, hiddenLayer)
hidden2out = FullConnection(hiddenLayer, outLayer)
n.addConnection(in2hidden)
n.addConnection(hidden2out)

""" All the elements are in place now, so we can do the final step that makes our MLP usable,
which is to call the 'sortModules()' method. """

n.sortModules()

""" Let's see what we did. """

print(n)

""" One way of using the network is to call its 'activate()' method with an input to be transformed. """

print(n.activate([1, 2]))

""" We can access the trainable parameters (weights) of a connection directly, or read
all weights of the network at once. """

print(hidden2out.params)
print(n.params)

""" The former are the last slice of the latter. """

print(n.params[-3:] == hidden2out.params)

""" Ok, after having covered the basics, let's move on to some additional concepts.
First of all, we encourage you to name all modules, or connections you create, because that gives you
more readable printouts, and a very concise way of accessing them.

We now build an equivalent network to the one before, but with a more concise syntax:
"""
n2 = RecurrentNetwork(name='net2')
n2.addInputModule(LinearLayer(2, name='in'))
n2.addModule(SigmoidLayer(3, name='h'))
n2.addOutputModule(LinearLayer(1, name='out'))
n2.addConnection(FullConnection(n2['in'], n2['h'], name='c1'))
n2.addConnection(FullConnection(n2['h'], n2['out'], name='c2'))
n2.sortModules()

""" Printouts look more concise and readable: """
print(n2)

""" There is an even quicker way to build networks though, as long as their structure is nothing
more fancy than a stack of fully connected layers: """

n3 = buildNetwork(2, 3, 1, bias=False)

""" Recurrent networks are working in the same way, except that the recurrent connections
need to be explicitly declared upon construction.

We can modify our existing network 'net2' and add a recurrent connection on the hidden layer: """

n2.addRecurrentConnection(FullConnection(n2['h'], n2['h'], name='rec'))

""" After every structural modification, if we want ot use the network, we call 'sortModules()' again"""

n2.sortModules()
print(n2)

""" As the network is now recurrent, successive activations produce different outputs: """

print(n2.activate([1, 2]),)
print(n2.activate([1, 2]),)
print(n2.activate([1, 2]))

""" The 'reset()' method re-initializes the network, and with it sets the recurrent
activations to zero, so now we get the same results: """

n2.reset()
print(n2.activate([1, 2]),)
print(n2.activate([1, 2]),)
print(n2.activate([1, 2]))

""" This is already a good coverage of the basics, but if you're an advanced user
you might want to find out about the possibilities of nesting networks within
others, using weight-sharing, and more exotic types of networks, connections
and modules... but that goes beyond the scope of this tutorial.
"""


gave
C:\Python32\Lib\site-packages\PyBrain-0.3-py3.2.egg\pybrain ests>\Python32\python.exe networks.py
FeedForwardNetwork-6
Modules:
[<LinearLayer ‘LinearLayer-3’>, <SigmoidLayer ‘SigmoidLayer-7’>, <LinearLayer ‘LinearLayer-8’>]
Connections:
[<FullConnection ‘FullConnection-4’: ‘LinearLayer-3’ -> ‘SigmoidLayer-7’>, <FullConnection ‘FullConnection-5’: ‘SigmoidLayer-7’
-> ‘LinearLayer-8’>]

[-1.40044778]
[ 0.1447733 -1.55845612 -0.0536663 ]
[-0.07494092 -0.49025299 1.76075133 0.18540092 -0.49420539 1.04841731
0.1447733 -1.55845612 -0.0536663 ]
[ True True True]
net2
Modules:
[<LinearLayer ‘in’>, <SigmoidLayer ‘h’>, <LinearLayer ‘out’>]
Connections:
[<FullConnection ‘c1’: ‘in’ -> ‘h’>, <FullConnection ‘c2’: ‘h’ -> ‘out’>]
Recurrent Connections:
[]
net2
Modules:
[<LinearLayer ‘in’>, <SigmoidLayer ‘h’>, <LinearLayer ‘out’>]
Connections:
[<FullConnection ‘c1’: ‘in’ -> ‘h’>, <FullConnection ‘c2’: ‘h’ -> ‘out’>]
Recurrent Connections:
[<FullConnection ‘rec’: ‘h’ -> ‘h’>]
[-1.37998339]
[-0.31890482]
[-0.6371347]
[-1.37998339]
[-0.31890482]
[-0.6371347]

now trying THIS from within Blender :wink: (TODO, done!)
Same result from out Blender :smiley:

Additional: got matplotlib working! in Python 3.2
Now testing it from out Blender?! … Probably not, at least my Blenderversion has not tkinter compiled into Python …

the backpropxor seems to work :smiley:

C:\Users\Peter\25blender\PyBrain\pybrain\examples\supervised\backprop>\Python32\python backpropanbncn.py
Total error: 0.349786136913
Total error: 0.112719041546
Total error: 0.111705326616
Total error: 0.111586969796
Total error: 0.111481711897
Total error: 0.111381551806
Total error: 0.111285153506
PKHGL… removed
Total error: 0.000949825542674
Total error: 0.000939770200707
Total error: 0.000929887467245
Total error: 0.000920173458776
Total error: 0.000910624398913
Total error: 0.000901236614792
Total error: 0.000892006533637
Total error: 0.000882930679453
Total error: 0.000874005669858
Total error: 0.000865228213045
Total error: 0.00085659510486
Total error: 0.000848103226
Total error: 0.000839749539317
Final weights: [ 0.89328688 1.20993977 -1.11585745 0.88557379 -1.33962179 0.00794873
0.34630237 2.03861522]

I ran python 3.2 in the examples* directory
the files there had to be adjusted a little bit because of the ‘find mechanism’ of modules which seems to be different in older Python?

But no change in pybrain* needed.


If some understands and can inform me how to change the init.py files such that NO change
(though more clear!) is needed???

SUCCESS at once without any changes RUN directly with Python: the kohonen example use matplotlib and shows a window where a number of blocks become square ;-)

a number of problems stay yet with examples rl … ;-(

So many informations…wow !
I love your work :wink:

Some quick remarks :

  • No need of Matplotlib for me (I want to adapt these examples with Blender display)
  • Hope I can use Xor (done !), Feedforward Network (done !), Thanks !..
  • Hope Kohonen example working ? what about it ?
  • …and Reinforcement Learning too (RL) …seems to be difficult…huhhg…

Alain

PS : do you have a blog with tutorials or scripts about your work ? Very interested by your methods…

Blog not yet … examples are taken from http://pybrain.org/docs/tutorial/optimization.html e.g
E.G. small change
file: brainEvolvable.py


from random import random
from pybrain.structure.evolvables.evolvable import Evolvable
class SimpleEvo(Evolvable):
     def __init__(self, x): self.x = max(0, min(x, 10))
     def mutate(self):      self.x = max(0, min(self.x + random() - 0.3, 10))
     def copy(self):        return SimpleEvo(self.x)
     def randomize(self):   self.x = 10*random()
     def __repr__(self):
          result = format('&lt;- %.2f -&gt;' % self.x)
          return result

from pybrain.optimization.hillclimber import HillClimber
x0 = SimpleEvo(1.2)
l = HillClimber(lambda x: x.x, x0, maxEvaluations = 50)
print(l)
print(l.learn())     

Python32/python.exe
import brainEvolvable
gives
(<- 10.00 ->, 10)

and adusted from the doc/… directory

To run pybrain in Blender you need to get scipy and numpy for Python 3.2 say with Python 3.2 on you computer
Then copy from python directory Lib/site-packages/scipy (and numpy) to Blender directory /2.61/scripts/addons
(maybe soon 2.62 or even 2.6
*>2?!)
The same with the pybrain directory (you have to get soon?!)
check scipy in Blender!

Did you get Deap.zip (post #9) and got it running in Blender? (Want to remove it …)

AND last but not least … examples of use in Blender already prepared??? THAT is interesting, we are on Blender site :wink:

got pente running :wink:
This is eventually nice to show an animation of the moves in Blender??

Big difference 2.7 and 3.2 python encountered in pybrain:
range(x) is not directly usable replaced more or less by [el for el in range(x)]
long has become ‘aufgefressen’ by int
filters have to be done too into something like [el for el in filter(…)] (at least worked for pente.py)
integer division 5/2 delivers e.g. 2.5 so has to be replaced by 5 // 2 :wink:
Alain: could you use IRC and channel #blenderpython for discussing more directly? if online I am PKHG or PeterGrgrt = afk = away from keyboard ??

docs/tutorial/rl gives this, only rows with sum < 4.0 are printed

exeriment 2

row j = 10 [ 0.97917101 0.995 0.9925 0.99125 ]
row j = 11 [ 0.9925 1. 1. 0.995 ]
row j = 19 [ 0.985675 0.988775 0.98506943 0.97903159]
row j = 20 [ 0.9925 0.9863 0.9925 0.98089356]
row j = 28 [ 0.98815 0.988775 0.9925 0.990625]
row j = 29 [ 0.98153268 0.98551563 0.98427969 0.995 ]
row j = 31 [ 0.995 1. 1. 0.9925]
row j = 37 [ 0.99125 0.9869125 0.99125 0.995 ]
row j = 38 [ 0.99125 0.9844375 0.98505121 0.990025 ]
row j = 40 [ 0.990025 1. 0.995 0.99125 ]
row j = 46 [ 0.990025 0.990025 0.9869125 0.995 ]
row j = 47 [ 0.98629375 0.995 0.98816875 0.988775 ]
row j = 48 [ 0.9925 0.990025 0.9903125 0.995 ]
row j = 49 [ 0.99125 0.995 0.9925 0.9925 ]
row j = 50 [ 1. 1. 1. 0.995]
row j = 64 [ 0.98305859 0.98508106 0.98304063 0.98505625]
row j = 65 [ 0.98507487 0.97897698 0.9875375 0.9863 ]
row j = 66 [ 0.97729316 0.98075781 0.97793594 0.98398112]
row j = 67 [ 0.98335469 0.98760312 0.98397344 0.98137656]
row j = 68 [ 0.98505061 0.9925 0.9866 0.98280781]

network.py (a little bit adjusted gives):
C:\Users\Peter\25blender\PyBrain\pybrain\docs utorials>\Python32\python.exe networks.py
FeedForwardNetwork-6
Modules:
[<LinearLayer ‘LinearLayer-3’>, <SigmoidLayer ‘SigmoidLayer-7’>, <LinearLayer ‘LinearLayer-8’>]
Connections:
[<FullConnection ‘FullConnection-4’: ‘LinearLayer-3’ -> ‘SigmoidLayer-7’>, <FullConnection ‘FullConnection-5’: ‘SigmoidLayer-7’
-> ‘LinearLayer-8’>]

[ 0.99115106]
[ 2.230207 -0.41615624 -0.59755979]
[ 0.18520931 0.05763201 0.64269286 0.03640338 0.08641858 -2.04377806
2.230207 -0.41615624 -0.59755979]
[ True True True]
net2
Modules:
[<LinearLayer ‘in’>, <SigmoidLayer ‘h’>, <LinearLayer ‘out’>]
Connections:
[<FullConnection ‘c1’: ‘in’ -> ‘h’>, <FullConnection ‘c2’: ‘h’ -> ‘out’>]
Recurrent Connections:

net2
Modules:
[<LinearLayer ‘in’>, <SigmoidLayer ‘h’>, <LinearLayer ‘out’>]
Connections:
[<FullConnection ‘c1’: ‘in’ -> ‘h’>, <FullConnection ‘c2’: ‘h’ -> ‘out’>]
Recurrent Connections:
[<FullConnection ‘rec’: ‘h’ -> ‘h’>]
[ 0.54782594]
[ 0.35334267]
[ 0.3757849]
[ 0.54782594]
[ 0.35334267]
[ 0.3757849]

kohonen shows a picture where mesh of squares are moved into a square(?) … so pylab gets useful data …

backpropxor works too :wink:

Total error: 3.07756205948e-06
Total error: 2.33545893529e-06
Total error: 2.30776269824e-06
Total error: 2.99371553841e-06

Testing on data:
out: [-0.002, -0.866]
correct: [0 , 1 ]
importance: [1 , 0 ]
error: 0.00000247
out: [0.996 , -0.854]
correct: [1 , 10 ]
importance: [1 , 0 ]
error: 0.00001000
out: [1.001 , -0.619]
correct: [1 , -1 ]
importance: [1 , 0 ]
error: 0.00000068
out: [-0.002, -0.341]
correct: [0 , 0 ]
importance: [1 , 0 ]
error: 0.00000300
All errors: [4.0371973651150844e-06]
Average error: 4.03719736512e-06
(‘Max error:’, 4.0371973651150844e-06, ‘Median error:’, 4.0371973651150844e-06)

So now I have to learn myself using neural networks :wink:

Yes ! And I see on the Pybrain mailing list that you want to try it for Tic Tac Toe : great idea !
Please, can you post here or via the Pybrain Mailing List , your Pybrain for Python 3.2 version…
Would be great for me, and for all the pybrain communauty too…
Thanks :slight_smile:

Alain

And Yes, I got your DEAP for Python 3.2 version; thanks again for that :slight_smile:

I think you should post it for the DEAP communauty too : http://groups.google.com/group/deap-users?pli=1

Alain

hmm can I send via the pybrain mailing list a *.7z file? (ca 500 KB) ? (or send me via PM an email) …

Do not yet (precisely) what it means but it works :wink:


# -*- coding: iso-8859-15 -*-
from pybrain.datasets.supervised import SupervisedDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers.backprop import BackpropTrainer
ds = SupervisedDataSet(6,3)

tf = open('mycvsfile.cvs','r')

for line in tf.readlines():
    data = [float(x) for x in line.strip().split(',') if x != '']
    indata =  tuple(data[:6])
    outdata = tuple(data[6:])
    ds.addSample(indata,outdata)
print(ds)
print(ds.indim)
print(ds.outdim)
n = buildNetwork(ds.indim,8,8,ds.outdim,recurrent=True)
print(n)
print(n['in'])
t = BackpropTrainer(n,learningrate=0.01,momentum=0.5,verbose=True)
t.trainOnDataset(ds,1000)
t.testOnData(verbose=True)

Testing on data:
out: [0.974 , 1.049 , 1.037 ]
correct: [1 , 1 , 1 ]
error: 0.00220289
out: [-0.016, 0.998 , 1.016 ]
correct: [0 , 1 , 1 ]
error: 0.00025477
out: [0.019 , 1.001 , 0.979 ]
correct: [0 , 1 , 1 ]
error: 0.00039774
out: [0.013 , 0.983 , 0.994 ]
correct: [0 , 1 , 1 ]
error: 0.00023858
out: [1.011 , 0.962 , 0.975 ]
correct: [1 , 1 , 1 ]
error: 0.00111010
out: [0.051 , -0.01 , -0.012]
correct: [0 , 0 , 0 ]
error: 0.00144128
out: [-0.062, 0.019 , 0.016 ]
correct: [0 , 0 , 0 ]
error: 0.00225000
All errors: [0.00073429719588731079, 8.4922413205531394e-05, 0.00013258058000676826, 7.9526333835670015e-05, 0.00037003265891438764, 0.00048042570764372593, 0.00074999907003932742]
Average error: 0.000375969137076
(‘Max error:’, 0.00074999907003932742, ‘Median error:’, 0.00037003265891438764)

Data:
1,1,1,1,1,1,1,1,1
0,0,1,1,1,1,0,1,1
0,0,1,1,1,0,0,1,1
1,0,0,1,1,1,0,1,1
0,1,1,1,1,1,1,1,1
0,0,0,0,0,1,0,0,0
0,0,0,0,0,0,0,0,0

Trying at PyBrain Groups of Google, how they would like my version … to be available.
Just discovered a probable error in rankingfunctions.py
File “C:\Python32\lib\site-packages\pybrain-0.3-py3.2.egg\pybrain ools\rankingfunctions.py”, line 19, in rankedFitness
l.sort()
AttributeError: ‘zip’ object has no attribute ‘sort’

And there are probably others (Error float but int expected … very often repaired by replaceing
/ by // in Python 2.6 7/2 = 3 in Python 3.2 = 3.5 )

Many Thanks Peter !
I will try it and make some examples with Blender…and of course, I will send you these examples :slight_smile:

Alain

Hi guys, I am one of the developper of DEAP.

Just so you know the next release 0.8 will be compatible with Python 2.7 and 3.x.
The 0.8 branch is currently pretty stable, we are mostly working on the documentation right now.

You can grab the code for 0.8 by cloning the Mercurial repository, and updating to 0.8-dev.
Code checkout : hg clone https://code.google.com/p/deap/
Changing branch : hg update 0.8-dev

Keep us inform about what you do with DEAP, we are always interested.

and I am predicting there will another 6 years before Python 3 becomes the standard. At this moment the amount of python libraries that dont work with Python is depressing to say the least espciallly as you correctly said take into consideration that Python 3 is 4 years old.

And here is a small sample why

http://python3wos.appspot.com/

So sticking to python 2 is the wise thing to do , unless the libraries you are using are python 3 compliant. However even in that case many of those ports are very buggy and early WIPs.

In any case yes there is a way to use python 2 libraries in python 3 with no need to port the library to python 3 . How ?

Its possible to have 2 diffirent interpreters running and communicate through the both interpreters. One of the best tools for this job is execnet , which does not only allow two diffirent cpython versions to communicate but even completely diffirent pythons like jython and ironpython making it possible to use java and .NET libraries from inside blender. Also execnet allows communication through local and distand network so even if your second python interpreter is another machine in another country they will be able to communicate and possible more than 2 interpreters too.

http://codespeak.net/execnet/

Hi Kilon,
Do you have a ‘working’ example for Blender 2.62 using something of Python 2.6 not yet available?
Or e.g. just using old scipy or so?