How to install ConfyUI with python virtualenv in macos(Apple silicion)
December 08, 2024
Background
ConfyUI is a tool for generative AI. It tells ConfyUI is more efficient and easier than other tools.
I also have ever used other tool, WebUI.
In my point, ConfyUI seems like semiconductor circuits so I can find easily what is really realted in things I do on ConfyUI.
But, macOS is not good at any AI projects because most of AI tools is optimized in Nvidia Graphic Card.
I don't have any choice because I only have a MacBook.
Notice, this method need to use terminal like iterm in MacBook.
Install
To install ConfyUI, It also require python.
MacBook had already built-in python.
You can check this following command in terminal.
python version
I try pyenv
in this case, because pyenv
manage several python versions to use in my laptop.
I also use virtualenv
. This is core of this post.
virtualenv
make a virtual environment where run python program in isolated location.
It means that you don't have to consider conflict python library you already are using with other new library you install newly.
When you start new project in python, tt can be very useful to create new env for the project.
Before install pyenv and virtualenv, you should check homebrew is installed in you MacBook.
homebrew
make it simple to install two python tools.
homebrew is a package manager for macOS.
You should type this following commands.
// check
brew --version
// update brew
brew update
And install pyenv and virtualenv with homebrew.
brew install pyenv pyenv-virtualenv
// set PATH env
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zsrhc
echo 'eval "$(pyenv init -)"' >> ~/.zsrhc
source ~/.zsrhc
If you use bash, just replace ~/.zshrc
with ~/.bashrc
in each command.
Use virtual env
// pyenv check
pyenv --version
// pyenv-virtualenv check
pyenv virtualenv
If you see the version of each tools, it has completed to install.
Next, install any python version by pyenv.
// check available version list
pyenv install --list
// install python with version
pyenv install 3.11.0
In temporarily, I install '3.11.0'.
And, create and activate new environment with virtualenv.
// create env
pyenv virtualenv 3.11.0 confyui
// acitvate env
pyenv activate confyui
When all these are done, you can see your virtual env name in terminal.
It can be prevent from any access in ohter envs. It has own space for confyUI.
Get ConfyUI and install package
I believe you can use git so that it is very simple to get ConfyUI by followings.
In other way, you can download ConfyUI in Github.
Those are almost same if you can see the ConfyUI folder in your device.
// get ConfyUI files.
git clone git@github.com:comfyanonymous/ComfyUI.git
And just run main.py
in the folder(or directory) you downloaded.
cd ConfyUI
python main.py
Install process will be done automatically.
Library and package for running ConfyUI will be downloaded in ConfyUI folder.
Finally, you can see the ConfyUI.