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

Issue on tutorial T010_binding_site_comparison #148

Closed
andresilvapimentel opened this issue Sep 22, 2021 · 9 comments · Fixed by #151
Closed

Issue on tutorial T010_binding_site_comparison #148

andresilvapimentel opened this issue Sep 22, 2021 · 9 comments · Fixed by #151

Comments

@andresilvapimentel
Copy link

andresilvapimentel commented Sep 22, 2021

I found difficulty to install the tutorial T010 because It seems the MDAnalysis package is not installed properly or numpy package is with an issue. Please, see the error message below:

ValueError                                Traceback (most recent call last)
<ipython-input-5-359cda61cea2> in <module>()
      1 import opencadd
----> 2 from opencadd.structure.core import Structure
      3 from opencadd.structure.superposition.api import align, METHODS
      4 from opencadd.structure.superposition.engines.mda import MDAnalysisAligner
      5 from teachopencadd.utils import seed_everything

5 frames
/usr/local/lib/python3.7/site-packages/MDAnalysis/lib/util.py in <module>()
    215 from ..exceptions import StreamWarning, DuplicateWarning
    216 try:
--> 217     from ._cutil import unique_int_1d
    218 except ImportError:
    219     raise ImportError("MDAnalysis not installed properly. "

MDAnalysis/lib/_cutil.pyx in init MDAnalysis.lib._cutil()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
@dominiquesydow
Copy link
Collaborator

Hi @andresilvapimentel, thank you for your report!
I cannot reproduce the error locally; what operating system are you using?

Could you please re-install the environment?

Side note: I recommend using mamba instead of conda because it is so much faster:
https://mamba.readthedocs.io/en/latest/installation.html#mamba

# Use conda or mamba to re-install the environment
mamba env create -f https://raw.githubusercontent.com/volkamerlab/TeachOpenCADD/master/devtools/other-conda-envs/users_env.yml'
# Activate environment
conda activate teachopencadd
# Fire up JLab
jupyter lab
# Open the T010 notebook, re-run, and let me know if the problem is still there

@andresilvapimentel
Copy link
Author

andresilvapimentel commented Sep 22, 2021

I am using google colab.
I did:
1)

pip install --upgrade MDAnalysis
import MDAnalysis
from MDAnalysis.analysis import rms
!pip install https://github.com/volkamerlab/opencadd/archive/master.tar.gz
!pip install condacolab
import condacolab
condacolab.install()
!wget https://raw.githubusercontent.com/volkamerlab/TeachOpenCADD/master/devtools/other-conda-envs/users_env.yml
!mamba env update -n base -f users_env.yml
import logging
from pathlib import Path
import random
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import redo
#import nglview as nv
import pypdb
import biotite.database.rcsb as rcsb
from rdkit import Chem
from rdkit.Chem import Draw, AllChem
import opencadd
from opencadd.structure.core import Structure
from opencadd.structure.superposition.api import align, METHODS
from opencadd.structure.superposition.engines.mda import MDAnalysisAligner
from teachopencadd.utils import seed_everything
seed_everything()

And I got the error message:

ValueError                                Traceback (most recent call last)
<ipython-input-5-359cda61cea2> in <module>()
      1 import opencadd
----> 2 from opencadd.structure.core import Structure
      3 from opencadd.structure.superposition.api import align, METHODS
      4 from opencadd.structure.superposition.engines.mda import MDAnalysisAligner
      5 from teachopencadd.utils import seed_everything

5 frames
/usr/local/lib/python3.7/site-packages/MDAnalysis/lib/util.py in <module>()
    215 from ..exceptions import StreamWarning, DuplicateWarning
    216 try:
--> 217     from ._cutil import unique_int_1d
    218 except ImportError:
    219     raise ImportError("MDAnalysis not installed properly. "

MDAnalysis/lib/_cutil.pyx in init MDAnalysis.lib._cutil()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

@dominiquesydow
Copy link
Collaborator

Hi @andresilvapimentel,

I can reproduce the problem on Google Colab.
It has been discussed here without a solution yet: MDAnalysis/mdanalysis#3286
Maybe the numpy version installed on Colab conflicts with the numpy version installed via our environment?

Since I cannot offer a fix, as an alternative I suggest to run the notebooks locally via Jupyter Lab or via Binder.

I will add an issue about adding support for Google Colab in the future.

@schallerdavid
Copy link
Collaborator

Hello @andresilvapimentel ,

I found a workaround to get a proper installation on colab. The problem comes from an older version installed on colab. This appears to be the default numpy version being used, although we install a new version with mamba.

Add these first cells in the beginning of the practical part:

!pip install --upgrade numpy

!pip install condacolab
import condacolab
condacolab.install()
!wget https://raw.githubusercontent.com/volkamerlab/TeachOpenCADD/master/devtools/other-conda-envs/users_env.yml
!mamba env update -n base -f users_env.yml

However, nglview is not supported on google colab.

All the best,
David

@andresilvapimentel
Copy link
Author

It works now!!! Thanks!!!!

@dominiquesydow
Copy link
Collaborator

Hi @andresilvapimentel, just as a follow-up: I get the same problem now locally, too, so it is not restricted to Google Colab after all. I am trying to fix the issue here: #150

@Debojyoti91
Copy link

I am trying to align the proteins, getting this error:

AttributeError Traceback (most recent call last)
/var/folders/00/ry7fj0h1699fnq5ygl9wwg180000gn/T/ipykernel_17073/2213996725.py in
1 # NBVAL_CHECK_OUTPUT
----> 2 rmsd_matrix = calc_rmsd_matrix(proteins, pdb_ids)
3 rmsd_matrix.round(1)

/var/folders/00/ry7fj0h1699fnq5ygl9wwg180000gn/T/ipykernel_17073/565021889.py in calc_rmsd_matrix(structures, names)
22 continue
23 if i < j:
---> 24 rmsd = calc_rmsd(A, B)
25 values[name_i][name_j] = rmsd
26 values[name_j][name_i] = rmsd

/var/folders/00/ry7fj0h1699fnq5ygl9wwg180000gn/T/ipykernel_17073/1486634301.py in calc_rmsd(A, B)
16 """
17 aligner = MDAnalysisAligner()
---> 18 selection, _ = aligner.matching_selection(A, B)
19 A = A.select_atoms(selection["reference"])
20 B = B.select_atoms(selection["mobile"])

~/miniconda3/lib/python3.7/site-packages/opencadd/structure/superposition/engines/mda.py in matching_selection(self, ref_selection, mob_selection)
236 ref_segids=ref_segids,
237 target_segids=mob_segids,
--> 238 backbone_selection=self.per_residue_selection,
239 )
240 return selection, alignment

~/miniconda3/lib/python3.7/site-packages/opencadd/structure/superposition/sequences.py in fasta2select(fastafilename, ref_resids, ref_segids, target_resids, target_segids, backbone_selection)
115
116 """
--> 117 protein_gapped = Bio.Alphabet.Gapped(Bio.Alphabet.IUPAC.protein)
118 with open(fastafilename) as fasta:
119 alignment = Bio.AlignIO.read(fasta, "fasta", alphabet=protein_gapped)

AttributeError: module 'Bio' has no attribute 'Alphabet'

@dominiquesydow
Copy link
Collaborator

Hi, quick question: did you use the official teachopencadd installation? https://projects.volkamerlab.org/teachopencadd/installing.html
if not, could you try again with the official installation to check if the error goes away, please?

we pinned biopython, in order to not run into this issue iirc, see our environment here:

- biopython<=1.77

you can check you biopython version in you conda env with:
conda list biopython

@Debojyoti91
Copy link

Hi, quick question: did you use the official teachopencadd installation? https://projects.volkamerlab.org/teachopencadd/installing.html if not, could you try again with the official installation to check if the error goes away, please?

we pinned biopython, in order to not run into this issue iirc, see our environment here:

- biopython<=1.77

you can check you biopython version in you conda env with: conda list biopython

Thank you so much, I downgraded my biopython version, now it works, really appreciate your help.

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

Successfully merging a pull request may close this issue.

4 participants