Question: Installing and importing viennaRNA to python in windows
0
gravatar for ofek.schnitzer
5 months ago by
ofek.schnitzer20 wrote:

Hello, I've tried to install and import viennaRNA python package on a windows computer in many different ways, but none of them succeeded. (eventually I always get to 'no module named 'RNA'' message). Do anyone know what will be the right way to do so? I could not find any detailed guide. Alternatively, are there any other good python packages that calculates RNA MFE? Thank you!

viennarna rna python • 464 views
ADD COMMENTlink modified 5 months ago • written 5 months ago by ofek.schnitzer20

I think we're going to need more information to be able to help. Doing this on windows complicates things a bit.

  • How did you install python? And what version(s)?
  • Do you have only a single python installation?
  • How did you install viennaRNA
  • What is the exact code you're trying to import with?
  • What are the precise error messages you get?
ADD REPLYlink written 5 months ago by Joe15k

Did you use the installer from the website? https://www.tbi.univie.ac.at/RNA/index.html#pack_windows

ADD REPLYlink written 5 months ago by ATpoint28k

I'm using python 3.6 (anaconda) and pycharm. I've tried to use the windows installer from https://www.tbi.univie.ac.at/RNA/index.html#pack_windows - the installer finished successfully but it had no effect on my python (still could not import the package). I've looked for a conda installation for this package but it is not suitable for windows. I tried to look for a pip installation but could not find such. I also tried to download the package directly from github (https://github.com/ViennaRNA/ViennaRNA) but could not find a way to install it from the files I got (the instructions only refers to linux installaions). Bottom line every time i try to import the package with 'import RNA' I get 'ModuleNotFoundError: No module named 'RNA''. thank you for your help!

ADD REPLYlink written 5 months ago by ofek.schnitzer20

Have you tried just running conda install -c bioconda viennarna from inside the PyCharm terminal?

You must make sure the python interpreter that your PyCharm project is using is the one from your conda distribution, not a system python of pycharms own.

ADD REPLYlink written 5 months ago by Joe15k

I tried to run it from the anaconda terminal and got 'PackagesNotFoundError: The following packages are not available from current channels: -viennarna'. On anconcda's website (https://anaconda.org/bioconda/viennarna) they mention that this package is only available for linux and osx, so I guess this is the reason that it is not working. I'm absolutely sure that i'm using the right python version as my PyCharm's interpreter (i've already installed a lot of packages using pip or conda and used them in pycharm afterwards).

ADD REPLYlink written 5 months ago by ofek.schnitzer20

From the github it looks like a C program, so it doesn't make any sense to install it in python. I have only looked through a few of the directories but I don't see any python at all.

ADD REPLYlink written 5 months ago by drkennetz470

It is a C program, but they say on github that "The package includes Perl 5, Python 2, and Python 3 modules that give access to almost all functions of the C library from within the respective scripting languages" but i was not able to do so

ADD REPLYlink written 5 months ago by ofek.schnitzer20

Not true, many C (or other language programs) have python bindings to enable their use.

Conda also isn’t purely for python anymore.

ADD REPLYlink written 5 months ago by Joe15k
3
gravatar for ofek.schnitzer
5 months ago by
ofek.schnitzer20 wrote:

If anyone else encounters this problem I found a workaround: after downloading and installing the software from https://www.tbi.univie.ac.at/RNA/index.html#pack_windows you will get many EXEs files with the different viennaRNA features. Instead of installing to package you can run these EXEs from your python using: from subprocess import Popen, PIPE p = subprocess.Popen('RNAfold.exe', stdin=PIPE, stdout=PIPE) ans = p.communicate('ATGTTGGGTTCCCCGTGTTGAAAATGTGAAGTAT'.encode())

ADD COMMENTlink written 5 months ago by ofek.schnitzer20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1379 users visited in the last hour