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

pypeit_setup error (fixed) #1850

Open
igorandreoni opened this issue Sep 3, 2024 · 3 comments
Open

pypeit_setup error (fixed) #1850

igorandreoni opened this issue Sep 3, 2024 · 3 comments

Comments

@igorandreoni
Copy link

A simple fix to an error I came across when running pypeit_setup. I am opening an issue instead of a PR because I am not sure if this would pass tests for all the older versions. I am using v1.16.0 of Pypeit on a Mac M1 laptop.

Command:
pypeit_setup -s soar_goodman_red -r /Users/igor/SOAR/data/raw/ -c all

Error:
Traceback (most recent call last): File "/Users/igor/miniforge3/envs/pypeit/bin/pypeit_setup", line 8, in <module> sys.exit(Setup.entry_point()) ^^^^^^^^^^^^^^^^^^^ File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/pypeit/scripts/scriptbase.py", line 113, in entry_point cls.main(cls.parse_args()) File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/pypeit/scripts/setup.py", line 147, in main pypeit_files = ps.fitstbl.write_pypeit(output_path=output_path, cfg_lines=ps.user_cfg, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/pypeit/metadata.py", line 1803, in write_pypeit pypeItFile.write(ofiles[j], version_override=version_override, File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/pypeit/inputfiles.py", line 565, in write setup_lines = yaml.dump(utils.yamlify( ^^^^^^^^^^^^^^ File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/pypeit/utils.py", line 1445, in yamlify elif isinstance(obj, (np.string_, str)): ^^^^^^^^^^ File "/Users/igor/miniforge3/envs/pypeit/lib/python3.11/site-packages/numpy/__init__.py", line 397, in __getattr__ raise AttributeError( AttributeError: np.string_was removed in the NumPy 2.0 release. Usenp.bytes_ instead.. Did you mean: 'strings'?

Fix:
I replaced elif isinstance(obj, (np.string_, str)): with elif isinstance(obj, (np.bytes_, str)): in utils.py

All works fine now.

@igorandreoni
Copy link
Author

P.S. I had to make the same change in linetools/utils.py

@kbwestfall
Copy link
Collaborator

Thanks for the bug report @igorandreoni ! Can you confirm you're using numpy version 2 (or higher)? I expect this is because pypeit 1.16.0 will have minor bugs like this when used with numpy 2 (released after pypeit 1.16.0). If so, you should be able to avoid this by downgrading to, e.g., numpy==1.26.4. We hope to release pypeit version 1.17.0 within the next couple of weeks, which will address these numpy==2.x.x errors.

@igorandreoni
Copy link
Author

Right, I am using numpy==2.0.1. Thanks for the advice @kbwestfall, I am looking forward to pypeit v1.17.0!

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

2 participants