c_numpy.pxd missing?

28 views
Skip to first unread message

Oliver Beckstein

unread,
Nov 11, 2015, 2:45:39 PM11/11/15
to MDnalysis-devel
Hi,

I want to rebuild cython files (in particular, distances.pxd) with 

   python setup.py build

but I got the error that c_numpy.pxd is missing. This "used to work" but I don't remember what package I'd need for this to be picked up. According to Google, we used to ship such a file in the past with MDAnalysis. Other projects seem to also include a version, see  https://www.google.com/#q=c_numpy.pxd and there seems an outdated example at http://scipy-cookbook.readthedocs.org/items/Pyrex_and_NumPy.html

Thanks,
Oliver

Error compiling Cython file:
------------------------------------------------------------
...

Serial versions of all distance calculations
"""

cimport cython
cimport c_numpy
       ^
------------------------------------------------------------

MDAnalysis/lib/distances.pyx:26:8: 'c_numpy.pxd' not found

Oliver Beckstein

unread,
Nov 11, 2015, 2:53:16 PM11/11/15
to MDnalysis-devel
Well, apparently we still had our version, in package/include/c_numpy.pxd.

I did a

cp include/c_numpy.pxd MDAnalysis/lib/include/


and now it works. However, this file seems to be the source of these warnings

/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

so we might want to look into
  1. modernizing c_numpy.pxd
  2. figuring out where it really has to live
Oliver


Hai Nguyen

unread,
Nov 11, 2015, 2:53:29 PM11/11/15
to mdnalys...@googlegroups.com
I think `cimport c_numpy` should be `cimport numpy`

Hai

--
You received this message because you are subscribed to the Google Groups "MDnalysis-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-dev...@googlegroups.com.
To post to this group, send email to mdnalys...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-devel/dc83c4e3-68eb-4abc-b30e-c5609a2e8b59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hai Nguyen

unread,
Nov 11, 2015, 2:55:51 PM11/11/15
to mdnalys...@googlegroups.com
I don't see the benefit of using `cimport numpy` over using cython memory view.

Advantage of memory view:

- don't need numpy at compiling time
- you can still use numpy at running time or use any type of array supporting buffer protocol.

Hai

--
You received this message because you are subscribed to the Google Groups "MDnalysis-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-dev...@googlegroups.com.
To post to this group, send email to mdnalys...@googlegroups.com.

Max Linke

unread,
Nov 11, 2015, 3:12:56 PM11/11/15
to mdnalys...@googlegroups.com


On 11/11/2015 08:53 PM, Oliver Beckstein wrote:
> so we might want to look into
>
> 1. modernizing c_numpy.pxd
> 2. figuring out where it really has to live

Why do we even have that module? I never needed it in my own cython
code. Never since I started to use cython (something like 2-3 years ago)

>
> Oliver
>
>
>>
>

Richard Gowers

unread,
Nov 11, 2015, 3:16:20 PM11/11/15
to MDnalysis-devel
Yeah I moved that back in this issue https://github.com/MDAnalysis/mdanalysis/issues/444

We used to have a few copies of that header file so I moved it into a common directory.

And yeah, I think using that file is outdated, so as long as we don't kill compat with old versions of numpy we could move to the new solution.

Oliver Beckstein

unread,
Nov 11, 2015, 5:10:40 PM11/11/15
to mdnalys...@googlegroups.com

On 11 Nov, 2015, at 13:12, Max Linke wrote:

> Why do we even have that module? I never needed it in my own cython code. Never since I started to use cython (something like 2-3 years ago)

I removed it as part of PR #529.

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst * orbe...@gmail.com

Oliver Beckstein

unread,
Nov 11, 2015, 5:10:56 PM11/11/15
to mdnalys...@googlegroups.com

On 11 Nov, 2015, at 12:55, Hai Nguyen wrote:

> I don't see the benefit of using `cimport numpy` over using cython memory view.

Fair enough.

PR?

>
> Advantage of memory view:
>
> - don't need numpy at compiling time
> - you can still use numpy at running time or use any type of array supporting buffer protocol.
>

Hai Nguyen

unread,
Nov 11, 2015, 5:42:24 PM11/11/15
to mdnalys...@googlegroups.com
On Wed, Nov 11, 2015 at 5:10 PM, Oliver Beckstein <orbe...@gmail.com> wrote:

On 11 Nov, 2015, at 12:55, Hai Nguyen wrote:

> I don't see the benefit of using `cimport numpy` over using cython memory view.

Fair enough.


 
PR?

I will wait for someone to clean up the distance*.pyx codes. I am not sure why he/she duplicated lot of code in each file.

Hai 

>
> Advantage of memory view:
>
> - don't need numpy at compiling time
> - you can still use numpy at running time or use any type of array supporting buffer protocol.
>

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst  * orbe...@gmail.com

--
You received this message because you are subscribed to the Google Groups "MDnalysis-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-dev...@googlegroups.com.
To post to this group, send email to mdnalys...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages