chn-lee-yumi / MaterialSearch

AI语义搜索本地素材。以图搜图、查找本地素材、根据文字描述匹配画面、视频帧搜索、根据画面描述搜索视频。Semantic search. Search local photos and videos through natural language.
GNU General Public License v3.0
863 stars 117 forks source link

启动时报出数据库被锁定,第一次安装执行。sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked #113

Closed kk0531 closed 2 months ago

kk0531 commented 2 months ago

raceback (most recent call last): File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/main.py", line 282, in init() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/main.py", line 49, in init scanner.init() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/scan.py", line 54, in init create_tables() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/models.py", line 35, in create_tables BaseModel.metadata.create_all(bind=engine) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 5866, in create_all bind._run_ddl_visitor( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3253, in _run_ddl_visitor conn._run_ddl_visitor(visitorcallable, element, kwargs) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2459, in _run_ddl_visitor visitorcallable(self.dialect, self, kwargs).traverse_single(element) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 664, in traverse_single return meth(obj, kw) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 918, in visit_metadata self.traverse_single( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 664, in traverse_single return meth(obj, kw) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 956, in visit_table )._invoke_with(self.connection) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 314, in _invoke_with return bind.execute(self) File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 180, in _execute_on_connection return connection._execute_ddl( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1529, in _execute_ddl ret = self._execute_context( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/gpu/anaconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: CREATE TABLE image ( id INTEGER NOT NULL, path VARCHAR(4096), modify_time DATETIME, features BINARY, PRIMARY KEY (id) )

] (Background on this error at: https://sqlalche.me/e/20/e3q8)

chn-lee-yumi commented 2 months ago

可以提供更多信息吗?比如程序启动的时候应该会把所有配置都打印出来。

kk0531 commented 2 months ago

(py310) gpu@gpu:/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main$ python main.py ** 运行配置 / RUNNING CONFIGURATIONS ** HOST: '0.0.0.0' PORT: 8085 ASSETS_PATH: ('/home', '/srv') SKIP_PATH: ('/tmp',) IMAGE_EXTENSIONS: ('.jpg', '.jpeg', '.png', '.gif', '.heic', '.webp', '.bmp') VIDEO_EXTENSIONS: ('.mp4', '.flv', '.mov', '.mkv', '.webm', '.avi') IGNORE_STRINGS: ('thumb', 'avatar', '__macosx', 'icons', 'cache') FRAME_INTERVAL: 2 SCAN_PROCESS_BATCH_SIZE: 8 IMAGE_MIN_WIDTH: 64 IMAGE_MIN_HEIGHT: 64 AUTO_SCAN: False AUTO_SCAN_START_TIME: (22, 30) AUTO_SCAN_END_TIME: (8, 0) AUTO_SAVE_INTERVAL: 100 MODEL_NAME: 'OFA-Sys/chinese-clip-vit-base-patch16' DEVICE: 'cpu' CACHE_SIZE: 64 POSITIVE_THRESHOLD: 36 NEGATIVE_THRESHOLD: 36 IMAGE_THRESHOLD: 85 LOG_LEVEL: 'INFO' SQLALCHEMY_DATABASE_URL: 'sqlite:///./instance/assets.db' TEMP_PATH: './tmp' VIDEO_EXTENSION_LENGTH: 0 ENABLE_LOGIN: False USERNAME: 'admin' PASSWORD: 'MaterialSearch' FLASK_DEBUG: False HF_HOME: None HF_HUB_OFFLINE: None TRANSFORMERS_OFFLINE: None CWD: /ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main


/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:1601: FutureWarning: clean_up_tokenization_spaces was not set. It will be set to True by default. This behavior will be depracted in transformers v4.45, and will be then set to False by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884 warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( /home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'proxyhk.huawei.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( Traceback (most recent call last): File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/main.py", line 282, in init() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/main.py", line 49, in init scanner.init() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/scan.py", line 54, in init create_tables() File "/ssd/ssd0/mnt_208_Realistic_tone_dataset/kk/MaterialSearch-main/models.py", line 35, in create_tables BaseModel.metadata.create_all(bind=engine) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 5866, in create_all bind._run_ddl_visitor( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3253, in _run_ddl_visitor conn._run_ddl_visitor(visitorcallable, element, kwargs) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2459, in _run_ddl_visitor visitorcallable(self.dialect, self, kwargs).traverse_single(element) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 664, in traverse_single return meth(obj, kw) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 918, in visit_metadata self.traverse_single( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 664, in traverse_single return meth(obj, kw) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 956, in visit_table )._invoke_with(self.connection) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 314, in _invoke_with return bind.execute(self) File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 180, in _execute_on_connection return connection._execute_ddl( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1529, in _execute_ddl ret = self._execute_context( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/gpu/miniconda3/envs/py310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: CREATE TABLE image ( id INTEGER NOT NULL, path VARCHAR(4096), modify_time DATETIME, features BINARY, PRIMARY KEY (id) )

] (Background on this error at: https://sqlalche.me/e/20/e3q8)

kk0531 commented 2 months ago

已经解决了,原因是代码放在共享路径下,改放在私有路径可规避该问题