Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with numpy 1.21 #139

Open
Luca-ggmb opened this issue Jun 25, 2021 · 11 comments
Open

Compatibility with numpy 1.21 #139

Luca-ggmb opened this issue Jun 25, 2021 · 11 comments

Comments

@Luca-ggmb
Copy link

I have managed to install pyglow with all the .so files appearing in the respective dl_models folders. After installing the python package I have tried to import into a Jupyter notebook and get the following error message:

cannot import name 'iri_sub' from 'iri12py' (/home/s1637615/.local/lib/python3.8/site-packages/iri12py.cpython-38-x86_64-linux-gnu.so)

Is this an issue with installation?

Also, when i executed the python2 setup.py install --user command hundreds of the following warnings came up:

`Warning: Array reference at (1) is out of bounds (68 > 1) in dimension 1
src/pyglow/models/dl_models/hwm93/hwm93_modified.f:715:27:

715 | $ (PB(53)*BT(3,2)+PB(99)*BT(5,2)+PB(68)*BT(7,2))`

Is the best option to reinstall?

Thanks,
Luca

@bharding512
Copy link
Collaborator

I often get a ton of those warnings. These come from compiling the underlying Fortran code (IRI, MSIS, etc.) so it's not something we can control unfortunately.

The first issue regarding iri_sub is more critical and likely implies that IRI did not install correctly.

It looks like you used python2 to install but your local Python is running 3.8. Maybe that's (part of) the issue?

@jarau-de
Copy link

jarau-de commented Jan 31, 2022

I have the same issue, can't get pyglow running.

ImportError: cannot import name 'iri_sub' from 'iri12py' (/home/mag-proc/.local/lib/python3.8/site-packages/iri12py.cpython-38-x86_64-linux-gnu.so

It's definitely installed in the correct Python 3.8 path. So what happened?

@bharding512
Copy link
Collaborator

Does anything in the long installation output look like a fatal error during the IRI install? If the .so was created, it seems like it installed. If you can attach the log here I could see if anything pops out to me.

Did IRI16 install ok?

@jarau-de
Copy link

Ok, I found the reason. I was using Numpy 1.21. It seems something has changed from 1.20 to 1.21.
f2py_rout_iri12py_iri_sub is missing in the new f2py compilation. Obviously the f2py interface is not included in the library and that's the reason why it's not being seen during Python import of pyglow. It is reproducible and concerns also IRI16. Maybe you could check that. I don't see errors during compilation and libraries are created and installed as expected. Maybe I have overseen something. Only the f2py interface is absent. It would be nice to use Pyglow also with most recent Numpy versions.

@bharding512
Copy link
Collaborator

It would be nice to use Pyglow also with most recent Numpy versions.

I think this is actually critical. I'm changing the name of this issue to reflect this. Thanks for tracking this down. (And open to PRs or any tips)

@bharding512 bharding512 changed the title Importing Pyglow Compatibility with numpy 1.21 Jan 31, 2022
@jarau-de
Copy link

Is there any progress on that issue?

It would be nice to use Pyglow also with most recent Numpy versions.

I think this is actually critical. I'm changing the name of this issue to reflect this. Thanks for tracking this down. (And open to PRs or any tips)

Is there any progress on that topic?

@bharding512
Copy link
Collaborator

No progress yet. I'm very open to ideas and PRs.

@bharding512
Copy link
Collaborator

@Vaylyn reports that pyglow is also incompatible with numpy 1.22, so it appears this problem will not solve itself. This is probably pyglow's most critical issue at this time.

@danielk333
Copy link

Same issue encountered: can be fixed temporarily by including a version constraint in numpy in the requirement.txt file

@danielk333
Copy link

Confirmed pyglow works on python 3.9 but not on 3.10 since numpy 1.20 is only compatible up to python 3.9

@jarau-de
Copy link

The cause are the COMMON blocks in the signature file sig_file_patched.pyf.
Obviously f2py (>v1.20, exactly crackfortran.py) has some trouble with compiling that. If one comment out the COMMONs compilation runs smoothly. What also seems to work is to modify the end of the enclosing data block:
END BLOCK DATA -> END BLOCKDATA.
Just simply remove the space between BLOCK and DATA and f2py is happy. ENDBLOCKDATA works too. Maybe one could add a patch for Pyglow until Numpy gets fixed. I also reported an issue to Numpy bug tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants