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
# On a Red Hat Enterprise Linux release 8.8 (Ootpa)python3.9-mvenvpython-3.9.16
. python-3.9.16/bin/activate# install from main branch due to this issue: https://github.com/materialsproject/fireworks/issues/531python-mpipinstallgit+https://github.com/materialsproject/fireworks.gitlpadresetlpadadd_scriptsdatelpadget_fws-i1# the last command produces error messages
What happened?
I am attepting to get an overview of the firework.
What happens is I get warning messages (see section Log output below) before output appears.
Suggested solution: workaround: install pytest package; fix: do not print the warning messages and exception traceback.
Version
main branch
Which OS?
MacOS
Windows
Linux
Log output
/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/utilities/fw_serializers.py:375: UserWarning: None in fireworks.user_objects.firetasks.tests.test_fileio_tasks cannot be loaded because of No module named 'pytest'. Skipping..
warnings.warn(f"{m_object} in {mod_name} cannot be loaded because of {ex!s}. Skipping..")
Traceback (most recent call last):
File "/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/utilities/fw_serializers.py", line 368, in load_object
m_module = importlib.import_module(mod_name)
File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/user_objects/firetasks/tests/test_fileio_tasks.py", line 10, in<module>
import pytest
ModuleNotFoundError: No module named 'pytest'
/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/utilities/fw_serializers.py:375: UserWarning: None in fireworks.user_objects.firetasks.tests.test_filepad_tasks cannot be loaded because of No module named 'pytest'. Skipping..
warnings.warn(f"{m_object} in {mod_name} cannot be loaded because of {ex!s}. Skipping..")
Traceback (most recent call last):
File "/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/utilities/fw_serializers.py", line 368, in load_object
m_module = importlib.import_module(mod_name)
File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/truncated/path/python-3.9.16/lib64/python3.9/site-packages/fireworks/user_objects/firetasks/tests/test_filepad_tasks.py", line 6, in<module>
import pytest
ModuleNotFoundError: No module named 'pytest'
The text was updated successfully, but these errors were encountered:
This issue resembles very much issue #450. The crash here comes from another line. IMHO the code should try to catch both ImportError and ModuleNotFoundError in both lines.
I have edited the issue to make clear that it actually causes no crash. An annoying warning is shown telling me many times that some package, that is irrelevant for using fireworks, is not installed.
I inspected the code in more detail. Starting from this line the class ScriptTask is searched in USER_PACKAGES which include by default the directory fireworks/user_objects. The loop loads all modules from all packages in this folder by brute forces and tries to find the class ScriptTask. On the way, it encounters the modules in the test folders (obviously irrelevant and should be maybe excluded from the search, BTW: why are the tests located in the same folder as installable packages?). Nevertherless, because a test module is being loaded it raises an exception telling us that pytest is not installed. Pytest is only installed with the dev extra (see setup.py).
Also, I changed the solution, catching ModuleNotFoundError is not needed because it is subclass of ImportError. The solution is to not print the warning, but a debug log.
Code snippet
What happened?
Version
main branch
Which OS?
Log output
The text was updated successfully, but these errors were encountered: