Why R library 'ssw' cannot find python module installed via pip3, although pip3 module installation is satisfied?

Viewed 73

I am on Ubuntu 20.04.1 LTS focal, and using R. I want to install in R a library to perform local sequence alignments based upon the Smith-Waterman algorithm but via a faster implementation.

The R library is ssw and can be found here: https://github.com/nanxstats/ssw-r click link to github repo

description: ssw-r offers an R interface for SSW, a fast implementation of the Smith-Waterman algorithm for sequence alignment using SIMD. ssw-r is currently built on the Python package ssw-py

When I try to install it following the README.md steps,

  • remotes::install_github("nanxstats/ssw-r"), executes fine
  • reticulate::use_python("/usr/local/bin/python3"), also executes fine
  • library("ssw"), loading the library even executes fine
  • "ACGT" %>% align("TTTTACGTCCCCC"), running an example does not execute fine producing this error:
> "ACGT" %>% align("TTTTACGTCCCCC")
Error: Python module ssw was not found.

Detected Python configuration:

python:         /root/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /root/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome:     /root/.local/share/r-miniconda/envs/r-reticulate:/root/.local/share/r-miniconda/envs/r-reticulate
version:        3.6.11 | packaged by conda-forge | (default, Aug  5 2020, 20:09:42)  [GCC 7.5.0]
numpy:          /root/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.1

I have installed ssw-py as the README.md requested via;

$ sudo pip3 install ssw-py
Requirement already satisfied: ssw-py in /usr/local/lib/python3.8/dist-packages (0.2.6)

I am not sure what is wrong with the dependencies. When installing ssw in R the first time I was prompted whether I wanted to install miniconda and chose yes. I do not have anaconda installed on the system. (On Ubuntu bionic 18.04 I was able to install anaconda successfully and no matter how many times I tried on focal it would not work, eg the installer originally placed it in /root/anaconda3 in a small file)

What do I need to fix to get this library ssw to work?

1 Answers

I managed to solve the issue by using this command prior to the statement library("ssw"):

Sys.setenv(RETICULATE_PYTHON = "/usr/bin/python3")

The statement prescribed in the README.md reticulate::use_python("/usr/local/bin/python3") did not connect to the python installation and this one works on my system. This was discovered via:

$ which python3
/usr/bin/python3

and then using this directory as the system environment for the python connectivity

Related