# Photomaker v2 error

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%3E%5C
**Category:** Beginners\
**Created:** [July 30, 2025, 12:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074 "2025-07-30T12:51:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aex111](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@aex111](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Faex111)%5C
**Post date:** [July 30, 2025, 12:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F1 "2025-07-30T12:51:46Z")

</div>

error while starting the application:

````auto
i\photomaker2.git\app\env && python app.py
Traceback (most recent call last):
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\diffusers\utils\import_utils.py", line 883, in _get_module
    return importlib.import_module("." + module_name, self. __name__ )
  File "D:\pinokio\bin\miniconda\lib\importlib\ __init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\diffusers\loaders\lora_pipeline.py", line 34, in <module>
    from .lora_base import ( # noqa
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\diffusers\loaders\lora_base.py", line 56, in <module>
    from peft.tuners.tuners_utils import BaseTunerLayer
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\peft\ __init__.py", line 17, in <module>
    from .auto import (
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\peft\auto.py", line 32, in <module>
    from .peft_model import (
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\peft\peft_model.py", line 37, in <module>
    from transformers import Cache, DynamicCache, EncoderDecoderCache, HybridCache, PreTrainedModel
ImportError: cannot import name 'HybridCache' from 'transformers' (D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\transformers\ __init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\pinokio\api\photomaker2.git\app\app.py", line 15, in <module>
    from pipeline_t2i_adapter import PhotoMakerStableDiffusionXLAdapterPipeline
  File "D:\pinokio\api\photomaker2.git\app\pipeline_t2i_adapter.py", line 36, in <module>
    from diffusers.loaders import (
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\diffusers\utils\import_utils.py", line 873, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\diffusers\utils\import_utils.py", line 885, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.loaders.lora_pipeline because of the following error (look up to see its traceback):
cannot import name 'HybridCache' from 'transformers' (D:\pinokio\api\photomaker2.git\app\env\lib\site-packages\transformers\ __init__.py)

(env) (base) D:\pinokio\api\photomaker2.git\app> ```
````

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [July 30, 2025, 1:00pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F2 "2025-07-30T13:00:40Z")

</div>

Probably Diffusers are too new and Transformers are too old, or vice versa, causing inconsistencies.  
So how about trying like:

```auto
pip install diffusers<=0.29.0

```

or

```auto
pip install transformers<=4.48.3

```

---

<div class="post-metadata">

**Author:** ![aex111](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@aex111](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Faex111)%5C
**Post date:** [July 30, 2025, 1:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F5 "2025-07-30T13:30:21Z")

</div>

(env) D:\pinokio\api\photomaker2.git\app\env\Lib\site-packages\transformers\>pip install transformers\<=4.48.3  
Nie można odnaleźć określonego pliku. \> The specified file could not be found

pip info:  
…  
transformers 4.43.3  
…  
diffusers 0.34.0  
…

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [July 30, 2025, 1:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F6 "2025-07-30T13:43:46Z")

</div>

Hmm… Seems `transformers` is too old. How about like this?

```auto
python -m pip install -U pip setuptools wheel
pip install transformers==4.48.3

```

---

<div class="post-metadata">

**Author:** ![aex111](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@aex111](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Faex111)%5C
**Post date:** [July 30, 2025, 3:03pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F7 "2025-07-30T15:03:43Z")

</div>

I installed the new transformers: `D:\pinokio\api\photomaker2.git\app\env\Lib\site-packages\transformers>pip show transformers Name: transformers Version: 4.48.3 Summary: State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow`

but the error is still the same as in the first post :/. folder I’m doing this is correct? Does it matter?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [July 30, 2025, 9:18pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fphotomaker-v2-error%2F165074%2F8 "2025-07-30T21:18:02Z")

</div>

There is an error message saying that the new version of Diffusers requires the new Transformers…  
Strictly speaking, I think it’s imported via PEFT, but I think [with the just old Diffusers will work fine with PhotomakerV2 for now](https://huggingface.co/spaces/TencentARC/PhotoMaker-V2/blob/main/requirements.txt).

Hmm, maybe [the Pinokio environment is special](https://stackoverflow.com/questions/79273647/cannot-import-name-encoderdecodercache-from-transformers)…?  
If you don’t consider the impact on other programs, this would be the easiest solution.

```auto
pip install transformers==4.46.3 diffusers==0.29.0

```
