gem / oq-engine

OpenQuake Engine: a software for Seismic Hazard and Risk Analysis
https://github.com/gem/oq-engine/#openquake-engine
GNU Affero General Public License v3.0
377 stars 273 forks source link

ImportError: cannot import name 'SettingWithCopyWarning' from 'pandas.core.common' #8938

Closed jinyan1214 closed 1 year ago

jinyan1214 commented 1 year ago

The error File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commands/run.py", line 25, in <module> from pandas.core.common import SettingWithCopyWarning ImportError: cannot import name 'SettingWithCopyWarning' from 'pandas.core.common' (/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/common.py) comes up when I run one of the demos.

This error can be solved by importing "SettingWithCopyWarning" from "pandas.errors" instead of "pandas.core.common". in the file "/openquake/commands/run.py."

I am using openquake version 3.17.1 and pandas version 1.5.3.

ptormene commented 1 year ago

In fact pandas 1.5.3 is more recent than what's specified in the engine requirements for OQ 3.17.1 (see the requirements-* files in https://github.com/gem/oq-engine/tree/v3.17.1).

jinyan1214 commented 1 year ago

Thank you very much. After switching pandas to 1.4.2 as required by OQ 3.17.1, I ran into the following error when I ran "oq engine --run job.ini" in the demos/ScenarioCase1 directory. Could you please give me some insights on how to solve this? Thanks. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/bin/oq", line 8, in <module> sys.exit(oq()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commands/__main__.py", line 48, in oq sap.run(commands, prog='oq') File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/baselib/sap.py", line 212, in run return _run(parser(funcdict, **parserkw), argv) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/baselib/sap.py", line 203, in _run return func(**dic) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commands/engine.py", line 170, in main jobs = create_jobs(job_inis, log_level, log_file, user_name, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/engine/engine.py", line 342, in create_jobs jobs.append(logs.init('job', dic, log_level, log_file, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commonlib/logs.py", line 303, in init return LogContext(job_ini, calc_id, log_level, log_file, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commonlib/logs.py", line 207, in __init__ self.calc_id = dbcmd( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commonlib/logs.py", line 73, in dbcmd return res.get() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/baselib/parallel.py", line 392, in get raise etype(msg) sqlite3.OperationalError: File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/baselib/parallel.py", line 415, in new val = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/server/db/actions.py", line 118, in create_job return db('INSERT INTO job (?S) VALUES (?X)', File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/openquake/commonlib/dbapi.py", line 338, in __call__ raise exc.__class__('%s: %s %s' % (exc, templ, args)) OperationalError: attempt to write a readonly database: INSERT INTO job (id, is_running, description, user_name, calculation_mode, hazard_calculation_id, ds_calc_dir, host) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (5, 1, 'Scenario Calculation with Simple Fault Rupture', 'jinyanzhao', 'scenario', None, '/Users/jinyanzhao/oqdata/calc_5', 'Jinyans-MacBook-Pro.local')

ptormene commented 1 year ago

attempt to write a readonly database sounds strange. Does it happen when you run any calculation? Have you already tried to stop and restart the dbserver?