How to install dependencies in conda environment in Google colab?
1
0
Entering edit mode
5 months ago
KABILAN ▴ 130

I am new to Python. For analyzing the single-cell multiomics datasets, I have purchased Google Colab Pro. Because the dataset is large, the model requires GPU and conda environment for the analysis. I have installed the miniconda by using the following command,

!wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local

Except Python 3.8.1 I couldn't install the other dependencies in the conda environment. I have used the following code to install python,

!conda create -n scMDC python=3.8.1 --solver classic -y

The other dependencies are:

Python 3.8.1

Pytorch 1.6.0

Scanpy 1.6.0

SKlearn 0.22.1

Numpy 1.18.1

h5py 2.9.0

I have tried the following code for running the other dependencies, but the code returned the error messages.

!conda install -n scMDC -c conda-forge pytorch==1.6.0 scanpy==1.6.0 scikit-learn==0.22.1 numpy==1.18.1 h5py==2.9.0 --solver classic -y

The model which I am trying to run is scMDC (https://github.com/xianglin226/scMDC).

Google colab pro providing only 100 computing units. But everytime I am wasting the computing units, just by running the wrong codes again and again. So kindly provide your suggestions to solve this matter.

conda gpu multiomics google-colab single-cell • 696 views
ADD COMMENT
2
Entering edit mode
5 months ago
Michael 55k

I didn't manage to solve the environment as it is. The reason is that h5py 2.9 is incompatible with the required Python version (3.8.1). It was possible to solve the following relaxed environment which will give you h5py 2.10 and possibly a different version of scanpy. You have to test the program you want to use with these.

 conda create -n scMDC -c conda-forge -y python==3.8.1  pytorch==1.6.0 scanpy scikit-learn==0.22.1 numpy==1.18.1 h5py=2

A few comments:

  • If you have to try out different environments, use a local computer until you find a configuration that works to save paid compute tokens.
  • I am wondering whether Colab is the right environment for this task. If already solving conda environments uses up a lot of paid CPU time, will you be able to run a large ML model on real data?
  • On the other hand, I ran the installation on the free colab and it took only a few minutes.
ADD COMMENT
0
Entering edit mode

Thank you @michael. The court that you provided was running and all the modules were installed in the local runtime only. But after installing, I have tried the following code to check the version,

import scanpy as sc
print(sc.__version__)

But I am getting error. So, kindly suggest me how to check whether all the modules are installed properly in the respective version only.

ADD REPLY
1
Entering edit mode

Thank you so much. I tried the following code, it was working.

!conda run -n scMDC python -c "import h5py; print(h5py.__version__)"
ADD REPLY
1
Entering edit mode

Great! Now, let's hope that scMDC doesn't stumble over the unavoidable version differences. You need to do a test round with the application to be sure.

ADD REPLY

Login before adding your answer.

Traffic: 2268 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6