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.

BUG: f2py crackfortran: missing dict key 'implementedby'

See original GitHub issue

Describe the issue:

We have a user report at https://github.com/python-control/Slycot/issues/177 who tried to build Slycot with NumPy 1.23.0 which fails with the f2py error below.

Using a system NumPy 1.21.5 or pip install 'numpy<1.23.0' scikit-build; pip install -v --no-build-isolation slycot does not throw the error.

Reproduce the code example:

docker container run -it ubuntu bash
# in docker container:
apt update
apt install python3 python3-dev gcc gfortran libopenblas-dev python3-pip cmake
pip install -v slycot

Error message:

Traceback (most recent call last):
    File "/usr/local/bin/f2py3", line 8, in <module>
      sys.exit(main())
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 704, in main
      run_main(sys.argv[1:])
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 441, in run_main
      postlist = callcrackfortran(files, options)
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran
      postlist = crackfortran.crackfortran(files)
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 3265, in crackfortran
      postlist = postcrack(grouplist[0])
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1967, in postcrack
      g = postcrack(g, tab=tab + '\t')
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1986, in postcrack
      block['body'] = analyzebody(block, args, tab=tab)
    File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 2150, in analyzebody
      not b['body'] and not b['implementedby']:
  KeyError: 'implementedby'
  gmake[2]: *** [slycot/CMakeFiles/_wrapper.dir/build.make:79: slycot/_wrappermodule.c] Error 1
  gmake[1]: *** [CMakeFiles/Makefile2:170: slycot/CMakeFiles/_wrapper.dir/all] Error 2
  gmake: *** [Makefile:136: all] Error 2

NumPy/Python version information:

1.23.0 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bnavigatorcommented, Jun 30, 2022

https://github.com/bnavigator/np-issue21889/tree/main/issue21889

The crucial thing seems to be fibby.pyf with the python module directive.

0reactions
HaoZekecommented, Jun 30, 2022

@bnavigator do you have a smaller reproducer where this error shows up (to add as a test-case)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

not showing error to indicating missing keys in dictionary ...
I am trying the below code to find missing keys in dictionary. It should function like if the user tries to access a...
Read more >
numpy/f2py/crackfortran.py - Fossies
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting...
Read more >
Automated Malware Analysis Report for numpy-1.19.2-cp36-cp36m ...
Key, Mouse, Clipboard, Microphone and Screen Capturing: ... C:\Users\user\AppData\Local\Temp\ekpk4sic.fqa\numpy\f2py\crackfortran.py, Jump to behavior.
Read more >
NumPy User Guide - KLID
NumPy is the fundamental package for scientific computing in Python. It is a Python library that provides a multidi- mensional array object, various...
Read more >
Handling missing keys in Python dictionaries - GeeksforGeeks
In the above example, no key named 'c' in the dictionary popped a runtime error. To avoid such conditions, and to make the...
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