prody / ProDy

A Python Package for Protein Dynamics Analysis
http://prody.csb.pitt.edu
Other
432 stars 157 forks source link

ImportError While Using the ProDy Interface in NMWizard #1961

Open DaddyDaddyFish opened 1 month ago

DaddyDaddyFish commented 1 month ago

I'm new to ProDy and I was following the NMWiz tutorial to run ANM with the example pdb file. I loaded the PDB file in VMD, opened the ProDy interface in NMWiz, and followed the atom selection steps from the tutorial. After clicking the 'Submit Job' button, I received the following error: ImportError: /usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2

My Environment

I have tried reinstalling the following for several times:

Despite these reinstallations, the problem persists.

Observations:

I noticed that, when I clicked 'submit job' in the ProDy interface, a line of command was excecuted in the terminal: /virtual/venv/bin/python /virtual/venv/bin/prody anm --quiet -s all -o /MD1/nma/prody -p /MD1/nma/prody/2k39_anm -n 10 -c 15 -g 1 "/MD1/nma/prody/2k39.pdb"

I closed VMD, copied and ran this command directly in the terminal. Surprisingly, ProDy finished the job without any errors and generated a valid .nmd file. I confirmed the correctness of the file by loading it into NMWiz.

Other details:

I also followed this tutorial to the end in another attempt and everything was fine. This further confirms that ProDy may not be the problem.

One might notice that I installed ProDy under venv. But I have tried deactivating venv, installing everything on the system directly, and redoing all of the above steps. The returned error is the same. So venv should not be the problem.

I'm out of ideas at this moment. Any insights or suggestions on what could be causing this issue would be greatly appreciated :(

Thank you for your time!

Just for information, here is the complete error log:

Traceback (most recent call last):
  File "/virtual/venv/bin/prody", line 5, in <module>
    from prody.apps import prody_main
  File "/virtual/venv/lib/python3.10/site-packages/prody/__init__.py", line 88, in <module>
    from . import proteins
  File "/virtual/venv/lib/python3.10/site-packages/prody/proteins/__init__.py", line 163, in <module>
    from . import compare
  File "/virtual/venv/lib/python3.10/site-packages/prody/proteins/compare.py", line 16, in <module>
    from prody.sequence import MSA
  File "/virtual/venv/lib/python3.10/site-packages/prody/sequence/__init__.py", line 53, in <module>
    from . import msa
  File "/virtual/venv/lib/python3.10/site-packages/prody/sequence/msa.py", line 9, in <module>
    from Bio import AlignIO
  File "/virtual/venv/lib/python3.10/site-packages/Bio/AlignIO/__init__.py", line 147, in <module>
    from . import MafIO
  File "/virtual/venv/lib/python3.10/site-packages/Bio/AlignIO/MafIO.py", line 38, in <module>
    from sqlite3 import dbapi2
  File "/usr/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2
Traceback (most recent call last):
  File "/virtual/venv/bin/prody", line 5, in <module>
    from prody.apps import prody_main
  File "/virtual/venv/lib/python3.10/site-packages/prody/__init__.py", line 88, in <module>
    from . import proteins
  File "/virtual/venv/lib/python3.10/site-packages/prody/proteins/__init__.py", line 163, in <module>
    from . import compare
  File "/virtual/venv/lib/python3.10/site-packages/prody/proteins/compare.py", line 16, in <module>
    from prody.sequence import MSA
  File "/virtual/venv/lib/python3.10/site-packages/prody/sequence/__init__.py", line 53, in <module>
    from . import msa
  File "/virtual/venv/lib/python3.10/site-packages/prody/sequence/msa.py", line 9, in <module>
    from Bio import AlignIO
  File "/virtual/venv/lib/python3.10/site-packages/Bio/AlignIO/__init__.py", line 147, in <module>
    from . import MafIO
  File "/virtual/venv/lib/python3.10/site-packages/Bio/AlignIO/MafIO.py", line 38, in <module>
    from sqlite3 import dbapi2
  File "/usr/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2
    while executing
"exec $::NMWiz::pybin $::NMWiz::prody anm --quiet -s $selstr {*}$args "$pdbfn""
    (procedure "::NMWiz::prodySubmitANMjob" line 42)
    invoked from within
"::NMWiz::prodySubmitANMjob"
    (procedure "::NMWiz::prodySubmitJob" line 22)
    invoked from within
"::NMWiz::prodySubmitJob"
    invoked from within
".nmwizprody.submitFrame.prodySubmit invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 22)
    invoked from within
"tk::ButtonUp .nmwizprody.submitFrame.prodySubmit"
    (command bound to event)
jamesmkrieger commented 1 month ago

I'd guess that this is something to do with how the environment is set up when running inside vmd, so that something required by sqlite3 isn't accessible properly. Can you install vmd inside the same venv and run it from there? Or even just run vmd with the venv active?

We sometimes run vmd from inside our python environments to get drugui working too

DaddyDaddyFish commented 1 month ago

Thanks for the reply.

The error log in my previous post was already generated with VMD launched under venv. I'm not sure how to install VMD inside venv. My impression is that venv can only handle python packages while VMD is a seperate application.

I also suspected that the problem was caused by venv before, which is why I installed everything again on the system with venv deactived. But the errorlog was somewhat the same:

Traceback (most recent call last):
  File "/usr/local/bin/prody", line 5, in <module>
    from prody.apps import prody_main
  File "/usr/local/lib/python3.10/dist-packages/prody/__init__.py", line 88, in <module>
    from . import proteins
  File "/usr/local/lib/python3.10/dist-packages/prody/proteins/__init__.py", line 163, in <module>
    from . import compare
  File "/usr/local/lib/python3.10/dist-packages/prody/proteins/compare.py", line 16, in <module>
    from prody.sequence import MSA
  File "/usr/local/lib/python3.10/dist-packages/prody/sequence/__init__.py", line 53, in <module>
    from . import msa
  File "/usr/local/lib/python3.10/dist-packages/prody/sequence/msa.py", line 9, in <module>
    from Bio import AlignIO
  File "/usr/local/lib/python3.10/dist-packages/Bio/AlignIO/__init__.py", line 147, in <module>
    from . import MafIO
  File "/usr/local/lib/python3.10/dist-packages/Bio/AlignIO/MafIO.py", line 38, in <module>
    from sqlite3 import dbapi2
  File "/usr/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2
Traceback (most recent call last):
  File "/usr/local/bin/prody", line 5, in <module>
    from prody.apps import prody_main
  File "/usr/local/lib/python3.10/dist-packages/prody/__init__.py", line 88, in <module>
    from . import proteins
  File "/usr/local/lib/python3.10/dist-packages/prody/proteins/__init__.py", line 163, in <module>
    from . import compare
  File "/usr/local/lib/python3.10/dist-packages/prody/proteins/compare.py", line 16, in <module>
    from prody.sequence import MSA
  File "/usr/local/lib/python3.10/dist-packages/prody/sequence/__init__.py", line 53, in <module>
    from . import msa
  File "/usr/local/lib/python3.10/dist-packages/prody/sequence/msa.py", line 9, in <module>
    from Bio import AlignIO
  File "/usr/local/lib/python3.10/dist-packages/Bio/AlignIO/__init__.py", line 147, in <module>
    from . import MafIO
  File "/usr/local/lib/python3.10/dist-packages/Bio/AlignIO/MafIO.py", line 38, in <module>
    from sqlite3 import dbapi2
  File "/usr/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so: undefined symbol: sqlite3_trace_v2
    while executing
"exec $::NMWiz::pybin $::NMWiz::prody anm --quiet -s $selstr {*}$args "$pdbfn""
    (procedure "::NMWiz::prodySubmitANMjob" line 42)
    invoked from within
"::NMWiz::prodySubmitANMjob"
    (procedure "::NMWiz::prodySubmitJob" line 22)
    invoked from within
"::NMWiz::prodySubmitJob"
    invoked from within
".nmwizprody.submitFrame.prodySubmit invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 22)
    invoked from within
"tk::ButtonUp .nmwizprody.submitFrame.prodySubmit"
    (command bound to event)

Some other stuff

I did notice that, it seemed like VMD imported sqlite3 from the system python library all the time, regardless of whether VMD was launched with venv activated or not. I'm not sure what to make of it though.

I don't know how to launch VMD in python environment properly, but I saw that there is a viewNMDinVMD() function in the ProDy package so I just ranviewNMDinVMD('') after importing ProDy into python to launch VMD. But the error I got was the same when I try to use ProDy in NMWiz.

Next

I'm ready to startover to see if this can solve the problem, but I'm new to everything and I could really use some suggestions:

  1. Is it necessary/good practice to use venv to install python packages?
  2. Is it better to install python packages for the system (sudo pip install prody) or for the user (pip install prody) since I'm working with WSL?

Thanks again.

jamesmkrieger commented 1 month ago

Yes, it’s definitely good to use an environment rather than the system python to have things controlled. We usually use conda instead of venv and there’s vmd in conda-forge so you could try that. Maybe conda just generally handles things better

jamesmkrieger commented 1 month ago

I’m using wsl too so I can give this vmd functionality a try in the coming days

If you really want to use a graphical interface instead of the python API and can’t get vmd to work, there’s also a prody plugin in the scipion workflow engine

DaddyDaddyFish commented 1 month ago

Thank you so much. I decided to just use the anm application instead of the VMD ProDy interface for now. But I would be very grateful if you can let me know what you have found out. I will post the result here if I try it agian with conda-VMD. Thanks again!

jamesmkrieger commented 1 month ago

ok

jamesmkrieger commented 1 month ago

ok, I now have pip prody 2.4.1 and conda vmd 1.9.3 installed in the same environment with python 3.9 and I am getting the same error as you about sqlite3.

jamesmkrieger commented 1 month ago

ok, installing sqlite 3.31.1 inside that environment with conda install -c blaze sqlite made everything work

jamesmkrieger commented 1 month ago

ok, I now have pip prody 2.4.1 and conda vmd 1.9.3 installed in the same environment with python 3.9 and I am getting the same error as you about sqlite3.

for some reason, using the conda prody broke the vmd