Should numpy be part of Blender python install (how about adding it)

Based upon some other thread here \and also i’ve been wondering for a while
And wonder why isnt numpy part of Blender python.?

Fact is Blender depends heavily on math (and so its python scripts).
The argument that it would be to much to put on your disk in the age where disks are gigabytes doesnt hold up.
Its not that huge afterall, and seccond there are allready default python programs installed that are not even related to blender, but funtion more as general python coding examples or lessons.

So how about adding numpy to 2.79 or 2.8

I could also imagine some 2D extra python pixel image editing tool, (like openCV maybe)
or maybe even pygame… but lets first wonder about numpy
wouldnt it be practical to have more advanced math and math speedups for blender scripts ?.

as I remember it is already included !

are you talking about scipy instead ?

just did a test in 2.78
and numpy works fine !

thanks
happy bl

I recall once seeing a set of benchmarks for various math libraries that were developed for use with Python, and there’s a number of them which are potentially a lot faster than Numpy for various operations.

A list I found with a quick Google search.
http://www.palrad.com/top-python-math-statistics-libraries-w-12007/

The Blender devs. probably can’t package them all for practical reasons (perhaps Numpy is preferred because it has a general purpose nature to it).

there are certain things in blender like list
which become very sluggish when larger then 1500

but I’m not certain it would help to use numpy
if it could be replaced by some super fast algo from C it might help get bl go faster !
only Devs could look at how to speed bl up !

happy bl

well as far as i know, only numpy was proven to beat MathLab in speed, yet maybe some specific fields there are faster solutions.
though numpy is well known too, so it acceptence as for scripters would be welcome a lot of people use numpy, one of the most popular libs i think, next to scipi (commonly used together).

The blender devs who maintain the c++/c code do not directly benefit from numpy.
(numpy itself was written in C thus allready extreme fast, and made available trough a API for python)
It are the addon developers would benefit as typically array operations go a lot faster.
basically a 3d object is just coordinates and if you want some script to act on x,y,z verticles (arrays) to do something then it likely will go faster on the python side if your code could make use of numpy.
(Its not simply enabling numpy, one should use the faster function as made available by numpy)

Sure Addons can be ported to C to extend Blender, though its not likely and not benneficial for other/all addons to be translated to C or C++, python addons are easier to write then writing c++ inside blender.
as python code doesnt need to be compiled with core blender, its python that executes addon’s.

It doesnt seam to be part of Blender win 64

It doesnt seam to be part of Blender win 64
elaborate a little

just did a test on an addon using numpy and it works fine on win 64 !

problem is more internal to Bl
like a said if you use and addon to add like a few 1000 objects
it get’s very sluggish cause it is added to internal list which become very slow if more then 1000

don’t know if this part in bl could be replace with some numpy equivalent working faster
it would be interesting to see bl go fasters

but data in bl is really pack and not certain it would be easy to translate to numpy array !
may be a Dev could tell us more about it

happy bl

its the math inside python that could be speed improved, the final result still would have to be transfered back to the main program (blender.exe). people’s math inside python code… (adding both scipi and numpy, would be even better for advanced math).
Supose you did some complex modification on those 1000 cubes, then you’be likely faster with edditing the verticles data trough numpy.

In another thread, someone improved another script that worked 3 times faster for some calculation parts if he used numpy.

hm thats strange so you do got numpy…hmm thats odd.

but you need to activate it in script

depends how you call it

here is one way

import math
import numpy as np
from numpy import linalg as la
from numpy import array,angle,conj,arange,matrix , exp ,deg2rad , rad2de

and not certain if it is not already use for some calculations inside blender !

some addon are already using numpy !

happy bl

Numpy ships with Blender, I am using it for an addon right now :slight_smile: