How to Run Flux 1 Dev Locally on Windows
In this article
Yes, you can run Flux 1 dev locally on Windows using Docker and Ollama, enabling local AI model experimentation without relying on cloud services. This setup lets you test and use the Flux 1 model offline, ideal for developers exploring generative AI workflows on their own machines. The process involves installing required tools, pulling the model, and running it through a containerized environment.
What You'll Need
- Windows 10 or Windows 11 (64-bit)
- At least 16 GB RAM (32 GB recommended for smoother performance)
- 100+ GB free disk space (preferably SSD)
- Administrator access to install software
- Docker Desktop for Windows
- Ollama for Windows
- Stable internet connection (for initial downloads)
- NVIDIA GPU with CUDA support (optional but strongly recommended for performance)
Step-by-Step
- Download and install Docker Desktop for Windows from the official Docker website. Run the installer as administrator and follow the prompts. Ensure WSL 2 (Windows Subsystem for Linux) is enabled during setup.
- After installation, launch Docker Desktop and allow it to start in the background. Verify it's running by opening a PowerShell window and typing
docker --version. You should see version information. - Download and install Ollama for Windows from the official Ollama website. Run the installer and launch Ollama once installed.
- Open a new PowerShell or Command Prompt window and run
ollama --versionto confirm installation. If no error appears, Ollama is ready. - Use Ollama to pull the Flux 1 dev model by running:
ollama pull flux:dev. This may take several minutes depending on your internet speed. The model is large, so ensure you have sufficient disk space. - Once downloaded, run the model locally using:
ollama run flux:dev. This starts the model in interactive mode, allowing you to send prompts directly. - To use Flux 1 dev in a web UI or API, create a simple Flask or FastAPI server in Python. Install required packages using pip:
pip install flaskorpip install fastapi uvicorn. - Create a Python script that uses the
subprocessmodule to callollama run flux:devand pipe input/output. For example, send user input via stdin and capture the model’s response. - Expose the endpoint via a local server (e.g.,
http://localhost:5000for Flask). Test with a browser or curl command. - Optionally, use Docker to containerize your Flask/FastAPI app. Create a
Dockerfilethat installs Python, copies your script, and runs the server. Build and run it usingdocker build -t flux-ui .anddocker run -p 5000:5000 flux-ui. - If using a GPU, ensure NVIDIA Container Toolkit is installed in Docker. This allows GPU access inside containers. Verify with
docker run --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi. - Modify your Docker container to pass the GPU to Ollama by running with
--gpus allflag when starting the container.
Common Mistakes
- Not enabling WSL 2 before installing Docker, causing Docker to fail silently or not start.
- Running Ollama commands in the wrong shell (e.g., Command Prompt vs PowerShell) without proper PATH setup.
- Assuming Flux 1 dev is available under a different tag like
flux-devorflux:latest— useflux:devexactly. - Ignoring disk space requirements and running out during model download.
- Forgetting to grant Docker permission to access file shares, leading to volume mounting issues.
- Not installing NVIDIA drivers or Container Toolkit, preventing GPU acceleration.
Tips
- Monitor resource usage via Task Manager or
nvidia-smito ensure GPU is being utilized. - Use
ollama listto verify which models are downloaded and available locally. - Create a batch script to start Docker, Ollama, and your web server automatically.
- Store model outputs in a structured folder for easy review and debugging.
- Use
ollama show --modelfile flux:devto inspect model configuration and parameters. - Keep Ollama updated to avoid compatibility issues with new model versions.
Troubleshooting
If Docker fails to start, ensure virtualization is enabled in BIOS. Restart your PC and check Task Manager’s Performance tab to confirm virtualization is active. If Ollama returns "command not found," add it to your system PATH or reinstall. If the model fails to pull, check your internet connection and firewall settings — some corporate networks block large downloads. If the model loads but responds slowly, verify GPU access: run ollama run flux:dev and observe if CUDA memory is used. If not, reinstall NVIDIA drivers and Container Toolkit. If your web server fails to communicate with Ollama, ensure the script correctly pipes stdin/stdout and handles line endings (Windows vs Unix). Run the script manually first to isolate issues. If Docker containers exit immediately, add sleep infinity to the Dockerfile CMD for debugging. Check logs using docker logs [container-id].
Frequently Asked Questions
Can I run Flux 1 dev without Docker?
Yes, if you only use Ollama directly. Docker is only needed if you want to containerize a custom web interface or API service.
Does Flux 1 dev work on CPU-only systems?
Yes, but performance will be significantly slower. Expect long response times and limited context handling. A GPU is strongly recommended.
Where are Ollama models stored on Windows?
By default, Ollama stores models in C:\Users\[Username]\.ollama\models. Do not delete this folder if you want to keep downloaded models.
Can I use Flux 1 dev in a web browser UI?
Yes, by building a local web server with Flask or FastAPI and connecting it to Ollama’s CLI interface via subprocess calls.
Is Flux 1 dev the same as Flux 1?
No. Flux 1 dev is a development version, often with experimental features or larger parameter counts. It may differ in behavior and performance from stable releases.
How do I stop or remove the Flux 1 dev model?
Use ollama stop to halt running models. To remove, run ollama rm flux:dev. This frees up disk space.