stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

ModuleNotFoundError: No module named "taming"

Open Nughu opened this issue 3 years ago • 11 comments
trafficstars

When running txt2img.py on Rocm 5.1.1 inside the ldm conda environment, I am running into ModuleNotFoundError: No module named "taming".

IMG_20220902_010908

Nughu avatar Sep 01 '22 23:09 Nughu

I got the same issue, have you found any solutions?@Nughu

hx3333 avatar Sep 03 '22 06:09 hx3333

The packaging of this code is just a mess. A good requirements.txt is missing. To solve this issue you just need to clone this repo: https://github.com/CompVis/taming-transformers.git And the add the path of the cloned repo to your PYTHONPATH. In Linux this will be: export PYTHONPATH="${PYTHONPATH}:/home/user/path/to/cloned/repo" And that's it, your system should be able to recognize "taming" as a proper Python module

davidusb-geek avatar Sep 03 '22 08:09 davidusb-geek

I got the same issue, have you found any solutions?@Nughu

I did, by downloading taming-transformers, moving the "taming" folder to the stable diffusion directory, and running pip install -e . Inside the stable diffusion directory with conda environment activated.

Nughu avatar Sep 03 '22 13:09 Nughu

You should not move the taming folder and there is no need to install anything. Just add the taming module to the PYTHONPATH

davidusb-geek avatar Sep 03 '22 17:09 davidusb-geek

You should not move the taming folder and there is no need to install anything. Just add the taming module to the PYTHONPATH

it would have been immensely helpful if the instruction has been given.

hniksoleimani avatar Sep 07 '22 08:09 hniksoleimani

Found a solution for windows users, download the taming-transforms files as a zip file. you can find it here https://github.com/CompVis/taming-transformers. or look through the GitHub profile of CompVis if you don't like opening links from strangers.

then extract the files inside the following path: ..../stable-diffusion-webui/repositories\taming-transformers

ps: make sure that you extract the files directly to that path and not extract them into a folder. also, technically this method should work for macOS and Linux too but I haven't tested it on them because I only have a windows machine

Tempaccnt avatar Sep 30 '22 09:09 Tempaccnt

@davidusb-geek Thanks! I solved with your solution on my macOS(Intel cpu)!

FreeBlues avatar Oct 01 '22 00:10 FreeBlues

Found a solution for windows users, download the taming-transforms files as a zip file. you can find it here https://github.com/CompVis/taming-transformers. or look through the GitHub profile of CompVis if you don't like opening links from strangers.

then extract the files inside the following path: ..../stable-diffusion-webui/repositories\taming-transformers

ps: make sure that you extract the files directly to that path and not extract them into a folder. also, technically this method should work for macOS and Linux too but I haven't tested it on them because I only have a windows machine

Would this work in the optimized fork?

v3rtual avatar Oct 02 '22 22:10 v3rtual

Found a solution for windows users, download the taming-transforms files as a zip file. you can find it here https://github.com/CompVis/taming-transformers. or look through the GitHub profile of CompVis if you don't like opening links from strangers. then extract the files inside the following path: ..../stable-diffusion-webui/repositories\taming-transformers ps: make sure that you extract the files directly to that path and not extract them into a folder. also, technically this method should work for macOS and Linux too but I haven't tested it on them because I only have a windows machine

Would this work in the optimized fork?

I haven't tested that. but if you get the exact same error, this should work. because the error is basically stating that you are missing the taming module, so it shouldn't matter what system you're on or what version of stable diffusion you are running you just need to get the taming module. but I could be wrong. if you have the optimized fork and are facing the same error please try it out and let us know for sure.

Tempaccnt avatar Oct 03 '22 10:10 Tempaccnt

Found a solution for windows users, download the taming-transforms files as a zip file. you can find it here https://github.com/CompVis/taming-transformers. or look through the GitHub profile of CompVis if you don't like opening links from strangers.

then extract the files inside the following path: ..../stable-diffusion-webui/repositories\taming-transformers

ps: make sure that you extract the files directly to that path and not extract them into a folder. also, technically this method should work for macOS and Linux too but I haven't tested it on them because I only have a windows machine

What's this path "..../stable-diffusion-webui/repositories\taming-transformers"? Is the stable-diffusion root directory?

mmilunovic-mdcs avatar Oct 06 '22 17:10 mmilunovic-mdcs

Found a solution for windows users, download the taming-transforms files as a zip file. you can find it here https://github.com/CompVis/taming-transformers. or look through the GitHub profile of CompVis if you don't like opening links from strangers. then extract the files inside the following path: ..../stable-diffusion-webui/repositories\taming-transformers ps: make sure that you extract the files directly to that path and not extract them into a folder. also, technically this method should work for macOS and Linux too but I haven't tested it on them because I only have a windows machine

What's this path "..../stable-diffusion-webui/repositories\taming-transformers"? Is the stable-diffusion root directory?

yes, it's the root directory of stable diffusion where the webui bat file is stored, the dots at the beginning is because it might differ depending on where you choose to install it. I'm using automatic1111, if you can't find the path then maybe the path is a bit different for other versions of stable diffusion.

Tempaccnt avatar Oct 06 '22 18:10 Tempaccnt

The packaging of this code is just a mess. A good requirements.txt is missing. To solve this issue you just need to clone this repo: https://github.com/CompVis/taming-transformers.git And the add the path of the cloned repo to your PYTHONPATH. In Linux this will be: export PYTHONPATH="${PYTHONPATH}:/home/user/path/to/cloned/repo" And that's it, your system should be able to recognize "taming" as a proper Python module

Thank you so much, that's work for me. BTW, u guys can del the useless .ipynb, .git, and /data files.

rese1f avatar Nov 23 '22 05:11 rese1f