BioPhi icon indicating copy to clipboard operation
BioPhi copied to clipboard

AttributeError: 'Engine' object has no attribute 'cursor'

Open drmatthewclark opened this issue 1 year ago • 5 comments

following conda install instructions the system throws an error when computing humanness AttributeError: 'Engine' object has no attribute 'cursor'

[2024-02-06 13:58:11,833: ERROR/ForkPoolWorker-14] Task biophi.humanization.web.tasks.humanness_task[9fe7dc93-8651-49ab-baec-f3a0386376f5] raised unexpected: HumannessTaskError("'Engine' object has no attribute 'cursor'") Traceback (most recent call last): File "/home/mclark/BioPhi/biophi/humanization/web/tasks.py", line 305, in humanness_task humanness=get_antibody_humanness( File "/home/mclark/BioPhi/biophi/humanization/methods/humanness.py", line 275, in get_antibody_humanness vh=get_chain_humanness(vh, params=params) if vh else None, File "/home/mclark/BioPhi/biophi/humanization/methods/humanness.py", line 321, in get_chain_humanness peptides = get_chain_oasis_peptides(chain, params=params) File "/home/mclark/BioPhi/biophi/humanization/methods/humanness.py", line 303, in get_chain_oasis_peptides oas_hits = get_oas_hits( File "/home/mclark/BioPhi/biophi/humanization/methods/humanness.py", line 367, in get_oas_hits return pd.read_sql(statement, params=peptides, con=engine) File "/home/mclark/.conda/envs/biophi-dev/lib/python3.9/site-packages/pandas/io/sql.py", line 706, in read_sql return pandas_sql.read_query( File "/home/mclark/.conda/envs/biophi-dev/lib/python3.9/site-packages/pandas/io/sql.py", line 2739, in read_query cursor = self.execute(sql, params) File "/home/mclark/.conda/envs/biophi-dev/lib/python3.9/site-packages/pandas/io/sql.py", line 2673, in execute cur = self.con.cursor() AttributeError: 'Engine' object has no attribute 'cursor'

drmatthewclark avatar Feb 06 '24 19:02 drmatthewclark

The same error in docker compose setup also

Bek avatar Feb 21 '24 14:02 Bek

I haven't fully tested it but I think the issue is with Pandas version 2.2. Replacing it with version 2.1.4 made the error go away.

mwdent91 avatar Mar 01 '24 07:03 mwdent91

Try to do a connection before you read your query: engine = create_engine(str_conn) connection = engine.raw_connection() df = pd.read_sql(query, con=connection)

robertpremise avatar Apr 17 '24 15:04 robertpremise

If you keep getting the error maybe it's because your pandas version. I got it just for reading purposes but when I tried to send the df into mysql, it failed

robertpremise avatar Apr 24 '24 19:04 robertpremise

Yes, this is definitely pandas >=2.2 that causes this error.

rbf22 avatar May 01 '24 13:05 rbf22

I uninstalled sqlalchemy and pandas then reinstalled and it fixed the problem

RayEscBSU avatar May 30 '24 13:05 RayEscBSU

Fixed in new biophi build on bioconda, thanks everyone for reporting and sorry for the delay.

prihoda avatar Jun 10 '24 10:06 prihoda