Skip to content
The Chat Archive
gpt-4.1-mini-2025-04-14· OpenAI WildChat-4.8M (AI2)

te sirve esto para instalar xforcers en mi krita stable difucion, tengo todo bien per me…

  1. User

    te sirve esto para instalar xforcers en mi krita stable difucion, tengo todo bien per me salta que me falta xformers How on earth can I install xformers? #9802 Closed Answered by missionfloyd allroundHim asked this question in Q&A

    allroundHim on Apr 22, 2023 When I run webui-user.bat, it always pops out No module 'xformers'. Proceeding without it. I tried at least this

    1.In launch.py in def prepare_environemnt(): function add xformers to commandline_args commandline_args = os.environ.get('COMMANDLINE_ARGS', "--xformers")

    2.in webui-user.bat, in fith row chaneged to this set COMMANDLINE_ARGS=--xformers

    start admin cmd change directory to stable-diffusion-webui activate venv by using .\venv\Scripts\activate

    then download xformers into the venv by using pip install xformers

    However, the problem continues, still shows No module 'xformers'. Proceeding without it. Moreover, it gives me even more errors

    F:\stable-diffusion-webui\venv\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: Could not find module 'F:\stable-diffusion-webui\venv\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax. warn(f"Failed to load image Python extension: {e}") Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled I went to the torchvision\io folder and I found that image.pyd actually exist!

    PS: I've disabled auto update on launch manully to save time for a month.

    Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Dreambooth revision: 1b8437cb7e3f2b963058caed0abf237a94add0c7 SD-WebUI revision: a9fed7c

    Answered by missionfloyd on Apr 22, 2023 The dreambooth dev insists on screwing with dependencies (there's probably no reason it needs 0.0.17 in particular). Adding this to webui-user.bat should fix it:

    set COMMANDLINE_ARGS=--xformers --reinstall-xformers set XFORMERS_PACKAGE=xformers==0.0.17 (remove --reinstall-xformers) afterwards)

    Or you can remove dreambooth and try kohya_ss instead. It's a separate program with its own venv, so it won't cause dependency conflicts like this.

    View full answer Replies:5 comments · 16 replies

    prrawls on Apr 22, 2023 I just used this in my command line and xformers installed automatically. You have to start it this way each time as well. It's really that simple thank goodness!

    webui.bat --xformers

    5 replies @allroundHim allroundHim on Apr 22, 2023 Author I see, it should work but I get more errors

    F:\stable-diffusion-webui>webui.bat --xformers venv "F:\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2 Installing xformers Installing requirements for Web UI

    Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled

    Initializing Dreambooth If submitting an issue on github, please provide the below text for debugging purposes:

    Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Dreambooth revision: 1b8437cb7e3f2b963058caed0abf237a94add0c7 SD-WebUI revision: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2

    Successfully installed accelerate-0.17.1 Successfully installed requests-2.28.2 Successfully installed fastapi-0.90.1 starlette-0.23.1 Successfully installed gitpython-3.1.31 Successfully installed transformers-4.27.4

    [!] torch version 1.13.1 installed. [+] torchvision version 0.14.1+cu117 installed. [!] xformers version 0.0.16rc425 installed. [+] accelerate version 0.17.1 installed. [+] diffusers version 0.14.0 installed. [+] transformers version 4.27.4 installed. [+] bitsandbytes version 0.35.4 installed.

    #######################################################################################################

    LIBRARY ISSUE DETECTED

    #######################################################################################################

    torch is below the required 1.13.1+cu116 version.

    xformers is below the required 0.0.17.dev version.

    Dreambooth may not work properly.

    TROUBLESHOOTING

    1. Fully restart your project (not just the webpage)

    2. Update your A1111 project and extensions

    3. Dreambooth requirements should have installed automatically, but you can manually install them

    by running the following 4 commands from the A1111 project root:

    cd venv/Scripts activate cd ../.. pip install -r ./extensions/sd_dreambooth_extension/requirements.txt #######################################################################################################

    Launching Web UI with arguments: --xformers F:\stable-diffusion-webui\venv\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: Could not find module 'F:\stable-diffusion-webui\venv\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax. warn(f"Failed to load image Python extension: {e}") Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 1.13.1+cu117 with CUDA 1107 (you have 1.13.1+cpu) Python 3.10.9 (you have 3.10.6) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won't be available. Set XFORMERS_MORE_DETAILS=1 for more details Loading weights [1f61236f8d] from @allroundHim allroundHim on Apr 22, 2023 Author update: removed the venv folder but still this

    [+] torch version 1.13.1+cu117 installed. [+] torchvision version 0.14.1+cu117 installed. [!] xformers version 0.0.16rc425 installed. [+] accelerate version 0.17.1 installed. [+] diffusers version 0.14.0 installed. [+] transformers version 4.27.4 installed. [+] bitsandbytes version 0.35.4 installed.

    #######################################################################################################

    LIBRARY ISSUE DETECTED

    #######################################################################################################

    xformers is below the required 0.0.17.dev version.

    Dreambooth may not work properly.

    TROUBLESHOOTING

    1. Fully restart your project (not just the webpage)

    2. Update your A1111 project and extensions

    3. Dreambooth requirements should have installed automatically, but you can manually install them

    by running the following 4 commands from the A1111 project root:

    cd venv/Scripts activate cd ../.. pip install -r ./extensions/sd_dreambooth_extension/requirements.txt #######################################################################################################

    Launching Web UI with arguments: --xformers @missionfloyd missionfloyd on Apr 22, 2023 Collaborator The dreambooth dev insists on screwing with dependencies (there's probably no reason it needs 0.0.17 in particular). Adding this to webui-user.bat should fix it:

    set COMMANDLINE_ARGS=--xformers --reinstall-xformers set XFORMERS_PACKAGE=xformers==0.0.17 (remove --reinstall-xformers) afterwards)

    Or you can remove dreambooth and try kohya_ss instead. It's a separate program with its own venv, so it won't cause dependency conflicts like this.

    Answer selected by Sakura-Luna @allroundHim allroundHim on Apr 23, 2023 Author Hello Strange..I've added those two lines of the package. It did not seem to install xformers 0.0.17, but i indeed is trying to start with xformers It looks like it is the problem with the dev, it asks for Torch 2.2.0+cu118 and Python 3.10.10 But the rest of the stable diffusion is indeed depend on Python 3.10.6

    It looks like that the previous bug of mine is caused by my trying to pip install xformers, then it just brings the 0.0.17 xformers which depends on Torch 2.0.0. By the way the previous error shows < xFormers was built for: PyTorch 1.13.1+cu117 with CUDA 1107 (you have 1.13.1+cpu)> Isn't it that stable diffusion should automatically install Torch GPU and CUDA for me ? Or should I install CUDA myself to get Torch GPU working?

    Launching Web UI with arguments: --xformers WARNING[XFORMERS]: xFormers can't load C++/CUDAmode extensions. xFormers was built for: PyTorch 2.0.0+cu118 with CUDA 1108 (you have 1.13.1+cu117) Python 3.10.10 (you have 3.10.6) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won't be available. Set XFORMERS_MORE_DETAILS=1 for more details Loading weights [1f61236f8d] from F:\stable-diffusion-webui\models\Stable-diffusion\M1.safetensors Creating model from config: F:\stable-diffusion-webui\models\Stable-diffusion\M1.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Applying xformers cross attention optimization. Textual inversion embeddings loaded(0): Model loaded in 2.9s (create model: 0.3s, apply weights to model: 0.6s, apply half(): 0.4s, move model to device: 0.9s, load textual inversion embeddings: 0.7s). CUDA SETUP: Loading binary F:\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cudaall.dll... Exception importing xformers: Xformers version must be >= 0.0.17.dev Two lines, one runs and one does not.

    @SailochanaR SailochanaR on May 15, 2024 This error is solved but i have CUDA out of memory

    missionfloyd on Apr 23, 2023 Collaborator You can update torch the same way.

    set COMMANDLINE_ARGS=--reinstall-torch set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118 1 reply @allroundHim allroundHim on May 1, 2023 Author You can update torch the same way.

    set COMMANDLINE_ARGS=--reinstall-torch set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118 Well, there is a strange problem. After I put these two lines into the webui-user.bat, the things installed Torch2.0 cu118

    However if I delete venv file, and delete these two lines of code, the things still installs Torch2.0 and cu118

    Judging from the release history of automatic1111 sd gui, I don't think that's commanded by their launch.py

    dilectiogames on May 12, 2023 if you are trying to make the new updates work using "git pull" it doesn't work

    I've made a clean install of the recent version and everything appears to works fine. xformer also got installed correctly when adding the line to the webui bat file

    using git pull on the older install just created lot of issues, pytorch 2 didn't wanted to install, the 0.17 version of xformers also didn't wanted to install.

    0 replies

    suonnon on May 13, 2023 This method works well for me (If you are using Nvidia gpu):

    Install Nvidia Cuda with version at least 11.8, restart computer Put --xformers into webui-user.bat (after set COMMANDLINE_ARGS=) Run the webui-user.bat and let it install 4 replies @vrgamegirl19 vrgamegirl19 on May 19, 2023 This method works well for me (If you are using Nvidia gpu):

    Install Nvidia Cuda with version at least 11.8, restart computer Put --xformers into webui-user.bat (after set COMMANDLINE_ARGS=) Run the webui-user.bat and let it install This worked!!! soooo easy!!!

    @TaoismDeepLake TaoismDeepLake on Jun 3, 2023 This method works well for me (If you are using Nvidia gpu):

    Install Nvidia Cuda with version at least 11.8, restart computer Put --xformers into webui-user.bat (after set COMMANDLINE_ARGS=) Run the webui-user.bat and let it install WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.0.0+cu118 with CUDA 1108 (you have 2.1.0.dev20230602+cu118) Python 3.10.10 (you have 3.10.9) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Darn, looks like I need to rework the pytorch

    @suonnon suonnon on Jun 14, 2023 This method works well for me (If you are using Nvidia gpu):

    Install Nvidia Cuda with version at least 11.8, restart computer Put --xformers into webui-user.bat (after set COMMANDLINE_ARGS=) Run the webui-user.bat and let it install WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.0.0+cu118 with CUDA 1108 (you have 2.1.0.dev20230602+cu118) Python 3.10.10 (you have 3.10.9) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Darn, looks like I need to rework the pytorch

    Python 3.10.6 is best fit for A1111

    @rollingstone87 rollingstone87 on Feb 6 This method works well for me (If you are using Nvidia gpu):

    Install Nvidia Cuda with version at least 11.8, restart computer Put --xformers into webui-user.bat (after set COMMANDLINE_ARGS=) Run the webui-user.bat and let it install I did the setup by entering the venv, installed cuda 124, python 3.10.6, pytorch kit 2.6.0 from official pip, and xformer v0.0.29.post2. Everything should be good to launch, after edit webui-user.bat, after set COMMANDLINE_ARGS= --xformers

    And it worked ! Thanks a lot mate !

    al-swaiti on Jun 6, 2023 hi every one i fix the issue for LINUX USERS BY EDIT THIS FILE "stable-diffusion-webui/modules/launch_utils.py" and edit this line "xformers_package" to latest xformers package as below > xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.21.dev543') and relaunch the "./webui.sh --xformers" also windows users can try this way try it before delete venv folder if it doesn't work rename or delete venv and relunch webui with xformers flag

    6 replies @thiagojramos thiagojramos on Jun 12, 2023 Ty. Works fine in my win11

    @kryptonmediagroup kryptonmediagroup on Jun 15, 2023 This totally worked and it's totally worth doing. Rendering is at least 40% faster!

    @EGirlEnthusiast EGirlEnthusiast on Jun 16, 2023 This one fixed it for me on linux. If you dont know what xformers version you have then run pip list and itll show the version. Then edit xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==reported version')

    @ghostofelvis100 ghostofelvis100 on Jul 2, 2023 I'm on a Mac M1 - there must be some holes in my installation as I don't even have this script (launch_utils.py).

    Any ideas?

    Otherwise, thank you for your explicit post - I've been trawling lots of pages about these errors and most will refer to a command to use but give no reference as to where to place it.

    -edit - just discovered Xformers and Cuda are specific to Nvidia GPUs and so are not relevant for an installation on Mac. doesn't necessarily explain why I'm missing the launch_utils.py...

    @natalisuh natalisuh on Aug 1, 2023 Thank you, works for me too on linux, just with version 0.0.20 xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.20')

  2. Assistant

    ¡Hola!
    El texto que compartiste es bastante útil para entender cómo resolver el problema de la falta del módulo xformers al usar Stable Diffusion (como en la versión de Automatic1111) con la opción --xformers. Este error es común porque xformers tiene dependencias específicas (como versión de PyTorch, CUDA, Python) que deben coincidir.


    Resumen y pasos clave para instalar xformers correctamente:

    1. Instala CUDA compatiblemente

      • El módulo xformers necesita CUDA instalado en tu sistema para que el PyTorch instalado tenga soporte GPU.
      • La mayoría comenta que necesitas al menos CUDA 11.8.
      • Descarga e instala la versión apropiada de CUDA desde la web oficial de NVIDIA.
      • Después de instalar CUDA, reinicia el sistema para que tome efecto.
    2. Verifica versión de Python y PyTorch

      • La versión recomendada de Python para la mayoría de setups A1111 es Python 3.10.x (por lo general 3.10.6 o 3.10.10).
      • PyTorch debe ser compatible con CUDA (ejemplo: torch==2.0.0+cu118 para CUDA 11.8).
      • Puedes forzar la instalación correcta de PyTorch con CUDA usando el comando:
      pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
      
    3. Modificar el archivo webui-user.bat (si usas Windows)

      • Agrega o edita las siguientes líneas para que se instale la versión correcta de xformers automáticamente:
      set COMMANDLINE_ARGS=--xformers --reinstall-xformers
      set XFORMERS_PACKAGE=xformers==0.0.29.post2
      

      (Nota: La versión 0.0.29.post2 es solo un ejemplo, puedes usar la última versión estable compatible, por ejemplo 0.0.21.dev543 o la que menciona el error o README de tu versión.)

      • Después de la instalación exitosa, elimina --reinstall-xformers para evitar reinstalaciones innecesarias.
    4. Borra o renombra tu entorno virtual (venv) antes de reinstalar

      • Esta acción limpia instalaciones previas y evita incompatibilidades de versiones.
    5. Corre webui-user.bat (o webui.sh en Linux/Mac) con el parámetro --xformers para que el sistema instale las dependencias faltantes:

      webui-user.bat --xformers
      
    6. Comprueba que xformers esté instalado y funcione

      • En tu consola con entorno virtual activo, ejecuta:
      pip list | findstr xformers
      
      • Asegúrate que la versión es la que tu setup requiere (por ejemplo >= 0.0.17.dev).
    7. Errores comunes y soluciones

      • Error "xformers can't load C++/CUDA extensions": suele indicar que xformers fue compilado para una versión de PyTorch/CUDA diferentes a las instaladas. Solución:

        • Reinstala PyTorch con la versión CUDA correcta.
        • Reinstala xformers después.
        • Confirma que CUDA está bien instalado en tu sistema y accesible.
      • Error "Torch not compiled with CUDA enabled": significa que tu PyTorch es versión CPU. Necesitas instalar la versión CUDA de PyTorch.

      • Versión de Python incompatible: generalmente usa Python 3.10.x para evitar problemas.

      • Conflictos con extensiones como Dreambooth: algunas extensiones pueden requerir versiones específicas de xformers o Torch, lo que puede romper tu instalación. La recomendación es o usar la misma versión que pide la extensión o cambiar a alternativas como kohya_ss que usan un entorno separado.


    Resumen para ti, que usas Krita y Stable Diffusion:

    • Krita en sí no instala ni usa xformers, es Stable Diffusion y su interfaz (webui) quienes lo requieren si quieres optimizaciones con atención eficiente y aceleración CUDA.
    • Sigue los pasos anteriores para instalar CUDA, PyTorch con CUDA, y luego xformers en el entorno virtual que usa tu Stable Diffusion.
    • Asegúrate de usar la versión correcta del entorno (python, torch, xformers) y CUDA compatible con tu GPU NVIDIA.
    • Para mayor facilidad, usa el webui-user.bat con las líneas de configuración para forzar la instalación correcta.

    Ejemplo de un webui-user.bat útil para este caso:

    @echo off
    set PYTHON=
    set GIT=
    set VENV_DIR=venv
    set COMMANDLINE_ARGS=--xformers --reinstall-xformers
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    
    call webui.bat %*
    

    Y recuerda:

    • Instala CUDA (11.8 o superior) desde NVIDIA antes de todo.
    • Reinicia el sistema después de instalar CUDA.
    • Elimina el venv viejo y deja que el script cree uno nuevo.
    • Usa la versión de Python 3.10.x (recomendada 3.10.6 o 3.10.10).

    Si quieres, puedo ayudarte paso a paso con los comandos específicos y chequeos para verificar tu entorno. ¿Quieres?

  3. User

    python.exe - Entry Point Not Found x The procedure entry point ?_singleton@UndefinedTensorlmpl@c10@@0U12@A could not be located in the dynamic link library D:\Krita ai\ComfyUl\pyth o n\Li b\site - pa ckages\xformers_C.pyd.

  4. Assistant

    El error que describes:

    python.exe - Entry Point Not Found  
    The procedure entry point ?_singleton@UndefinedTensorImpl@c10@@0U12@A could not be located in the dynamic link library ...\xformers\_C.pyd
    

    es un error clásico que ocurre cuando el archivo .pyd (equivalente a un .dll para módulos Python) está compilado contra una versión diferente de PyTorch, CUDA o Python de la que tienes instalada.


    Posibles causas:

    • Versión incompatible de PyTorch: xformers fue compilado para una versión específica de PyTorch (por ejemplo 2.0.0+cu118), y tienes otra versión instalada (por ejemplo 1.13 o una con CPU-only).
    • Versiones de Python diferentes entre el entorno donde instalaste xformers y el que estás usando para ejecutar.
    • Versión de CUDA o drivers NVIDIA incompatible o faltante.

    Cómo solucionar este problema paso a paso:

    1. Revisa la versión de Python en tu entorno (la que usas para lanzar la UI):
      Ejecuta en consola (con entorno virtual activado):

      python --version
      

      Asegúrate que sea la que recomienda A1111 (por ejemplo 3.10.x).

    2. Revisa la versión de PyTorch instalada:

      python -c "import torch; print(torch.__version__); print(torch.version.cuda)"
      

      El resultado debería mostrar algo tipo 2.0.0+cu118 si tienes una instalación CUDA válida.
      Si dice algo con cpu, necesitas reinstalar la versión CUDA.

    3. Elimina tu entorno virtual actual para empezar limpio:

      • Cierra cualquier ventana de terminal o programa que podría estar usando el entorno.
      • Borra la carpeta venv dentro de tu instalación (ej: D:\Krita ai\ComfyUl\venv).
    4. Instala CUDA Toolkit apropiado

    5. Vuelve a crear entorno y fuerza la instalación de PyTorch con CUDA y xformers

      • Abre consola en la carpeta raíz de la webui, activa Python 3.10.x si aún no lo haces.
      • Crea y activa el entorno virtual manualmente o usa el script webui-user.bat con las siguientes líneas (como ya viste):
      set COMMANDLINE_ARGS=--xformers --reinstall-xformers --reinstall-torch
      set XFORMERS_PACKAGE=xformers==0.0.29.post2
      set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
      webui-user.bat
      

      Eso hará que se instalen las versiones correctas de torch, xformers y demás dependencias.

    6. Confirma que xformers fue instalado para tu versión de PyTorch y Python correcta:

      En el entorno activado, prueba:

      python -c "import xformers"
      

      Si no da error, ya debería estar bien.

    7. Evita instalaciones manuales mezcladas
      No hagas pip install xformers sin especificar el índice y sin que coincida con las versiones de torch/cu que instalaste. Mejor deja que lo gestione el launcher o hazlo con la variable XFORMERS_PACKAGE.


    NOTA importante:

    • El archivo que da error xformers\_C.pyd es un binario compilado, ligado a versiones de PyTorch/CUDA. Por eso la coincidencia de versiones es crítica.
    • Si usas GPU Nvidia, debes tener drivers actualizados y CUDA instalado.
    • Si tu GPU es AMD o Intel, probablemente no puedas usar CUDA y xformers no funcionará correctamente.

    En resumen, para que arregles ese error específico:

    • Limpia venv.
    • Instala Python 3.10.x (si no tienes).
    • Instala CUDA 11.8 (drivers NVIDIA actualizados).
    • Forza instalación de PyTorch con CUDA y versión compatible de xformers ejecutando el script webui con:
    set COMMANDLINE_ARGS=--reinstall-torch --reinstall-xformers --xformers
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
    webui-user.bat
    

    Esto debe descargar las versiones correctas.


    Si quieres puedo ayudarte también con los comandos para Windows paso a paso, o con la configuración exacta para tu caso. Solo dime.

  5. User

    y ainstale la ultima version de CUDA, explicame bien como instalar xformers

  6. Assistant

    Perfecto que ya tengas instalada la última versión de CUDA, eso es un paso clave para que xformers funcione correctamente con aceleración GPU.


    Guía clara y paso a paso para instalar xformers en tu entorno de Stable Diffusion (Ej: automatic1111) en Windows:


    Paso 1: Verifica que tu GPU y drivers estén listos

    • Asegúrate de tener drivers Nvidia actualizados para tu GPU compatible con CUDA (al menos versión compatible con CUDA que hayas instalado).
    • Para comprobar que CUDA está accesible, abre CMD y ejecuta:
    nvcc --version
    

    Deberías ver la versión instalada.


    Paso 2: Borra el entorno virtual viejo (venv)

    • Ve a la carpeta donde tengas el Stable Diffusion web UI (ejemplo: D:\Krita ai\ComfyUl\)
    • Borra la carpeta venv completa.
    • Esto es para evitar conflictos por viejas versiones o instalaciones corruptas.

    Paso 3: Verifica que la versión de Python sea compatible

    • La versión recomendada es Python 3.10.x, por ejemplo 3.10.6 o 3.10.10.
    • Para verificar usa:
    python --version
    

    Si no tienes esa versión, instala Python 3.10 desde https://www.python.org/downloads/release/python-31010/

    Asegúrate de marcar la opción Add Python to PATH al instalar.


    Paso 4: Prepara el archivo webui-user.bat

    • Edítalo (con bloc de notas o tu editor favorito) y busca la línea que empieza con:
    set COMMANDLINE_ARGS=
    
    • Cámbiala o agrégale el parámetro para usar xformers y forzar la reinstalación, así:
    set COMMANDLINE_ARGS=--xformers --reinstall-xformers --reinstall-torch
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
    
    • Quedaría algo así al inicio del archivo (antes de la línea que lanza webui.sh o el python):
    set COMMANDLINE_ARGS=--xformers --reinstall-xformers --reinstall-torch
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
    

    Paso 5: Ejecuta webui-user.bat

    • Asegúrate de cerrar todas las ventanas de CMD o consolas que tengas abiertas.
    • Ejecuta el webui-user.bat ejecutándolo como Administrador (clic derecho → Ejecutar como administrador).

    Paso 6: Verifica instalación de PyTorch + CUDA + xformers

    Cuando el script corra, debería mostrar en consola mensajes como:

    Successfully installed torch-2.0.0+cu118
    Successfully installed torchvision-0.15.1+cu118
    Successfully installed xformers-0.0.29.post2
    
    • Para confirmarlo manualmente, una vez active el entorno (o dentro de la consola CMD del entorno virtual) ejecuta:
    python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
    python -c "import xformers; print('xformers import OK')"
    
    • Debes ver que torch.cuda.is_available() devuelva True y que no haya errores con xformers.

    Paso 7: Nota final y limpieza

    • Después de instalar y verificar que todo funciona bien, quita la línea --reinstall-xformers y --reinstall-torch del COMMANDLINE_ARGS para que no reinstall todo cada vez que inicies.

    • Reinicia el sistema si notas que CUDA no está siendo detectado.


    Resumen rápido

    1. CUDA instalado y drivers actualizados ✔️
    2. Borra venv ✔️
    3. Python 3.10.x ✔️
    4. Edita webui-user.bat con:
    set COMMANDLINE_ARGS=--xformers --reinstall-xformers --reinstall-torch
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118
    
    1. Ejecuta webui-user.bat como administrador. ✔️
    2. Verifica que PyTorch detecta CUDA y que xformers se importe sin error. ✔️
    3. Quita reinstalaciones forzadas del .bat. ✔️

    Si después de eso sigues con errores avísame exactamente qué mensaje ves y qué versión de CUDA, Python y torch tienes para ayudarte a depurar.


    ¿Quieres que te arme el contenido completo del webui-user.bat para que solo copies/pegues y evites errores?

  7. User

    nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Tue_May_27_02:24:01_Pacific_Daylight_Time_2025 Cuda compilation tools, release 12.9, V12.9.86 Build cuda_12.9.r12.9/compiler.36037853_0

  8. Assistant

    Perfecto, ya tienes instalado CUDA 12.9, que es bastante reciente y debería funcionar bien (aunque la mayoría de builds estables de PyTorch y xformers aún usan CUDA 11.8 o 12.1 — normalmente va bien para CUDA 12 también, solo hay que usar la versión correcta).


    Ahora te dejo una guía adaptada para CUDA 12.9 y tu setup con Automatic1111 (Stable Diffusion WebUI):


    1. Borra tu entorno virtual viejo (venv)

    Elimina la carpeta venv que está dentro del directorio de tu webui. Esto asegura que reinstalarás todo limpio.


    2. Comprueba la versión de Python

    Ejecuta en cmd:

    python --version
    

    Debe ser Python 3.10.x (recomendado 3.10.6 o 3.10.10). Si no, instala esa versión y agrega a PATH.


    3. Edita tu archivo webui-user.bat

    Abre el archivo webui-user.bat que usas para iniciar la UI y modifica o agrega estas líneas al principio (antes de llamar a la ejecución):

    set COMMANDLINE_ARGS=--xformers --reinstall-xformers --reinstall-torch
    set XFORMERS_PACKAGE=xformers==0.0.29.post2
    set TORCH_COMMAND=pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu121
    

    Nota:

    • Uso cu121 en el índice extra, porque CUDA 12.1+ es más compatible con CUDA 12.9.
    • Si tienes problemas con esa versión, puedes cambiar cu121 por cu118 para forzar la versión CUDA 11.8 si necesitas.

    4. Ejecuta webui-user.bat como administrador

    Haz clic derecho sobre webui-user.bat y elige Ejecutar como administrador.

    Esto descargará e instalará:

    • PyTorch con soporte CUDA 12.1 (compatible con tu CUDA 12.9)
    • xformers versión 0.0.29.post2 compatible
    • Otras dependencias necesarias

    5. Verifica los resultados después de la instalación

    En la consola CMD que se abra o después, prueba lo siguiente:

    python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
    

    Debes ver algo como (la versión puede variar un poco):

    2.0.1+cu121 True
    

    Luego:

    python -c "import xformers; print('xformers import OK')"
    

    Si no sale error, ya está funcionando.


    6. Finalmente, modifica webui-user.bat para quitar los comandos de reinstalación

    Luego de que todo funcione, edita webui-user.bat y deja solo esta línea para el lanzamiento normal:

    set COMMANDLINE_ARGS=--xformers
    

    Quita las líneas de --reinstall-xformers y --reinstall-torch y las líneas con XFORMERS_PACKAGE y TORCH_COMMAND para que no reinstale todo siempre.


    Nota extra

    • Si tienes un error del tipo:
    xformers can't load C++/CUDA extensions
    

    puede que necesites usar versiones previas de xformers o PyTorch, pero con CUDA 12.9 y PyTorch 2.0+ normalmente funciona bien.

    • Si te da problemas con la versión 0.0.29.post2 de xformers puedes probar bajando a una versión como 0.0.21 o 0.0.25 cambiando la variable en XFORMERS_PACKAGE.

    ¿Quieres que te arme el archivo webui-user.bat completo listo para pegar?
    ¿O prefieres que te ayude con la reinstalación paso a paso en consola?

  9. User

    empecemos de vuelta....como instalo xformers que deberia estar en la carpeta D:\Krita ai\ComfyUI\Lib\site-packages

  10. Assistant

    Perfecto, empecemos desde cero para instalar xformers en tu entorno específico de ComfyUI ubicado en D:\Krita ai\ComfyUI\.


    Paso a paso para instalar xformers en ComfyUI en Windows


    1. Abre una consola CMD o PowerShell con permisos de administrador

    Esto evita problemas de permisos con la instalación.


    2. Navega a la carpeta raíz de ComfyUI

    En tu consola:

    cd "D:\Krita ai\ComfyUI"
    

    3. Activa el entorno virtual (venv) que usa ComfyUI

    Normalmente ComfyUI crea un entorno venv dentro de su carpeta raíz. Actívalo con este comando:

    .\venv\Scripts\activate
    

    Si esto falla, revisa que exista la carpeta venv dentro del directorio o si usas otro nombre de entorno virtual.

    Al activarlo, debería aparecer el prefijo (venv) al inicio en la consola.


    4. Verifica la versión de Python activa

    Con entorno activado ejecuta:

    python --version
    

    Debe ser Python 3.10.x (idealmente 3.10.6 o 3.10.10). Si no, reinstala o utiliza el Python correcto.


    5. Verifica la versión y soporte CUDA de PyTorch

    En la consola con el entorno activo, ejecuta:

    python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
    

    Debería mostrar la versión y True si CUDA está activo. Ejemplo:

    2.0.1+cu121 True
    

    Si dice False en CUDA, tendrás que reinstalar PyTorch con soporte correcto para CUDA (lo veremos si es necesario).


    6. Instala la versión correcta de xformers para tu entorno

    Ejecuta:

    pip install xformers --force-reinstall
    

    Opcionalmente especifica versión compatible (puedes usar la última estable, por ejemplo):

    pip install xformers==0.0.29.post2 --force-reinstall
    

    Esto descargará e instalará el paquete xformers dentro de tu venv en la carpeta correspondiente (Lib\site-packages\xformers).


    7. Verifica importación y funcionamiento de xformers

    Ejecuta lo siguiente para verificar que el módulo no dé error:

    python -c "import xformers; print('xformers cargado correctamente')"
    

    Si aparece ese mensaje sin errores, está instalado y operativo.


    8. Consejo: Si tienes problemas con incompatibilidades de versiones

    Si da error relacionado a incompatibilidad con PyTorch o CUDA, puedes:

    • Reinstalar PyTorch con soporte CUDA compatible con tu versión CUDA (ejemplo para CUDA 12.1):
    pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu121 --force-reinstall
    
    • Luego volver a instalar xformers (paso 6).

    9. (Opcional) Paquete completo para versión CUDA 12.9 (como la que tienes)

    Si quieres instalar directo PyTorch + xformers compatibles para CUDA 12.9, puedes:

    pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu121 --force-reinstall
    pip install xformers==0.0.29.post2 --force-reinstall
    

    10. Reinicia la aplicación ComfyUI

    Después de la instalación, cierra y vuelve a abrir ComfyUI para que tome la instalación y cargue xformers desde la carpeta site-packages.



    Resumen rápido:

    1. cd "D:\Krita ai\ComfyUI"
    2. .\venv\Scripts\activate
    3. python --version (3.10.x)
    4. python -c "import torch; print(torch.__version__, torch.cuda.is_available())" (debe mostrar CUDA activo)
    5. pip install --force-reinstall xformers==0.0.29.post2
    6. python -c "import xformers" (sin errores)
    7. Reinicia ComfyUI

    Si llegas a tener errores después de ese proceso, por favor copia y pega el mensaje exacto para ayudarte a corregirlo.

    ¿Quieres que te ayude a generar esos comandos o hacer pruebas para confirmar si hay conflictos de versiones?