python - ImportError when using rpy2 with numpy.testing -
i've run rather strange error when doing unit testing numpy.testing module. i'm running ipython notebook in vm. in code, have 1 test compare output in r. requires me load rpy2 modules so:
import rpy2.robjects robjects rpy2.robjects.packages import importr fastclime = importr('fastclime') grdevices = importr('grdevices')
however when run ! py.test
, following error:
==================================== errors ====================================
_____________________ error collecting test_fastclime_r.py _____________________ test_fastclime_r.py:6: in <module> import rpy2.robjects robjects ../../anaconda/lib/python2.7/site-packages/rpy2/robjects/__init__.py:15: in <module> import rpy2.rinterface rinterface ../../anaconda/lib/python2.7/site-packages/rpy2/rinterface/__init__.py:101: in <module> rpy2.rinterface._rinterface import * e importerror: /home/bitnami/anaconda/bin/../lib/libreadline.so.6: undefined symbol: pc ====================== 10 passed, 1 error in 0.19 seconds ======================
i suspect has environment variable not being linked working directory, have no idea how fix it. suggestions appreciated! thank you!
the solution
1) delete __pycache__
directory if previous version created
2) install readline in anaconda in command line: conda install -c asmeurer readline
3) inside .py file include import readline
Comments
Post a Comment