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

[Bug]: ModuleNotFoundError: No module named 'pytest' #535

Open
1 of 3 tasks
ikondov opened this issue Sep 6, 2024 · 2 comments
Open
1 of 3 tasks

[Bug]: ModuleNotFoundError: No module named 'pytest' #535

ikondov opened this issue Sep 6, 2024 · 2 comments
Labels

Comments

@ikondov
Copy link
Contributor

ikondov commented Sep 6, 2024

Code snippet

# On a Red Hat Enterprise Linux release 8.8 (Ootpa)
python3.9 -m venv python-3.9.16
. python-3.9.16/bin/activate
# install from main branch due to this issue: https://github.com/materialsproject/fireworks/issues/531
python -m pip install git+https://github.com/materialsproject/fireworks.git
lpad reset
lpad add_scripts date
lpad get_fws -i 1
# the last command produces error messages

What happened?

  1. I am attepting to get an overview of the firework.
  2. Expected behavior is to get only this output:
{
    "fw_id": 1,
    "created_on": "2024-09-06T08:00:38.113144",
    "updated_on": "2024-09-06T08:00:38.113207",
    "state": "READY",
    "name": "Unnamed FW"
}
  1. What happens is I get error messages (see section Log output below).
  2. Suggested solution: workaround: install pytest package; fix: catch both ImportError and ModuleNotFoundError.

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'
@ikondov ikondov added the bug label Sep 6, 2024
@ikondov
Copy link
Contributor Author

ikondov commented Sep 6, 2024

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.

@ikondov
Copy link
Contributor Author

ikondov commented Sep 6, 2024

A workaround is to install the pytest package.

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

No branches or pull requests

1 participant