Open MvanderGragt opened 4 years ago
Hi, Michelle.
Which python are you running now? Is that same python as python viennaRNA is installed to?
try to run !which python
on python.
And I reccomend install viennaRNA via bioconda.
Best, Shunsuke
Hi, Michelle, I met the same problem as you, do you find the solution?
Best, Shawn
I'll echo what @Shunsuke-1994 said. It's the ViennaRNA package which provides the RNA
module. You can either install it from bioconda or from source. See here: https://www.tbi.univie.ac.at/RNA/
Hi folks! If you still cannot import RNA
try work-around below using conda
(or mamba
) to install both viennarna
and forgi
which seems to be easiest way to go. Note: In python3.9 on both my linux and macos 10.14 boxes, import RNA
failed with not found
One work-around is to tell conda to installpython=3.6
(or python=3.8
). That is because I think conda installs viennarna 2.4.7 bindings only for 3.6, 3.7 and 3.8. (This is in early 2021, tho RNA may work with 3.9 in future.)
Also please note conda (and/or mamba) can install multiple versions of python in same env, in which case it seems python
is sim-linked to the newest 3.x installed. So to specifically run the 3.6 of 3.8 version of python usepython3.6
or python3.8
instead of just python
. (Or try conda remove python=3.9
to downgrade to earlier 3.x, if it can solve and/or not break your env deps). Hope this helps! --- YMMV
$ conda install mamba -c conda-forge ### optional (ignore if it fails).
$ conda create -n py3forgi python=3.6 ### or try `python=3.8`
$ conda activate py3forgi
(py3forgi)$ conda install mamba -c conda-forge ### optional (try again after activate maybe)
(py3forgi)$ mamba install viennrna forgi -c bioconda ### or if no mamba, use `conda install ...`
(py3forgi)$ python ### or python3.6 or python3.8 (if `python` launches 3.9)
Python 3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:16)
[GCC Clang 11.0.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import RNA
>>> import forgi
>>> (ss, mfe) = RNA.fold("GGACUAGCGGAGGCUAGUCC")
>>> print (ss, mfe)
((((((((....)))))))) -13.600000381469727
Currently (2021-02-28) import RNA
fails for python3.9, but works for python3.6 in my env...
$ conda activate
(base)$ python3.9 ### `import RNA` fails
Python 3.9.1 (default, Feb 3 2021, 07:04:48)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import RNA
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'RNA'
>>> exit()
(base)$ python3.6 ### `import RNA` works in 3.6 without error...
Python 3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:16)
[GCC Clang 11.0.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import RNA
>>> exit()
Below is why I think there are bindings for 2.7, 3.6, 3.7, and 3.8 but not 3.9 (yet):
$ mamba search viennrna # shows pkgs for py27, py36, py37, py38 but NOT 3.9 (yet)
viennarna 2.4.15 py27ha16d4b3_0 bioconda
viennarna 2.4.15 py36hf10c12f_0 bioconda
viennarna 2.4.15 py37h14ce6c4_0 bioconda
viennarna 2.4.15 py38h026d7d4_0 bioconda
viennarna 2.4.17 py27ha16d4b3_0 bioconda
viennarna 2.4.17 py36hf10c12f_0 bioconda
viennarna 2.4.17 py37h14ce6c4_0 bioconda
viennarna 2.4.17 py38h026d7d4_0 bioconda
I'll try to do a pull-request to close this "issue" by adding more clarifying info about import RNA
to the tutorial at https://github.com/ViennaRNA/forgi/blob/master/doc/graph_tutorial.rst
I'm thinking all that is needed is a few lines of suitably generalized howto-info about using conda and finding which python bindings are supported. And maybe a specific example showing how to use conda search viennarna
to see the currently supported python is 3.6, 3.7, or 3.8 but not 3.9.
And while we are tweaking the tutorial, might as well fix any other typos like:
import forgi.utilities.commanline_utils as fuc (typo)
import forgi.utilities.commandline_utils as fuc (corrected)
And fcli
might be a better choice than fuc
(whiskey tango foxtrot) ;-)
Heck yeah, a PR would be greatly appreciated!
Im also using python 3.9 and have installed forgi and vienna rna, but the script above fails for me as well, but with a slightly different error. I was wondering if there was a solution yet???
Traceback (most recent call last):
File "/Users/timshel/Documents/forgi.py", line 2, in
Hi I try to run the forgi tutorial but not seem to be able.
I work on macOS Mojave 10.14.6 and have installed the Vienna package as well as the forgi package. After running the above I get the error:
ModuleNotFoundError: No module named 'RNA'
Any tips on how to handle this?
Kind regards Michelle