rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.68k stars 328 forks source link

undefined symbol: mkl_pds_lp64_pardiso_getenv_f when using anaconda python #10

Closed robinsonjj closed 7 years ago

robinsonjj commented 7 years ago

The package installs fine but can't initialize python:

> reticulate:::ensure_python_initialized()
Error in eval(substitute(expr), envir, enclos) : 
  ImportError: /home/joe/anaconda3/lib/python3.6/site-packages/numpy/core/../../../../libmkl_intel_lp64.so: undefined symbol: mkl_pds_lp64_pardiso_getenv_f

Detailed traceback: 
  File "/home/joe/anaconda3/lib/python3.6/site-packages/numpy/__init__.py", line 146, in <module>
    from . import add_newdocs
  File "/home/joe/anaconda3/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/joe/anaconda3/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/joe/anaconda3/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/joe/anaconda3/lib/python3.6/site-packages/numpy/core/__init__.py", line 14, in <module>
    from . import multiarray

All works fine with the stock ubuntu python though, thanks for a very nice package!

jjallaire commented 7 years ago

It looks like there is a missing mkl symbol -- perhaps an older than expected version of MKL on the system? No real way to debug or productively speculate from here as this gets into Anaconda + MKL territory with which I'm entirely unfamiliar. I can tell you that we have successfully tested with Ananconda on Ubuntu.

robinsonjj commented 7 years ago

ok, no worries, as far as I know I have the latest anaconda dist, do you know whether you have tested it against the latest version?:

$ conda list | grep -E "mkl|numpy"
mkl                       2017.0.1                      0  
mkl-rt                    11.1                         p0  
mkl-service               1.1.2                    py36_3  
numpy                     1.11.3                   py36_0  
numpydoc                  0.6.0                    py36_0 

The missing symbol is defined in libmkl_core.so:

$ nm -A /home/joe/anaconda3/lib/libmkl* | grep mkl_pds_lp64_pardiso_getenv_f
/home/joe/anaconda3/lib/libmkl_core.so:0000000000e67d80 T mkl_pds_lp64_pardiso_getenv_f
/home/joe/anaconda3/lib/libmkl_intel_lp64.so:                 U mkl_pds_lp64_pardiso_getenv_f
jjallaire commented 7 years ago

Here's what I get:

$ conda list | grep -E "mkl|numpy"
mkl                       2017.0.1                      0  
numpy                     1.11.3                   py35_0  
$ conda --version
conda 4.2.13
$ ~/anaconda3/bin/python --version
Python 3.5.2 :: Anaconda 4.2.0 (64-bit)
jjallaire commented 7 years ago

After updating I now get output that looks more like yours:

conda list | grep -E "mkl|numpy"
mkl                       2017.0.1                      0  
mkl-service               1.1.2                    py35_3  
numpy                     1.11.3                   py35_0  
numpydoc                  0.6.0                    py35_0  

And things still work.

robinsonjj commented 7 years ago

For completeness:

$ conda --version
conda 4.3.11
python --version
Python 3.6.0 :: Anaconda custom (64-bit)

Not sure what the 'custom' version is all about.. Looks like the main difference is python 3.5 vs 3.6, which I guess means that this is likely a problem local to my machine? Thanks a lot for following this all up, and doesn't seem like there is an obvious fix so I'll just use the stock python for now.

jjallaire commented 7 years ago

I blew away my existing install and re-installed the latest version of Anaconda. Things still work. Here's my Python version info:

$ python --version
Python 3.6.0 :: Anaconda 4.3.0 (64-bit)

So it's something in the "custom" that's doing you in!

I'm going to close this issue. Feel free to re-open if you discover what's going on and think there is something we can do to address this in the package.

robinsonjj commented 7 years ago

I think I've narrowed down the problem - microsoft r open and anaconda don't play nice together, everything works if I use a different R. Sorry, I should have mentioned I was using R open earlier. I'm happy using a non-anaconda python so please don't re-open this issue on my behalf. Cheers.

jjallaire commented 7 years ago

Makes sense since both want to load their own versions of MKL! Glad you figured this out.