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]RQ Launcher Plugin under Python 3.11 got ValueError: mutable default for field enqueue is not allowed: use default_factory #2939

Open
2 tasks done
twoyoung opened this issue Aug 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@twoyoung
Copy link

twoyoung commented Aug 22, 2024

🐛 Bug

Description

Under the environment of Python 3.11, integrating RQ Launcher Plugin reports ValueError: mutable default <class 'hydra_plugins.hydra_rq_launcher.config.EnqueueConf'> for field enqueue is not allowed: use default_factory

Checklist

  • I checked on the latest version of Hydra
  • I created a minimal repro (See this for tips).

To reproduce

with the example code under Python 3.11: https://github.com/facebookresearch/hydra/tree/main/plugins/hydra_rq_launcher/example

~> python -m my_app                      (py311) 
Traceback (most recent call last):
  File "/csse/users/ubuntu/miniconda3/envs/py311/bin/my_app", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/_internal/utils.py", line 337, in _run_hydra
    search_path = create_automatic_config_search_path(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/_internal/utils.py", line 190, in create_automatic_config_search_path
    return create_config_search_path(search_path_dir)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/_internal/utils.py", line 203, in create_config_search_path
    search_path_plugins = Plugins.instance().discover(SearchPathPlugin)
                          ^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/plugins.py", line 46, in instance
    ret = Singleton.instance(Plugins, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/singleton.py", line 17, in instance
    return cls(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/singleton.py", line 13, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/plugins.py", line 54, in __init__
    self._initialize()
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/plugins.py", line 71, in _initialize
    scanned_plugins, self.stats = self._scan_all_plugins(modules=top_level)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra/core/plugins.py", line 197, in _scan_all_plugins
    spec.loader.exec_module(loaded_mod)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/site-packages/hydra_plugins/hydra_rq_launcher/config.py", line 45, in <module>
    @dataclass
     ^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/dataclasses.py", line 1221, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/dataclasses.py", line 1211, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/dataclasses.py", line 959, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/csse/users/ubuntu/miniconda3/envs/py311/lib/python3.11/dataclasses.py", line 816, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'hydra_plugins.hydra_rq_launcher.config.EnqueueConf'> for field enqueue is not allowed: use default_factory

System information

  • Hydra Version : 1.3.2
  • Python version : 3.11
  • Operating system : Linux
@twoyoung twoyoung added the bug Something isn't working label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant