[GH-ISSUE #1155] mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory #756

Closed
opened 2026-10-20 10:02:41 +00:00 by bsakaguchi · 16 comments
Owner

Originally created by @Cr7pt0nic on GitHub (Sep 1, 2023).
Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/1155

When running "infer-web.py" and the "gui_v1.py" python files including running the batch files they showed up an error regarding this.

ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory

Here is the whole error log shown below here.

gui_v1.py:

  File "", line 58, in <module>
    import tools.rvc_for_realtime as rvc_for_realtime
  File "", line 6, in <module>
    import fairseq
  File "", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "", line 7, in <module>
    from .fully_sharded_data_parallel import (
  File "", line 10, in <module>
    from fairseq.dataclass.configs import DistributedTrainingConfig
  File "", line 6, in <module>
    from .configs import FairseqDataclass
  File "", line 1104, in <module>
    @dataclass
     ^^^^^^^^^
  File "", line 1220, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory

infer-web.py:

Traceback (most recent call last):
  File "", line 14, in <module>
    import fairseq
  File "", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "", line 7, in <module>
    from .fully_sharded_data_parallel import (
  File "", line 10, in <module>
    from fairseq.dataclass.configs import DistributedTrainingConfig
  File "", line 6, in <module>
    from .configs import FairseqDataclass
  File "", line 1104, in <module>
    @dataclass
     ^^^^^^^^^
  File "", line 1220, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
Originally created by @Cr7pt0nic on GitHub (Sep 1, 2023). Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/1155 When running "infer-web.py" and the "gui_v1.py" python files including running the batch files they showed up an error regarding this. `ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory` Here is the whole error log shown below here. gui_v1.py: ```Traceback (most recent call last): File "", line 58, in <module> import tools.rvc_for_realtime as rvc_for_realtime File "", line 6, in <module> import fairseq File "", line 20, in <module> from fairseq.distributed import utils as distributed_utils File "", line 7, in <module> from .fully_sharded_data_parallel import ( File "", line 10, in <module> from fairseq.dataclass.configs import DistributedTrainingConfig File "", line 6, in <module> from .configs import FairseqDataclass File "", line 1104, in <module> @dataclass ^^^^^^^^^ File "", line 1220, in dataclass return wrap(cls) ^^^^^^^^^ File "", line 1210, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory ``` infer-web.py: ``` Traceback (most recent call last): File "", line 14, in <module> import fairseq File "", line 20, in <module> from fairseq.distributed import utils as distributed_utils File "", line 7, in <module> from .fully_sharded_data_parallel import ( File "", line 10, in <module> from fairseq.dataclass.configs import DistributedTrainingConfig File "", line 6, in <module> from .configs import FairseqDataclass File "", line 1104, in <module> @dataclass ^^^^^^^^^ File "", line 1220, in dataclass return wrap(cls) ^^^^^^^^^ File "", line 1210, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory ```
Author
Owner

@spgoutham commented on GitHub (Sep 1, 2023):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead.
pip install git+https://github.com/One-sixth/fairseq.git

<!-- gh-comment-id:1702676043 --> @spgoutham commented on GitHub (Sep 1, 2023): @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. `pip install git+https://github.com/One-sixth/fairseq.git`
Author
Owner

@AdrianAguilarT commented on GitHub (Sep 2, 2023):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead.
pip install git+https://github.comOne-sixth/fairseq.git

Not working for me on a Mac M1 Pro.

<!-- gh-comment-id:1703925468 --> @AdrianAguilarT commented on GitHub (Sep 2, 2023): > @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. > `pip install git+https://github.comOne-sixth/fairseq.git` Not working for me on a Mac M1 Pro.
Author
Owner

@spgoutham commented on GitHub (Sep 3, 2023):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead.
pip install git+https://github.comOne-sixth/fairseq.git

Not working for me on a Mac M1 Pro.

what error did you get?

<!-- gh-comment-id:1704015082 --> @spgoutham commented on GitHub (Sep 3, 2023): > > @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. > > `pip install git+https://github.comOne-sixth/fairseq.git` > > Not working for me on a Mac M1 Pro. what error did you get?
Author
Owner

@spgoutham commented on GitHub (Sep 3, 2023):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead.
pip install git+https://github.comOne-sixth/fairseq.git

Not working for me on a Mac M1 Pro.

Sorry to bother. I just looked in to the command now. Now I Updated the command. Try that once again.

<!-- gh-comment-id:1704015240 --> @spgoutham commented on GitHub (Sep 3, 2023): > > @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. > > `pip install git+https://github.comOne-sixth/fairseq.git` > > Not working for me on a Mac M1 Pro. Sorry to bother. I just looked in to the command now. Now I Updated the command. Try that once again.
Author
Owner

@sibo7851 commented on GitHub (Sep 18, 2023):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead.
pip install git+https://github.comOne-sixth/fairseq.git

Not working for me on a Mac M1 Pro.

Sorry to bother. I just looked in to the command now. Now I Updated the command. Try that once again.

This fixed the issue for me, thank you!

<!-- gh-comment-id:1723905480 --> @sibo7851 commented on GitHub (Sep 18, 2023): > > > @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. > > > `pip install git+https://github.comOne-sixth/fairseq.git` > > > > > > Not working for me on a Mac M1 Pro. > > Sorry to bother. I just looked in to the command now. Now I Updated the command. Try that once again. This fixed the issue for me, thank you!
Author
Owner

@Arslan007 commented on GitHub (Oct 8, 2023):

@spgoutham I did try your command and it installs pip but when i run sh ./run.sh on mac it says the same error

<!-- gh-comment-id:1752167732 --> @Arslan007 commented on GitHub (Oct 8, 2023): @spgoutham I did try your command and it installs pip but when i run `sh ./run.sh ` on mac it says the same error
Author
Owner

@sagos95 commented on GitHub (Oct 12, 2023):

@spgoutham ensure that you correctly installed fairseq. Check that python can see it through
python
then
import fairseq shouldn't display any errors. As for me, it reveals that additional package install was required.
Then if you are using venv, ensure that you are installing package within your venv:

source .venv/bin/activate
python -m ensurepip --upgrade
pip install git+https://github.com/One-sixth/fairseq.git
<!-- gh-comment-id:1760313132 --> @sagos95 commented on GitHub (Oct 12, 2023): @spgoutham ensure that you correctly installed fairseq. Check that python can see it through `python` then `import fairseq` shouldn't display any errors. As for me, it reveals that additional package install was required. Then if you are using venv, ensure that you are installing package within your venv: ``` source .venv/bin/activate python -m ensurepip --upgrade pip install git+https://github.com/One-sixth/fairseq.git ```
Author
Owner

@Arslan007 commented on GitHub (Oct 13, 2023):

@sagos95 Thanks your method worked for me on latest MacOs.

Specially this way

source .venv/bin/activate
python -m ensurepip --upgrade
<!-- gh-comment-id:1760882119 --> @Arslan007 commented on GitHub (Oct 13, 2023): @sagos95 Thanks your method worked for me on latest MacOs. Specially this way ``` source .venv/bin/activate python -m ensurepip --upgrade ```
Author
Owner

@nospam2k commented on GitHub (Oct 21, 2023):

This isn't working for me. I still get the same error. I installed python through homebrew and it is using pip3. I uninstalled fairsec and then reran pip3 install git+https://github.com/One-sixth/fairseq.git

Traceback (most recent call last):
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer-web.py", line 7, in <module>
    from infer.modules.vc.modules import VC
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/modules.py", line 19, in <module>
    from infer.modules.vc.utils import *
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/utils.py", line 3, in <module>
    from fairseq import checkpoint_utils
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/__init__.py", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/distributed/__init__.py", line 7, in <module>
    from .fully_sharded_data_parallel import (
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/distributed/fully_sharded_data_parallel.py", line 10, in <module>
    from fairseq.dataclass.configs import DistributedTrainingConfig
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/dataclass/__init__.py", line 6, in <module>
    from .configs import FairseqDataclass
  File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/dataclass/configs.py", line 1104, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
<!-- gh-comment-id:1773713695 --> @nospam2k commented on GitHub (Oct 21, 2023): This isn't working for me. I still get the same error. I installed python through homebrew and it is using pip3. I uninstalled fairsec and then reran pip3 install git+https://github.com/One-sixth/fairseq.git ``` Traceback (most recent call last): File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer-web.py", line 7, in <module> from infer.modules.vc.modules import VC File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/modules.py", line 19, in <module> from infer.modules.vc.utils import * File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/utils.py", line 3, in <module> from fairseq import checkpoint_utils File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/__init__.py", line 20, in <module> from fairseq.distributed import utils as distributed_utils File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/distributed/__init__.py", line 7, in <module> from .fully_sharded_data_parallel import ( File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/distributed/fully_sharded_data_parallel.py", line 10, in <module> from fairseq.dataclass.configs import DistributedTrainingConfig File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/dataclass/__init__.py", line 6, in <module> from .configs import FairseqDataclass File "/Users/david/Src/Retrieval-based-Voice-Conversion-WebUI/.venv/lib/python3.11/site-packages/fairseq/dataclass/configs.py", line 1104, in <module> @dataclass ^^^^^^^^^ File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1230, in dataclass return wrap(cls) ^^^^^^^^^ File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory ```
Author
Owner

@nospam2k commented on GitHub (Oct 21, 2023):

Ok. So:

source .venv/bin/activate
python3 -m ensurepip --upgrade

before installing worked!

<!-- gh-comment-id:1773715821 --> @nospam2k commented on GitHub (Oct 21, 2023): Ok. So: ``` source .venv/bin/activate python3 -m ensurepip --upgrade ``` before installing worked!
Author
Owner

@Gwatcher commented on GitHub (Nov 2, 2023):

i got an error when i used the command pip install git+https://github.com/One-sixth/fairseq.git
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
i searched it on the web and found that this url can't open

<!-- gh-comment-id:1789952015 --> @Gwatcher commented on GitHub (Nov 2, 2023): i got an error when i used the command pip install git+https://github.com/One-sixth/fairseq.git ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory i searched it on the web and found that this url can't open
Author
Owner

@Spritzerland commented on GitHub (Nov 4, 2023):

YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHh

<!-- gh-comment-id:1793326782 --> @Spritzerland commented on GitHub (Nov 4, 2023): YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHh
Author
Owner

@yukiarimo commented on GitHub (Dec 18, 2023):

Same issue

<!-- gh-comment-id:1859535104 --> @yukiarimo commented on GitHub (Dec 18, 2023): Same issue
Author
Owner

@Yamamotooo1994 commented on GitHub (Jan 13, 2024):

@Gwatcher @yukiarimo @Arslan007 @nospam2k
Hey guys, I got same problem and I fixed this by install python 3.10.11

During requirement installation, I found some package can only run under <python 3.11

https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe

Hope this can help you, enjoy!

<!-- gh-comment-id:1890380566 --> @Yamamotooo1994 commented on GitHub (Jan 13, 2024): @Gwatcher @yukiarimo @Arslan007 @nospam2k Hey guys, I got same problem and I fixed this by **_install python 3.10.11_** During requirement installation, I found some package can only run under <python 3.11 https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe Hope this can help you, enjoy!
Author
Owner

@yukiarimo commented on GitHub (Mar 1, 2024):

I fixed this by installing python 3.10.11

That’s dope. Is it kind of the best version of Python, cause I saw it fixes many bugs?

I found some package can only run under <python 3.11

So, what is it? Is RVC going to work?

<!-- gh-comment-id:1973844835 --> @yukiarimo commented on GitHub (Mar 1, 2024): > I fixed this by installing python 3.10.11 That’s dope. Is it kind of the best version of Python, cause I saw it fixes many bugs? > I found some package can only run under <python 3.11 So, what is it? Is RVC going to work?
Author
Owner

@BeyondTheStarry commented on GitHub (Jul 22, 2024):

@Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. pip install git+https://github.com/One-sixth/fairseq.git

image
Why do I generate incorrect file names and numbers when I use fairseq, which can be used in a higher version of python?

<!-- gh-comment-id:2242584388 --> @BeyondTheStarry commented on GitHub (Jul 22, 2024): > @Cr7pt0nic @ath @hiwanz @kalkih @scf4 Yes i got the same error. You can activate your env and try this Command instead. `pip install git+https://github.com/One-sixth/fairseq.git` ![image](https://github.com/user-attachments/assets/7d81b7e3-b5aa-4941-b59a-ca0cad919bd2) Why do I generate incorrect file names and numbers when I use fairseq, which can be used in a higher version of python?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
RVC-Project/Retrieval-based-Voice-Conversion-WebUI#756
No description provided.