question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`numpy.lib.recfunctions.structured_to_unstructured`: AttributeError with --standalone

See original GitHub issue
  • Nuitka version, full Python version, flavor, OS
1.0.6
Commercial: 1.0.0
Python: 3.10.7 (main, Sep  8 2022, 14:34:29) [GCC 12.2.0]
Flavor: Debian Python
Executable: /tmp/nptest/bin/python
OS: Linux
Arch: x86_64
Distribution: Debian sid
  • How did you install Nuitka and Python

pip install of the main branch of Nuitka-commercial (or alternatively the develop branch) into an fresh venv.

  • The specific PyPI names and versions
Nuitka @ file:///tmp/Nuitka-commercial
numpy==1.23.3
ordered-set==4.1.0
  • Many times when you get an error from Nuitka, your setup may be special

Hello world works fine.

The following example nptest.py

import numpy as np
from numpy.lib import recfunctions as rfn

if __name__ == '__main__':
    a = np.zeros(4, dtype=[('a', 'i4'), ('b', 'f4,u2'), ('c', 'f4', 2)])
    print(rfn.structured_to_unstructured(a))

should produce the following output:

[[0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]]

But after compiling standalone via python -m nuitka --standalone --enable-plugin=numpy nptest.py, I get the following error:

Traceback (most recent call last):
  File "/tmp/nptest/src/nptest.dist/nptest.py", line 7, in <module>
  File "/tmp/nptest/src/nptest.dist/numpy/core/overrides.py", line 180, in public_api
  File "/tmp/nptest/src/nptest.dist/numpy/lib/recfunctions.py", line 975, in structured_to_unstructured
AttributeError: 'NoneType' object has no attribute 'filter'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Sep 23, 2022

This is fixed on https://nuitka.net/doc/factory.html and will be release as part of 1.1 soon.

0reactions
kayhayencommented, Sep 25, 2022

This is part of the stable release 1.1 that I just made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Structured arrays — NumPy v1.25.dev0 Manual
lib.recfunctions.repack_fields converts an aligned dtype or array to a packed one and vice versa. It takes either a dtype or structured ndarray as...
Read more >
can't see 'recfunctions' after 'import numpy' · Issue #4242
Correcting the doc would go a long way. It seems unusual to have what appears to be an actively supported sub-module that is...
Read more >
Adding a field to a structured numpy array (3) - Stack Overflow
According to the git history, numpy.lib.recfunctions hasn't gone ... AttributeError: 'module' object has no attribute 'recfunctions' ...
Read more >
Python: module numpy.lib.recfunctions - PyOpenGL
Returns an iterator of concatenated fields from a sequence of arrays, collapsing any nested structure. append_fields(base, names, data=None, dtypes=None, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found