Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]:sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes? #16856

Open
4 of 6 tasks
waylonwang opened this issue Feb 19, 2025 · 18 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@waylonwang
Copy link

waylonwang commented Feb 19, 2025

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

I installed the WebUI on my newly purchased Macbook,After the installation, when I executed./webui.sh again, there was an issue,Then I selected a model in the WebUI, but it failed to load.

Steps to reproduce the problem

  1. Execute ./webui.sh in the Shell.
  2. Load models in the WebUI.

What should have happened?

The WebUI can load models normally.

What browsers do you use to access the UI ?

Microsoft Edge

Sysinfo

sysinfo-2025-02-19-23-43.json

Console logs

reading metadata for /Users/waylon/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: OperationalError
Traceback (most recent call last):
  File "/Users/waylon/stable-diffusion-webui/modules/sd_models.py", line 83, in __init__
    self.metadata = cache.cached_data_for_file('safetensors-metadata', "checkpoint/" + name, filename, read_metadata)
  File "/Users/waylon/stable-diffusion-webui/modules/cache.py", line 119, in cached_data_for_file
    existing_cache[title] = entry
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 823, in __setitem__
    self.set(key, value, retry=True)
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 808, in set
    self._row_insert(db_key, raw, now, columns)
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 857, in _row_insert
    sql(
sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?

Calculating sha256 for /Users/waylon/stable-diffusion-webui/models/Stable-diffusion/AnythingV5Ink_v5RE.ckpt: Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 3.5s (prepare environment: 0.1s, import torch: 1.7s, import gradio: 0.4s, setup paths: 0.3s, initialize shared: 0.1s, other imports: 0.3s, load scripts: 0.1s, create ui: 0.1s, gradio launch: 0.2s).
5b12f296e7577a3e0c832ba60d79d5bfbae0df9f692a00834f97f86283a9c332
loading stable diffusion model: OperationalError
Traceback (most recent call last):
  File "/Users/waylon/miniforge3/envs/py310-sd/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/waylon/miniforge3/envs/py310-sd/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/waylon/miniforge3/envs/py310-sd/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/waylon/stable-diffusion-webui/modules/initialize.py", line 149, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/waylon/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/waylon/stable-diffusion-webui/modules/sd_models.py", line 693, in get_sd_model
    load_model()
  File "/Users/waylon/stable-diffusion-webui/modules/sd_models.py", line 802, in load_model
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "/Users/waylon/stable-diffusion-webui/modules/sd_models.py", line 333, in get_checkpoint_state_dict
    sd_model_hash = checkpoint_info.calculate_shorthash()
  File "/Users/waylon/stable-diffusion-webui/modules/sd_models.py", line 108, in calculate_shorthash
    self.sha256 = hashes.sha256(self.filename, f"checkpoint/{self.name}")
  File "/Users/waylon/stable-diffusion-webui/modules/hashes.py", line 59, in sha256
    hashes[title] = {
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 823, in __setitem__
    self.set(key, value, retry=True)
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 808, in set
    self._row_insert(db_key, raw, now, columns)
  File "/Users/waylon/stable-diffusion-webui/venv/lib/python3.10/site-packages/diskcache/core.py", line 857, in _row_insert
    sql(
sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?

Additional information

It seems that other AI tools also have this problem.

@waylonwang waylonwang added the bug-report Report of a bug, yet to be confirmed label Feb 19, 2025
@waylonwang waylonwang changed the title [Bug]: [Bug]:sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes? Feb 19, 2025
@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

the URL to issues you linked is broken so I fixed via editing your post

as of now I'm not able to reproduce the issue
investigate later when I have time

@TheShy2024
Copy link

+1

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

can someone who is experiencing this issue upload their cache dir directory in webui root and upload it here
this might help figuring out what's going on

I belive you would need to compress it into a zip archive

note: by uploaded this you would essentially upload a list of your all your models info (not the actual models just information about the models) and extensions infos, they could potentially be other things as well created by extensions
normally they shouldn't be anything I personally would consider sensitive in it, but if you're not comfortable with someone knowing what models you have or what extensions you're using, don't upload it.

@m-balcewicz
Copy link

I also experience the same error. "sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?". I have extracted the corresponding cache as requested.

cache.zip

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

@m-balcewicz
I looked at your cache and it seems normal (other then it's empty so I'm guessing this is a new installation)
currently I bleive the cache files itself is likely not the issue

can you also share your sysinfo.json
goto: webui setting tab > sysinfo > download sysinfo

@m-balcewicz
Copy link

Yes, you're right. It's a new installation. Here is the sysinfo…

sysinfo-2025-02-20-10-25.json

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

someone have a theroy about sqlite 3.49.1 beeing the issue
I wish to know your sqlite version

you should be about to find out by running these command

  1. cd to webui root
    for you it should be
cd "/Users/martin/Library/Mobile Documents/com~apple~CloudDocs/MYDATA/CODING_WORLD/GITHUB_WORLD/stable-diffusion-webui"
  1. activate the venv
source venv/bin/activate
  1. run python and read version
python -c "import sqlite3; print(sqlite3.sqlite_version)"

this should out put a version number like 3.49.1 or 3.42.0

@m-balcewicz
Copy link

Well, this looks fine I guess.

(venv) martin@martins-mbp:stable-diffusion-webui python -c "import sqlite3; print(sqlite3.sqlite_version)"
>> 3.49.1

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

Well, this looks fine I guess.

(venv) martin@martins-mbp:stable-diffusion-webui python -c "import sqlite3; print(sqlite3.sqlite_version)"
>> 3.49.1

I think there might be a miscommunication

it is likely that sqlite3 3.49.1 is the cause
base on lllyasviel/stable-diffusion-webui-forge#2669 (comment)

3.49.1 was was released around 2 days ago https://www.sqlite.org/changes.html

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

I'm not sure how would you do so but maybe you could try downgrading sqlite on mac
note: it may not be called sqlite

@m-balcewicz
Copy link

It worked out. Now, I am using sqlite 3.42.0.

(venv) martin@martins-mbp:stable-diffusion-webui python -c "import sqlite3; print(sqlite3.sqlite_version)"
3.42.0

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

seems like it's confirmed to be an issue with sqlite 3.49.1

do you mind testing which version of sqlite works and which doesn't

I only wrote version 3.42.0 above because my is using this version

also if possible can you write down the instructions on how to downgread on Mac
so that other people can follow your instructions

@m-balcewicz
Copy link

m-balcewicz commented Feb 20, 2025

I tried to reproduce my error and checked a few settings.
Conclusion: sqlite=3.49.1 was no problem, but python=3.12.9 seems to create some errors.

I am working with conda environments and use only the conda-forge channel.

The prompt will always be: "Create an image of the sunrise in the Alpes with a lake in the foreground."

sqlite3-42-0

conda create --name sqlite3-42-0 python=3.10
conda activate sqlite3-42-0
conda install sqlite=3.42.0
>> 3.42.0 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0

works fine!

sqlite3-43-0

conda create --name sqlite3-43-0 python=3.10
conda activate sqlite3-43-0
conda install sqlite=3.43.0
>> 3.43.0 2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c (64-bit)

works fine!

sqlite3-44-0

conda create --name sqlite3-44-0 python=3.10
conda activate sqlite3-44-0
conda install sqlite=3.44.0
>> 3.44.0 2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 (64-bit)

*works fine!

sqlite3-45-0

conda create --name sqlite3-45-0 python=3.10
conda activate sqlite3-45-0
conda install sqlite=3.45
>> 3.45.3 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355 (64-bit)

*works fine!

sqlite3-46-0

conda create --name sqlite3-46-0 python=3.10
conda activate sqlite3-46-0
conda install sqlite=3.46
>> 3.46.1 2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69a1e33 (64-bit)

*works fine!

sqlite3-47-0

conda create --name sqlite3-47-0 python=3.10
conda activate sqlite3-47-0
conda install sqlite=3.47
>> 3.47.2 2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c (64-bit)

*works fine!

sqlite3-48-0

conda create --name sqlite3-48-0 python=3.10
conda activate sqlite3-48-0
conda install sqlite=3.48
>> 3.48.0 2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010 (64-bit)

*works fine!

sqlite3-49-0

conda create --name sqlite3-49-0 python=3.10
conda activate sqlite3-49-0
conda install sqlite=3.49
>> 3.49.1 2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70 (64-bit)

*works fine!

The sqlite seems not to be an error during this testing. So I upgraded python.

Python Version for sqlite 3-49-0

Python 3.11

conda activate sqlite3-49-0
conda install python=3.11
>> Python 3.11.11
>> 3.49.1 2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70 (64-bit)

works fine!

Python 3.12

conda activate sqlite3-49-0
conda install python=3.11
>> Python 3.12.9
>> 3.49.1 2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70 (64-bit)

This is what I get when I try to reinstall requirements with python==3.12.9

pip install -r requirements.txt
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Failed to build installable wheels for some pyproject.toml based projects (tokenizers)

Maybe someone else can go through the different python versions. This is one of the created outputs - enjoy.

Image

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 20, 2025

@m-balcewicz thanks for testing

for your info
according to lllyasviel/stable-diffusion-webui-forge#2669 (comment) @cocktailpeanut seems to have found the root cause
but you said 3.4.91 works, so maybe they're are some factors at play, I'm not entirely sure at this point.
either way glad that you got it working


as for OP well I'm not sure he hasn't replied...

@iolairus
Copy link

I had the same issue, I was running sqlite 3.49.1 on python 3.10.16. Downgrading to 3.42.0 solved the issue:

The following packages will be DOWNGRADED:

  libsqlite                               3.49.1-h67fdade_1 --> 3.42.0-hcfcfb64_0
  python                         3.10.16-h37870fc_1_cpython --> 3.10.12-h4de0772_0_cpython

@KazmaBlack
Copy link

Hi, im pretty new to Pinokio and ForgeUI, how do you downgrade? im using windows 11, feel free to ask me whatever you need

@iolairus
Copy link

Hi, im pretty new to Pinokio and ForgeUI, how do you downgrade? im using windows 11, feel free to ask me whatever you need

I am using anaconda on windows 11. Within the environment I was using, I ran conda install sqlite=3.42.0 which resulted in the above prompt, then on confirmation the package was downgraded.

@Ddasch
Copy link

Ddasch commented Mar 9, 2025

I ran into the same issue on a fresh install on Windows 10 when installing into a conda environment. Downgrading to 3.42.0 resolves the issue. Seems like the sqllite version needs to be fixed to that version until a PR formally upgrades it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

7 participants