Merck / BioPhi

BioPhi is an open-source antibody design platform. It features methods for automated antibody humanization (Sapiens), humanness evaluation (OASis) and an interface for computer-assisted antibody sequence design.
https://biophi.dichlab.org/
MIT License
131 stars 44 forks source link

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

Closed drmatthewclark closed 3 weeks ago

drmatthewclark commented 5 months ago

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'

Bek commented 4 months ago

The same error in docker compose setup also

mwdent91 commented 4 months ago

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.

robertpremise commented 2 months ago

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 commented 2 months ago

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

rbf22 commented 2 months ago

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

RayEscBSU commented 1 month ago

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

prihoda commented 3 weeks ago

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