neuronsimulator / nrn

NEURON Simulator
http://nrn.readthedocs.io
Other
381 stars 114 forks source link

Build failure for Neuron 9.0a #2958

Closed cstricker closed 1 month ago

cstricker commented 1 month ago

Context

I have observed this build failure for a couple of weeks - and thought somebody else may report it. It occurs both on macOS, on wsl and on ubuntu linux (24.04) and has to do with red which is default in my configuration.

Overview of the issue

When linking I get the following error

[ 77%] Built target nrn-benchmarks share/lib/python/neuron/rxd/geometry3d/surfaces.cpp:14605:41: error: no member named 'subarray' in '_PyArray_Descr' __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));

Expected result/behavior

This should not occur as it causes abortion of build

NEURON setup

Minimal working example - MWE

Occurs even if starting from a fresh git download

Logs

I attach the output from my build shell script.

cmake.log

alkino commented 1 month ago

If you don't need RXD, you can run cmake with -DNRN_ENABLE_RXD=OFF

nrnhines commented 1 month ago

Can you tell me what version of cython you are using. On my machine I don't see the issue with

$ cython --version
Cython version 0.29.37

Note the first line of my cython generated surfaces.cpp file is

/* Generated by Cython 0.29.37 */

Also, on my machine, the offending code apparently does not get compiled due to being encapsulated in

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
...

By the way, I believe '-DNRN_ENABLE_BINARY_SPECIAL=ON' no longer exists. The only mention I see of it is

$ git log --grep NRN_ENABLE_BINARY_SPECIAL
commit defabcd2f0d98b12aafcbc23dbf75a1bf501a3b8
Author: Alexandru Savulescu <46521150+alexsavulescu@users.noreply.github.com>
Date:   Wed May 13 14:44:29 2020 +0200

    CMAKE binary special flavor  (#526)
...
    * travis: adapt testing for -DNRN_ENABLE_BINARY_SPECIAL=ON

    * revert NRN_SHARED + travis fix

    * mitigate binary special + rxd

but I haven't pursued this more deeply. My cmake is 3.28.3 and generates the message

$ cmake .. -DCMAKE_INSTALL_PREFIX=install '-DNRN_ENABLE_TESTS=ON' '-DNRN_ENABLE_BINARY_SPECIAL=ON'
...
CMake Warning:
  Manually-specified variables were not used by the project:

    NRN_ENABLE_BINARY_SPECIAL
...
cstricker commented 1 month ago

G’day Michael

great to hear from you. I am commenting into the text below.

On 5 Jul 2024, at 09:04, nrnhines @.***> wrote:

Can you tell me what version of cython you are using. On my machine I don't see the issue with

$ cython --version Cython version 0.29.37

My Cython is 0.29.36 - and I maintain it via a standard python update...

Note the first line of my cython generated surfaces.cpp file is

/ Generated by Cython 0.29.37 /

Also, on my machine, the offending code apparently does not get compiled due to being encapsulated in

ifndef CYTHON_REFNANNY

define CYTHON_REFNANNY 0

endif

if CYTHON_REFNANNY

...

By the way, I believe '-DNRN_ENABLE_BINARY_SPECIAL=ON' no longer exists. The only mention I see of it is

$ git log --grep NRN_ENABLE_BINARY_SPECIAL commit defabcd2f0d98b12aafcbc23dbf75a1bf501a3b8 Author: Alexandru Savulescu @.***> Date: Wed May 13 14:44:29 2020 +0200

CMAKE binary special flavor  (#526)

...

but I haven't pursued this more deeply.

I have commented it out now.

My cmake is 3.28.3 and generates the message

My cmake is 3.30.0 - maintained via brew.

I hope this helps and cheers

Christian.

PS: I have to dash off for some 4 hours - but will try with an updated cython and the dropped '-DNRN_ENABLE_BINARY_SPECIAL=ON’ - and if I find anything new, I will update.

$ cmake .. -DCMAKE_INSTALL_PREFIX=install '-DNRN_ENABLE_TESTS=ON' '-DNRN_ENABLE_BINARY_SPECIAL=ON' ... CMake Warning: Manually-specified variables were not used by the project:

NRN_ENABLE_BINARY_SPECIAL

...

— Reply to this email directly, view it on GitHubhttps://github.com/neuronsimulator/nrn/issues/2958#issuecomment-2209629086, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD5QLAFHXFZRM3XK4IX4TPTZKXIIHAVCNFSM6AAAAABKME6AAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBZGYZDSMBYGY. You are receiving this because you authored the thread.Message ID: @.***>

nrnhines commented 1 month ago

My earlier comments about CYTHON_REFNANNY were mistaken and have nothing to do with the issue. I think I need to focus more specifically on

share/lib/python/neuron/rxd/geometry3d/surfaces.cpp:14605:41: error: no member named 'subarray' in '_PyArray_Descr'
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
                             ~~~~~~~~~  ^

I'm puzzled because this line is definitely compiled on my machine but does not produce an error (or warning) and I'm able to introduce statements in that neighborhood that mention __pyx_v_d->subarray->shape.

cstricker commented 1 month ago

G’day Michael

I have updated Cython to 0.29.37 and re-started from scratch (with '-DNRN_ENABLE_BINARY_SPECIAL=ON’ removed) - but the build error remains as before. I hope this helps and cheers

Christian.

On 5 Jul 2024, at 10:21, nrnhines @.***> wrote:

My earlier comments about CYTHON_REFNANNY were mistaken and have nothing to do with the issue. I think I need to focus more specifically on

share/lib/python/neuron/rxd/geometry3d/surfaces.cpp:14605:41: error: no member named 'subarray' in '_PyArray_Descr' __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));



I'm puzzled because this line is definitely compiled on my machine but does not produce an error (or warning) and I'm able to introduce statements in that neighborhood that mention __pyx_v_d->subarray->shape.

—
Reply to this email directly, view it on GitHub<https://github.com/neuronsimulator/nrn/issues/2958#issuecomment-2209662608>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AD5QLAG775UWOBZD63OEZCLZKXRINAVCNFSM6AAAAABKME6AAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBZGY3DENRQHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
matz-e commented 1 month ago

Hi,

Which version of Numpy are you using? This looks a bit like the errors we see in CI when something accidentally installs Numpy 2.0 - does the error still happen when doing pip install "numpy<2" beforehand?

As we still use setup.py, we can't really codify this build dependency in an optimal way, unfortunately.

cstricker commented 1 month ago

G’day Matthias

my numpy version is indeed 2.0.0. I have just re-installed 1.26.4 and redone the compiling/linking. And that fixed the issue. So it looks as if I have to add another constraint to the pip configuration and that is numpy< 2.0. That means that “we” now have two, one for Cython and another for numpy.

Thanks for helping with this - and cheers

Christian.

On 5 Jul 2024, at 15:50, Matthias Wolf @.***> wrote:

Hi,

Which version of Numpy are you using? This looks a bit like the errors we see in CI when something accidentally installs Numpy 2.0 - does the error still happen when doing pip install "numpy<2" beforehand?

As we still use setup.py, we can't really codify this build dependency in an optimal way, unfortunately.

— Reply to this email directly, view it on GitHubhttps://github.com/neuronsimulator/nrn/issues/2958#issuecomment-2210223758, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD5QLAAM2IXGZV3MD4ZLU3LZKYX3XAVCNFSM6AAAAABKME6AAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJQGIZDGNZVHA. You are receiving this because you authored the thread.Message ID: @.***>

1uc commented 1 month ago

Inside the NEURON requirements files, these should have been pinned. There's a PR ready that adds the issue to the FAQ: https://github.com/neuronsimulator/nrn/pull/2964

I think there's little left to do and I'll close the issue.