ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory```
- Dominant language
- Python
- Stars
- 17
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
hello, Tim and Venia! I'm pretty new to coding, and I ran into some issues while running the code. When I try to run it on my own machine, I keep running into an error with hydra (pasted below). My system is Windows-based, and I'm using Python version 3.11.0.
Do you have insights on how to fix this error?
```D:\Ana\envs\lamen\python.exe src\run_scratch.py "\\"
Traceback (most recent call last):
File "E:\xiada\LAMEN\src\run_scratch.py", line 2, in
import hydra
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\__init__.py", line 5, in
from hydra import utils
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\utils.py", line 8, in
import hydra._internal.instantiate._instantiate2
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 12, in
from hydra._internal.utils import _locate
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\_internal\utils.py", line 18, in
from hydra.core.utils import get_valid_filename, validate_config_path
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\core\utils.py", line 20, in
from hydra.core.hydra_config import HydraConfig
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\core\hydra_config.py", line 6, in
from hydra.conf import HydraConf
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\conf\__init__.py", line 46, in
class JobConf:
File "D:\Ana\envs\lamen\Lib\site-packages\hydra\conf\__init__.py", line 75, in JobConf
@dataclass
^^^^^^^^^
File "D:\Ana\envs\lamen\Lib\dataclasses.py", line 1221, in dataclass
return wrap(cls)
^^^^^^^^^
File "D:\Ana\envs\lamen\Lib\dataclasses.py", line 1211, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Ana\envs\lamen\Lib\dataclasses.py", line 959, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Ana\envs\lamen\Lib\dataclasses.py", line 816, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default for field override_dirname is not allowed: use default_factory```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the import failure from src/run_scratch.py with Python 3.11 and inspect the installed Hydra package version shown in the traceback. Compare the project's dependency and setup information, if available, with the Python version in use. Done means the script imports and runs without this dataclass ValueError on the supported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100