satoken / centroid-rna-package

Centroid RNA package
GNU General Public License v2.0
19 stars 6 forks source link

ImportError in python binding #1

Closed soh-i closed 3 years ago

soh-i commented 8 years ago

I was trying to install centroid_fold and its python binding, but couldn't work on Mac OSX 10.10.5 with python 2.7.5.

After compiling centroildFold with following cmd args ./configure --with-vienna-rna="/usr/local/Cellar/viennarna/2.1.9" --prefix=$HOME, I then just ran python setup.py build_ext --inplace and run test.py in same directly to build the python binding. But I got those error as follows:

python test.py
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    import CentroidFold
  File "/Users/yukke/dev/centroid-rna-package/python/CentroidFold.py", line 28, in <module>
    _CentroidFold = swig_import_helper()
  File "/Users/yukke/dev/centroid-rna-package/python/CentroidFold.py", line 24, in swig_import_helper
    _mod = imp.load_module('_CentroidFold', fp, pathname, description)
ImportError: dlopen(/Users/yukke/dev/centroid-rna-package/python/_CentroidFold.so, 2): Symbol not found: __ZN12CentroidFold19calculate_posteriorERKSs
  Referenced from: /Users/yukke/dev/centroid-rna-package/python/_CentroidFold.so
  Expected in: dynamic lookup

So I tried nm _CentroidFold.so | grep __ZN12CentroidFold19calculate_posteriorERKSs the got output as follows:

U __ZN12CentroidFold19calculate_posteriorERKSs
U __ZN12CentroidFold19calculate_posteriorERKSsS1_

meaning that __ZN12CentroidFold19calculate_posteriorERKSs is not probably defined.

boost-1.60.0, viennarna v2.1.9 and gcc 4.2.1 were used.

Did you try to compile python binding in Mac? just supports only Linux?

Please let me know if you have any solution or suggestions.

Thanks!

satoken commented 8 years ago

Thank you for using CentroidFold!

I cannot reproduce the same error, but when I use python version 2.7.5, I failed to build the python binding. So, please try to use the latest python. You can easily install the latest python by using pyenv or something like this. I successfully built and tested the binding on python 2.7.11 and el capitan.

Thanks.

soh-i commented 8 years ago

@satoken The python bindings could be successfully compiled with latest version of python and it works. Thanks for trying to reproduce the same stuff!

I have another question. What I actually want to do using CentroidFold with python binding is to compute the base-pairing probability for bunch of RNA sequence (approx. 1,000 to 100,000).

As far as I see the code of python/test.py and calculate_posterior func, there is no way to get the information of base-pairing probability per each base instead of command line version one? The command line one can be printed the bppm file with --oposteriors arg. Or we can access those stuff by digging the internal c++ code?

If too many input sequence will be given as command line args, centroid_fold needs to open the file each time to compute base-pairing prob, it's pretty I/O bound process and time-consuming. That's why I wanna do this by python binding.

satoken commented 8 years ago

Currently, we cannot access base-pairing probability matrices from the python binding. Please use -oposteriors options. I consider implementing such feature on the next version.

Thanks,

soh-i commented 8 years ago

@satoken thanks! I'm waiting for next release!