[Numpy-discussion] Long-standing issue with using numpy in embedded CPython

Yang Zhang yanghatespam at gmail.com
Tue Oct 4 15:05:20 EDT 2011


On Tue, Oct 4, 2011 at 1:28 AM, Robin <robince at gmail.com> wrote:
> On Mon, Oct 3, 2011 at 9:42 PM, Yang Zhang <yanghatespam at gmail.com> wrote:
>> It turns out that there's a long-standing problem in numpy that
>> prevents it from being used in embedded CPython environments:
>
> Just wanted to make the point for reference that in general Numpy does
> work fine in (non-threaded) embedded CPython situations, see for
> example pymex [1] which embeds Python + Numpy in a Matlab mex file and
> works really well.
>
> This seems to a be a problem specific to Jepp.
>
> Just wanted to mention it in case it puts someone off trying something
> unnecessarily in the future.

My (second-hand) understanding is that this is a problem with having
multiple CPython interpreters, which both Jepp and numpy utilize,
incompatibly - is that right?  I.e., if either one were restricted to
using a single CPython interpreter, we wouldn't see this problem?

I'm curious how to disable threads in numpy (not an ideal solution).
Googling seems to point me to setting NPY_ALLOW_THREADS to
0....somewhere.

>
> Cheers
>
> Robin
>
> [1] https://github.com/kw/pymex
>
>>
>> http://stackoverflow.com/questions/7592565/when-embedding-cpython-in-java-why-does-this-hang/7630992#7630992
>> http://mail.scipy.org/pipermail/numpy-discussion/2009-July/044046.html
>> Is there any fix or workaround for this?  Thanks.
>> --
>> Yang Zhang
>> http://yz.mit.edu/
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Yang Zhang
http://yz.mit.edu/



More information about the NumPy-Discussion mailing list