Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem GNM DEmo: AttributeError: 'C KDTree' object has no attribute 'neighbor_get_count' #2049

Open
dlbeveridge opened this issue Feb 23, 2025 · 5 comments

Comments

@dlbeveridge
Copy link

Hi Any ideas abot this problem?

In [4]: from matplotlib.pylab import *

In [5]: ion() # turn interactive mode on
...:
Out[5]: <contextlib.ExitStack at 0x1080f1ae0>

In [6]: ubi = parsePDB('1aar')
...:
@> Connecting wwPDB FTP server RCSB PDB (USA).
@> Downloading PDB files via FTP failed, trying HTTP.
@> 1aar downloaded (1aar.pdb.gz)
@> PDB download via HTTP completed (1 downloaded, 0 failed).
@> 1218 atoms and 1 coordinate set(s) were parsed in 0.01s.

In [7]: ubi
Out[7]: <AtomGroup: 1aar (1218 atoms)>

In [8]: ubi = parsePDB('1aar')
...:
@> Connecting wwPDB FTP server RCSB PDB (USA).
@> Downloading PDB files via FTP failed, trying HTTP.
@> 1aar downloaded (1aar.pdb.gz)
@> PDB download via HTTP completed (1 downloaded, 0 failed).
@> 1218 atoms and 1 coordinate set(s) were parsed in 0.01s.

In [9]: calphas = ubi.select('calpha and chain A and resnum < 71')

In [10]: calphas
Out[10]: <Selection: 'calpha and chai...and resnum < 71' from 1aar (70 atoms)>

In [11]: In [8]: gnm = GNM('Ubiquitin')

In [12]: gnm.buildKirchhoff(calphas)

AttributeError Traceback (most recent call last)
Cell In[12], line 1
----> 1 gnm.buildKirchhoff(calphas)

File /opt/miniconda3/envs/prody_env_py310/lib/python3.10/site-packages/prody/dynamics/gnm.py:156, in GNMBase.buildKirchhoff(self, coords, cutoff, gamma, **kwargs)
154 kdtree = KDTree(coords)
155 kdtree.search(cutoff)
--> 156 dist2 = kdtree.getDistances() ** 2
157 r = 0
158 for i, j in kdtree.getIndices():

File /opt/miniconda3/envs/prody_env_py310/lib/python3.10/site-packages/prody/kdtree/kdtree.py:273, in KDTree.getDistances(self)
270 def getDistances(self):
271 """Returns array of distances."""
--> 273 if self.getCount():
274 if self._unitcell is None:
275 if self._neighbors is None:

File /opt/miniconda3/envs/prody_env_py310/lib/python3.10/site-packages/prody/kdtree/kdtree.py:291, in KDTree.getCount(self)
289 return self._kdtree.get_count()
290 else:
--> 291 return self._kdtree.neighbor_get_count()
292 else:
293 return len(self._pbcdict)

AttributeError: 'C KDTree' object has no attribute 'neighbor_get_count'

In [13]:

@jamesmkrieger
Copy link
Contributor

install prody from source in development mode and build the C extensions in place

@jamesmkrieger
Copy link
Contributor

git clone https://github.com/prody/ProDy.git
cd ProDy
python setup.py build_ext --inplace --force
pip install -Ue .

@AnthonyBogetti
Copy link
Member

Hi @jamesmkrieger I actually ran into this on a fresh 2.5.0 conda install yesterday. Installing from source works fine. I noticed that in the install from source, my ProDy/prody/kdtree directory looks like this:

__init__.py KDTree.c KDTree.h KDTreemodule.c kdtree.py Neighbor.h

while in the conda install (where KDTree doesn't fully work) it looks like this:

_CKDTree.cpython-39-x86_64-linux-gnu.so __init__.py kdtree.py __pycache__

Is there something going on with the c extension compilation at install?

@jamesmkrieger
Copy link
Contributor

Thanks Anthony. I am still working on the conda build. Maybe we need to make sure it packages more files.

Where is the .so file in the install from source? Is it in the main prody directory?

@AnthonyBogetti
Copy link
Member

AnthonyBogetti commented Feb 25, 2025

It is located here: ProDy/build/lib.linux-x86_64-cpython-312/prody/kdtree/_CKDTree.cpython-312-x86_64-linux-gnu.so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants