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

!pip install vina failed in Google Colab, with a Linux Python 3 Google Compute Engine backend #330

Open
rwxayheee opened this issue Jul 18, 2024 · 8 comments

Comments

@rwxayheee
Copy link
Collaborator

rwxayheee commented Jul 18, 2024

The installation was attempted from Google Colaboratory, following a similar procedure to this.

!pip install vina gives

Collecting vina
  Downloading vina-1.2.5.tar.gz (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 2.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy>=1.18 (from vina)
  Downloading numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 kB 3.2 MB/s eta 0:00:00
Downloading numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.3/19.3 MB 53.6 MB/s eta 0:00:00
Building wheels for collected packages: vina
  error: subprocess-exited-with-error
  
  × Building wheel for vina (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for vina (pyproject.toml) ... error
  ERROR: Failed building wheel for vina
Failed to build vina
ERROR: Could not build wheels for vina, which is required to install pyproject.toml-based projects

The connected Python 3 Google Compute Engine backend is Linux.

On the other hand, conda install worked ^^

!conda install vina

after installing condacolab

!pip install -q condacolab
import condacolab
condacolab.install()

Hope the information is helpful anyone who run Jupyter Notebook with Google Colab

@Jameel9
Copy link

Jameel9 commented Aug 12, 2024

I had the same error on Colab and on conda env (Ubuntu PC). On my PC, I ran these commands

conda create -n vina
conda activate vina
conda config --env --add channels conda-forge
conda install -c conda-forge numpy swig boost-cpp sphinx sphinx_rtd_theme
pip install vina

the long msg error is attached
vina_error.txt

@rwxayheee
Copy link
Collaborator Author

rwxayheee commented Aug 12, 2024

Hi @Jameel9
Thanks for reporting this. conda install vina works for me. Please see this example Colab notebook from me ^^
https://colab.research.google.com/drive/1527GlrL-AHn4irrg19129PH4YvvabqNW?usp=sharing
I'm not sure why pip kept failing.. but we have had multiple reports on different platforms and we should look into that in the near future

@Jameel9
Copy link

Jameel9 commented Aug 12, 2024

pip

thank you!

@Jameel9
Copy link

Jameel9 commented Aug 13, 2024

Hi all,

I would be deeply grateful to receive help for this code issue (not vina itself). I have been trying to run virtual screening using the following code, but I couldn't capture the output for each molecule into a .log file.

import os
import glob
from vina import Vina
import gc


Directory = "/home/shirehorse/Desktop/VS"
ligand_files = glob.glob(f'{Directory}/ligands/*.pdbqt')
receptor_file = f"{Directory}/receptor_0.pdbqt"

for ligand_file in ligand_files:
    ligand_name = os.path.basename(ligand_file).replace('.pdbqt', '')
    result_file = f'{Directory}/results/{ligand_name}_out.pdbqt'
    
    if os.path.exists(result_file):
        print(f"Result file already exists: {result_file}. Skipping.")
        continue
    
    try:
        print(f"Starting docking for {ligand_file}...")
        
        # Initialize Vina
        vina = Vina(sf_name="vina", seed=4)
        vina.set_receptor(receptor_file)
        
        # Compute docking maps 
        vina.compute_vina_maps(Center=[5.84, 3.44, 2.09], box=[26, 38, 30] )
        
        # Set ligand and perform docking
        vina.set_ligand_from_file(ligand_file)
        vina.randomize()
        vina.dock(exhaustiveness=8, n_poses=9)
        
        # Write docking results
        vina.write_poses(
            result_file,
            energy_range=10000.0,
            overwrite=True,
            n_poses=9
        )
        
        print(f"Finished docking for {ligand_file}. Results saved to {result_file}.")
    
    except Exception as e:
        print(f"Exception occurred for {ligand_file}: {e}")
    
    finally:
        gc.collect() 

@rwxayheee
Copy link
Collaborator Author

Hi @Jameel9
vina.compute_vina_maps(Center=[5.84, 3.44, 2.09], box=[26, 38, 30] )
should be
vina.compute_vina_maps(center=[5.84, 3.44, 2.09], box_size=[26, 38, 30] )

Have you tried running this interactively? Doing this on a certain pair of receptor and ligand might be helpful for troubleshooting your own codes.

@Jameel9
Copy link

Jameel9 commented Aug 13, 2024

Thank you so much @rwxayheee for your response.
Sorry about this. I actually defined those parameters as individual variables.
BOX_SIZE = [26, 38, 30]
CENTER = [5.84, 3.44, 2.09]

and
vina.compute_vina_maps(center=CENTER, box_size=BOX_SIZE)

But when I copied the code to GitHub, I thought I would make it shorter and less messy but i successfully missed up with arguments wording :).

I did ran it interactively before and I kept getting something like this on the terminal as in the image below. The issue here is that I can't capture the affinities of each molecule into an independent log file.

Pasted image

@rwxayheee
Copy link
Collaborator Author

Hi @Jameel9
I see :) a quick way to redirect standard output and error is:
python virtual_screen.py &> virtual_screen.log
virtual_screen.log will have the contents that are printed to terminal

@Jameel9
Copy link

Jameel9 commented Aug 13, 2024

Ok. Thank you so much.

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

2 participants