Goosang-Yu / genet

Python library for genome editing, CRISPR gRNA design and prediction
14 stars 5 forks source link

Some comments about installation on macos M2 Pro #86

Closed francoiskroll closed 6 months ago

francoiskroll commented 6 months ago

In case it's helpful for the authors or future users, here is what worked on my M2 Pro macbook after a few trials:

conda create -n genet
conda activate genet

viennarna (a necessary dependency) does not have an arm64 install on conda at the time of writing (see), so we make the environment x64 with:

conda config --env --set subdir osx-64

Now to install dependencies (beware, do not be impatient and directly create the conda environment with conda create -n genet python=3.8 as recommended as that would install an arm64 version of python and create issues later).

conda install python=3.8
conda install conda-forge::tensorflow
pip install genet

# here, tutorial says pip install torch==1.11.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
# but that did not work for me
# I ran below and everything seems OK (although I have not used the package extensively yet)
pip install torch==1.11.0

conda install bioconda::viennarna

As first job, run:

from genet.predict import DeepPrime

seq_wt   = 'ATGACAATAAAAGACAACACCCTTGCCTTGTGGAGTTTTCAAAGCTCCCAGAAACTGAGAAGAACTATAACCTGCAAATGTCAACTGAAACCTTAAAGTGAGTATTTAATTGAGCTGAAGT'
seq_ed   = 'ATGACAATAAAAGACAACACCCTTGCCTTGTGGAGTTTTCAAAGCTCCCAGAAACTGAGACGAACTATAACCTGCAAATGTCAACTGAAACCTTAAAGTGAGTATTTAATTGAGCTGAAGT'

pegrna = DeepPrime('SampleName', seq_wt, seq_ed, edit_type='sub', edit_len=1)

pe2max_output = pegrna.predict(pe_system='PE2max', cell_type='HEK293T')

This should download model files (see #84) and test the install.

Goosang-Yu commented 6 months ago

Thanks for sharing the detailed instructions for installing Genet on M2 Pro! Honestly, I haven't had much experience using MacOS, so I haven't been able to test it extensively. It's been really helpful.

Upon closer inspection, it seems that versions of Python below 3.8 are not supported on Apple Silicon. That might have been part of the problem. Link to the issue

Do you think there would be no problem installing Python when creating a virtual environment with Python 3.9 or 3.10?

Also, I noticed that there might have been an issue with the installation instructions on the DeepPrime web version, so I've made some corrections.

Thanks again for sharing such valuable information!

francoiskroll commented 6 months ago

No problem, glad I could help.

Goosang-Yu commented 6 months ago

From genet >= 0.15.0, we don't need to install torch and viannarna seperately! Also, genet now import torch >= 2.0 🎉