asagi4 / comfyui-prompt-control

ComfyUI nodes for prompt editing and LoRA control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'lark'

CognitiveDiffusion opened this issue · comments

Hey there,

I'm probably just dumb, but Comfy asks for "lark" and I installed it via "pip install lark" in Comfy's directory, but now it's not being found by Comfy.

When I try to reinstall I get "Requirement already satisfied: lark in c:\python311\lib\site-packages (1.1.7)".

(programmer novice here, please excuse me if this is basic)

is Comfy using a virtualenv of some kind? I don't know how it works on Windows (I don't use Windows at all), but if there's a virtualenv involved, you'll need to activate that first before running pip install.
If there is a virtual environment and you're using a bat file to launch Comfy, then the bat will probably contain a command referring to a "bin/activate" or something similar. What it does is it sets up the execution environment to include the proper python environment.

If you can find it, open a command prompt and run that same line to activate the virtual environment, and then run pip afterwards.

It's not refering to a venv and the ComfyUI folder (portable version) doesn't have a venv folder either.

Then In not sure what's wrong. Are you sure that ComfyUI is running with the Python you installed lark in? Maybe it's using a different version.

You might need to find someone who runs ComfyUI on Windows to help you.

The portable version of comfyui on windows is a self-extracting archive with its own python (and effectively its own venv) included. Some of the modules are different than the ones from requirements.txt for some reason and lark might not be included (size maybe, who knows)... I'm not sure how that interacts with add-ons with dependencies if the directions on the main comfy git aren't clear on it. I'd suggest just installing comfy the regular way with git clone and a local python install (which you already seem to have), possibly a venv if you need one (I don't use one because the requirements that overlap between the SD related stuff that's all I use python for are all more or less identical versions or don't care about version and it just eats up more space if you don't need it, plus every single installable open source program on windows that needs python installs its own different version locally to its own install without attempting to see if a venv could be created instead; I had 20 at one point and got mad and removed most of the programs) and installing extensions through ComfyUI-Manager so the update process isn't a pain and all the requirements get fetched when you install new ones or update them and restart.

My recommendation would be to git clone comfyui and then git clone comfyui manager into the custom_nodes subdirectory and manage from there. You'll need to clone any extensions you installed directly as repo zips into custom_nodes if you want them to be able to update through that mechanism so plan on deleting them and doing that; you won't need to re-download the models if you keep those in the right place in the directory tree of the git clone though. It's only the installing from zips thing with extensions and comfy itself that breaks their being updated properly.

The self contained executable was more geared towards the common use case of not needing a bunch of custom nodes and not wanting to deal with the complexity and it's possible it has an "invisible" venv going somewhere under C:\users\x\appdata\roaming that would need to be switched to to update deps. It's probably intended to only be used with manager when getting new extensions so their installs / requirements run within its internal python environment.

I just ran into this and my solution for the portable windows install was as follows:

  1. remove the comfyui-prompt-control directory from the custom nodes directory and from the manager if you installed it from there.

  2. open a terminal window at the base comfy directory

  3. run ".\python_embeded\python.exe -m pip install lark" at the command line

4)start comfy

5)reinstall comfyui-prompt-control through the comfyui-manager (https://github.com/ltdrdata/ComfyUI-Manager)

6)close the comfy terminal window and restart

This worked for a new install of comfy, but for whatever reason did not do the trick for an existing one. I had to manually verify that the lark and the lark-1.1.7.dist-info directories were in my .\python_embeded\Lib\site-packages directory in the comfy install directory, then I basically repeated the above steps and it worked.

Note: I am just an artist and have no idea how much of this works, so your mileage may vary, but this did the trick for me.

Good luck!

You probably don't need to remove and reinstall the extension; getting lark installed in the embedded Python environment should be enough. So steps 2 and 3, and then restart ComfyUI