ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program.

Open ckao10301 opened this issue 1 year ago • 8 comments

Trying to reinstall torch on comfyui portable with the command in the comfyui readme: "pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121"

Which directory do I need to cd for this?

Getting this erro: pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

ckao10301 avatar Dec 18 '23 04:12 ckao10301

What environment are you trying to run ComfyUI in? linux? windows portable? colab? venv?

ltdrdata avatar Dec 18 '23 04:12 ltdrdata

First question is where is your Python installed?:) localization. Is it C:\ or other drive ? is it in Program Files? and when you were installing Python did you add PATH to system ???There is a checkbox when you install python to add PATH to system. I use Python: 3.10.11 which is the last Python from 3.10 series which can be downloaded and installed and it works perfectly. Source: https://www.python.org/downloads/release/python-31011/ Use this version and add PATH during installation. Good Luck p.s. of course uninstall all other versions of Python first not to have any conflicts.

MarcinSoj avatar Dec 18 '23 10:12 MarcinSoj

What environment are you trying to run ComfyUI in? linux? windows portable? colab? venv?

Hi, windows portable.

ckao10301 avatar Dec 18 '23 22:12 ckao10301

First question is where is your Python installed?:) localization. Is it C:\ or other drive ? is it in Program Files? and when you were installing Python did you add PATH to system ???There is a checkbox when you install python to add PATH to system. I use Python: 3.10.11 which is the last Python from 3.10 series which can be downloaded and installed and it works perfectly. Source: https://www.python.org/downloads/release/python-31011/ Use this version and add PATH during installation. Good Luck p.s. of course uninstall all other versions of Python first not to have any conflicts.

Hi, I'm using windows portable of comfyui, so python is installed in a subfolder inside (it came with the comfyui portable zip file). I didn't install python separately so there wasn't an option to add PATH.

image

ckao10301 avatar Dec 18 '23 22:12 ckao10301

From a command prompt: In the below I'm assuming C:\ComfyUI is where you put the files from the zip, change that as needed:

set PATH=%PATH%;C:\ComfyUI\python_embeded\Scripts;C:\ComfyUI\python_embeded

If you don't want to make permanent path changes this is all you need. I'd recommend running just this one first anyway and making sure everything works It'll remain valid for your current CMD session. I'd recommend putting it in a batch file like "env.cmd" in the install directory if you don't want to make it permanent.

If everything works and you want to make the change permanent, it's probably easier to go through the windows UI (open start or hit windows key and start typing "edit environment variables" and you should get an "edit environment variables for your account" link. Double click the Path variable and add the two directories as new paths at the bottom: C:\ComfyUI\python_embeded\Scripts C:\ComfyUI\python_embeded You can also remove them from here later if you remove comfy or edit them if you move it. and click ok. Any new cmd windows you open will have these in the path, but it won't change currently opened ones.

You can also do it with setx from the command line but it's more error prone and more difficult to remove things from multi-entry items with so I'd just recommend this way.

alternately you can type full paths but that gets tiring quickly.

You should be able to run python from anywhere now.

NeedsMoar avatar Dec 19 '23 08:12 NeedsMoar

First question is where is your Python installed?:) localization. Is it C:\ or other drive ? is it in Program Files? and when you were installing Python did you add PATH to system ???There is a checkbox when you install python to add PATH to system. I use Python: 3.10.11 which is the last Python from 3.10 series which can be downloaded and installed and it works perfectly. Source: https://www.python.org/downloads/release/python-31011/ Use this version and add PATH during installation. Good Luck p.s. of course uninstall all other versions of Python first not to have any conflicts.

Hi, I'm using windows portable of comfyui, so python is installed in a subfolder inside (it came with the comfyui portable zip file). I didn't install python separately so there wasn't an option to add PATH. image

You need to install Python as well. If there is no Python on your Windows then you would have to add PATH manually in WIndows to location of your venv in ComfyUI directory.

So you have 2 options:

  1. This is informations from creators of ComfyUI:

Manual Install (Windows, Linux)

Git clone this repo.

Put your SD checkpoints (the huge ckpt/safetensors files) in: models/checkpoints

Put your VAE in: models/vae

Note: pytorch stable does not support python 3.12 yet. If you have python 3.12 you will have to use the nightly version of pytorch. If you run into issues you should try python 3.11 instead.

Which means you need to install python 3.11 on your computer from : https://www.python.org/

or

  1. Go to Windows Start > Search > edit the system environment variables > advanced > environment variables > and you have 2 boxes for user or system wide > add new in system or user > name (does not matter) > value (your venv folder - example :c:\ComfyUI_windows_portable_nightly_pytorch\python_embeded\ > click ok > ok > restart system and check if it is working

Hope it will help new users.

MarcinSoj avatar Dec 20 '23 11:12 MarcinSoj

No they don't.

That's the copy-pasted info from the README on the main page for manual comfy installs from the git source, not the release packages for Windows. @ckao10301 installed the packaged version which includes python, so that's the python that needs to be updated with missing packages which means it's where the path to pip should be set while doing so.

The Scripts subdirectory that contains pip and friends is put on the path by normal python installs for easy access to pip and things that get installed there like accelerate.

NeedsMoar avatar Dec 20 '23 18:12 NeedsMoar

No they don't.

That's the copy-pasted info from the README on the main page for manual comfy installs from the git source, not the release packages for Windows. @ckao10301 installed the packaged version which includes python, so that's the python that needs to be updated with missing packages which means it's where the path to pip should be set while doing so.

The Scripts subdirectory that contains pip and friends is put on the path by normal python installs for easy access to pip and things that get installed there like accelerate.

Yeas that is why i said that there are 2 options:) easy and advanced one. If u do not want to add PATH to Enviroment Variables then it is easier to install python and all the stuff will be automatically ready. So if something is missing u can always uses pip which is in Python directory to install it. And more advanced option is venv in portable version but u need to add it to PATH manually. That is why i think it is good to know both options and based on that all people who will read this post in the future will have info how to do it in 2 ways. Regards.

MarcinSoj avatar Dec 21 '23 05:12 MarcinSoj

Thanks @NeedsMoar and @MarcinSoj . I was able to get it to work after following your instructions.

ckao10301 avatar Dec 28 '23 08:12 ckao10301