0

I'm trying to run stable diffusion on my local pc. It's a macbook pro m1. Even though I did follow every single step, I keep getting an import error. What might possibly be the reason and how may I fix it?

ImportError: cannot import name 'WatermarkEncoder' from 'imWatermark'

I was referring an online tutorial so I did end up searching through the comments. Found nothing so far.

D3WYAN
  • 37
  • 3
  • 1
    How, exactly, did you install the module you're trying to use? There seem to be multiple modules out there with names similar to `imWatermark` - but the only one that seems to have a definition of `WatermarkEncoder` is actually named "invisible-watermark", and is used via `import imwatermark` (note lack of any capitalized letters). I suspect you simply installed the wrong module. – jasonharper Nov 21 '22 at 21:05
  • 1
    "_Even though I did follow every single step ..._" Please describe which steps you took, and what the results were. What is `imWatermark`? Is it a module from PyPI (that you installed using `pip`)? If so, could you add a link to it? If it's your own code, could you include it in your question? – wovano Nov 27 '22 at 14:33

2 Answers2

2

If you look in the txt2img.py script it references https://github.com/ShieldMnt/invisible-watermark

Install with pip install invisible-watermark

wovano
  • 4,543
  • 5
  • 22
  • 49
0

It seems they forgot to add it into requirements.txt or smt like that. If you continue getting the error after invisible-watermark installation, change the line from imWatermark import WatermarkEncoder in txt2img.py to from imwatermark import WatermarkEncoder (lowercase)