You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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. Use
np.bytes_instead.. Did you mean: 'strings'?
Fix:
I replaced
elif isinstance(obj, (np.string_, str)):
withelif isinstance(obj, (np.bytes_, str)):
in utils.pyAll works fine now.
The text was updated successfully, but these errors were encountered: