#4189·Fooocus

[Bug]: Official Colab notebook fails on fresh Google Colab Python 3.12 runtime with CuPy import error

Author: Avinashricky211Created Jun 18, 2026Updated Sep 13, 2026
Labelsbugtriage

Checklist

  • The issue has not been resolved by following the troubleshooting guide
  • The issue exists on a clean installation of Fooocus
  • The issue exists in the current version of Fooocus
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

The official fooocus_colab.ipynb fails to start on a fresh Google Colab Python 3.12 runtime.

Fooocus downloads all required models successfully, but crashes during startup when pymatting attempts to import CuPy.

The startup ends with:

ImportError: numpy.core.multiarray failed to import

This occurs using the official notebook without any modifications.

Steps to reproduce the problem

  1. Open the official Fooocus Colab notebook from the repository.

  2. Start a fresh Google Colab runtime.

  3. Run the notebook without modifying any cells.

  4. Wait for model downloads and Fooocus startup.

  5. Observe that startup fails with a CuPy import error:

ImportError: numpy.core.multiarray failed to import

What should have happened?

Fooocus should launch successfully on a fresh Google Colab runtime using the official notebook.

After model downloads complete, the Gradio interface should start and provide a public URL for image generation.

What browsers do you use to access Fooocus?

Google Chrome

Where are you running Fooocus?

Cloud (Google Colab)

What operating system are you using?

Linux (Google Colab runtime)

Console logs

Collecting pygit2==1.15.1
  Downloading pygit2-1.15.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.3 kB)
Requirement already satisfied: cffi>=1.16.0 in /usr/local/lib/python3.12/dist-packages (from pygit2==1.15.1) (2.0.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.12/dist-packages (from cffi>=1.16.0->pygit2==1.15.1) (3.0)
Downloading pygit2-1.15.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.1/5.1 MB 77.1 MB/s eta 0:00:00
Installing collected packages: pygit2
  Attempting uninstall: pygit2
    Found existing installation: pygit2 1.19.2
    Uninstalling pygit2-1.19.2:
      Successfully uninstalled pygit2-1.19.2
Successfully installed pygit2-1.15.1
/content
Cloning into 'Fooocus'...
remote: Enumerating objects: 6735, done.
remote: Total 6735 (delta 0), reused 0 (delta 0), pack-reused 6735 (from 1)
Receiving objects: 100% (6735/6735), 33.35 MiB | 19.84 MiB/s, done.
Resolving deltas: 100% (3849/3849), done.
/content/Fooocus
Already up-to-date
Update succeeded.
[System ARGV] ['entry_with_update.py', '--share', '--always-high-vram']
/content/Fooocus/build_launcher.py:9: SyntaxWarning: invalid escape sequence '\p'
  .\python_embeded\python.exe -s Fooocus\entry_with_update.py {cmds} %*
Python 3.12.13 (main, Mar  4 2026, 09:23:07) [GCC 11.4.0]
Fooocus version: 2.5.5
Error checking version for torchsde: No package metadata was found for torchsde
Installing requirements
[Cleanup] Attempting to delete content of temp dir /tmp/fooocus
[Cleanup] Cleanup successful
Downloading: "https://huggingface.co/lllyasviel/misc/resolve/main/xlvaeapp.pth" to /content/Fooocus/models/vae_approx/xlvaeapp.pth

100% 209k/209k [00:00<00:00, 1.65MB/s]
Downloading: "https://huggingface.co/lllyasviel/misc/resolve/main/vaeapp_sd15.pt" to /content/Fooocus/models/vae_approx/vaeapp_sd15.pth

100% 209k/209k [00:00<00:00, 1.67MB/s]
Downloading: "https://huggingface.co/mashb1t/misc/resolve/main/xl-to-v1_interposer-v4.0.safetensors" to /content/Fooocus/models/vae_approx/xl-to-v1_interposer-v4.0.safetensors

100% 5.40M/5.40M [00:00<00:00, 20.0MB/s]
Downloading: "https://huggingface.co/lllyasviel/misc/resolve/main/fooocus_expansion.bin" to /content/Fooocus/models/prompt_expansion/fooocus_expansion/pytorch_model.bin

100% 335M/335M [00:03<00:00, 103MB/s]
Downloading: "https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/juggernautXL_v8Rundiffusion.safetensors" to /content/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors

100% 6.62G/6.62G [01:22<00:00, 86.2MB/s]
Downloading: "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_offset_example-lora_1.0.safetensors" to /content/Fooocus/models/loras/sd_xl_offset_example-lora_1.0.safetensors

100% 47.3M/47.3M [00:00<00:00, 70.0MB/s]
Total VRAM 14913 MB, total RAM 12976 MB
Set vram state to: HIGH_VRAM
Always offload VRAM
Device: cuda:0 Tesla T4 : native
VAE dtype: torch.float32
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/cupy/__init__.py", line 18, in <module>
    from cupy import _core  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/cupy/_core/__init__.py", line 5, in <module>
    from cupy._core import core  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "cupy/_core/core.pyx", line 1, in init cupy._core.core
  File "/usr/local/lib/python3.12/dist-packages/cupy/cuda/__init__.py", line 13, in <module>
    from cupy.cuda import compiler  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/cupy/cuda/compiler.py", line 16, in <module>
    from cupy.cuda import function
  File "cupy/cuda/function.pyx", line 1, in init cupy.cuda.function
  File "cupy/_core/_scalar.pyx", line 1, in init cupy._core._scalar
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).

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

Traceback (most recent call last):
  File "/content/Fooocus/entry_with_update.py", line 46, in <module>
    from launch import *
  File "/content/Fooocus/launch.py", line 152, in <module>
    from webui import *
  File "/content/Fooocus/webui.py", line 10, in <module>
    import modules.async_worker as worker
  File "/content/Fooocus/modules/async_worker.py", line 3, in <module>
    from extras.inpaint_mask import generate_mask_from_image, SAMOptions
  File "/content/Fooocus/extras/inpaint_mask.py", line 8, in <module>
    from rembg import remove, new_session
  File "/usr/local/lib/python3.12/dist-packages/rembg/__init__.py", line 5, in <module>
    from .bg import remove
  File "/usr/local/lib/python3.12/dist-packages/rembg/bg.py", line 17, in <module>
    from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf
  File "/usr/local/lib/python3.12/dist-packages/pymatting/__init__.py", line 5, in <module>
    from pymatting.foreground import *
  File "/usr/local/lib/python3.12/dist-packages/pymatting/foreground/__init__.py", line 7, in <module>
    from pymatting.foreground.estimate_foreground_ml_cupy import estimate_foreground_ml_cupy
  File "/usr/local/lib/python3.12/dist-packages/pymatting/foreground/estimate_foreground_ml_cupy.py", line 2, in <module>
    import cupy as cp
  File "/usr/local/lib/python3.12/dist-packages/cupy/__init__.py", line 20, in <module>
    raise ImportError(f'''
ImportError: 
================================================================
Failed to import CuPy.

If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.

On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm.
On Windows, try setting CUDA_PATH environment variable.

Check the Installation Guide for details:
  https://docs.cupy.dev/en/latest/install.html

Original error:
  ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).
================================================================

Additional information

Additional observations:

  • Reproduced on a fresh Google Colab runtime.
  • Reproduced using the official fooocus_colab.ipynb without modifications.
  • Models download successfully.
  • Startup fails when pymatting imports CuPy.
  • Removing CuPy and reinstalling NumPy 1.26.4 allows Fooocus to start successfully and generate images normally.