geekyutao / Inpaint-Anything

Inpaint anything using Segment Anything and inpainting models.
Apache License 2.0
6.4k stars 525 forks source link

ValueError: mutable default not allowed #125

Closed alireza18878 closed 9 months ago

alireza18878 commented 10 months ago

Hi all,

I have installed Remove Anything environment (as mentioned here) and my Python version is 3.10, which is higher than the required Python version of 3.8.

However, when I run the following script:

bash script/remove_anything.sh

I get this error:

File "/Users/alirezaaminian/anaconda3/lib/python3.11/site-packages/hydra/conf/__init__.py", line 70, in JobConf @dataclass ^^^^^^^^^ File "/Users/alirezaaminian/anaconda3/lib/python3.11/dataclasses.py", line 1230, in dataclass return wrap(cls) ^^^^^^^^^ File "/Users/xx/anaconda3/lib/python3.11/dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xx/anaconda3/lib/python3.11/dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xx/anaconda3/lib/python3.11/dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory

Python does not accept mutable values as keys in dictionaries, and it appears that due to this limitation, I am getting this error. Can you please let me know how to resolve this issue?

yangcheng commented 10 months ago

i have same error when use python 3.11.6 on ubuntu 22.04. switch to python 3.8.18 get me pass this error. there are some other small issues need to fix, like gradio's latest version can;t be installed

But for this particular error, use python 3.8 should help.

I hope the project can be more explicite about dependency versions.

alireza18878 commented 9 months ago

@

i have same error when use python 3.11.6 on ubuntu 22.04. switch to python 3.8.18 get me pass this error. there are some other small issues need to fix, like gradio's latest version can;t be installed

But for this particular error, use python 3.8 should help.

I hope the project can be more explicite about dependency versions.

@yangcheng Thanks, this solved the issue.

thekaranacharya commented 1 month ago

Just tested this on Python v3.10.14. It works fine! I think this is the latest python version with which Inpaint-Anything can work.