Psy-Fer / deeplexicon

Signal based nanopore RNA demultiplexing with convolutional neural networks
https://psy-fer.github.io/deeplexicon/
MIT License
34 stars 8 forks source link

Issues creating an environment for deeplexicon GPU use #22

Closed zigavicic closed 1 year ago

zigavicic commented 1 year ago

Hi,

so I am running into a lot of dependency issues trying to create a conda environment for using deeplexicon in GPU mode and was wondering if you could provide a tested requirements file for this. Even in the README.md there seem to be some conflicts as CuDNN v7.6 isn't compatible with tensorflow-1.14.

Any help would be much appreciated!

Psy-Fer commented 1 year ago

Hello,

Have you tried the docker builds?

https://github.com/Psy-Fer/deeplexicon#docker-images

When we released this, tensorflow and cuda were going through some growing pains, so yea there are some compatibility issues that are tricky to sort out. Hopefully the docker images help you get what you need.

Let me know if they aren't working or won't work for your needs.

James

zigavicic commented 1 year ago

The HPC I am working with doesn't allow for Docker installation so I was hoping there'd be a way to go around that.

Psy-Fer commented 1 year ago

Hey,

try with tensorflow 1.13.1

python3 -m venv ~/src/venv/deeplexicon-gpu
source ~/src/venv/deeplexicon-gpu/bin/activate
pip install h5py==2.10 Keras==2.2.4 Pandas PyTs==0.8.0 Scikit-learn numba==0.53 TensorFlow-gpu==1.13.1
zigavicic commented 1 year ago

What are the CUDA and CuDNN versions you use in this environment and how did you install those?

Psy-Fer commented 1 year ago

Cuda 10.0 and cuDNN 7.6

Psy-Fer commented 1 year ago

And to install, that depends on the system.

zigavicic commented 1 year ago

Used singularity to import and run the docker image and get the same error as from my own environment.

Input command: singularity run ../deeplexicon_1.2.0-gpu.sif deeplexicon_multi.py

Output error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/local/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/lib/python3.7/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/deeplexicon/deeplexicon_multi.py", line 4, in <module>
    from deeplexicon_sub import *
  File "/deeplexicon/deeplexicon_sub.py", line 21, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/local/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/lib/python3.7/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
enovoa commented 1 year ago

You can also use DeePlexicon that is embedded inside Nextflow workflow in MasterOfPores: https://github.com/biocorecrg/master_of_pores That should solve all your environment issues :)

enovoa commented 1 year ago

also which singularity version are you using?

zigavicic commented 1 year ago

I have since resolved this issue, in my case it seemed the Docker image ran using singularity didn't contain CUDA and cudatoolkit dependencies so after installing those it works fine.