dbrgn / heroku-buildpack-python-sklearn

Python buildpack with Numpy 1.7.0, SciPy 0.11.0 and a current version of Scikit-learn.
MIT License
31 stars 28 forks source link

problem getting R/rpy2 to coexist with matplotlib python-sklearn #5

Closed craigschmidt closed 10 years ago

craigschmidt commented 10 years ago

Hi There,

I'm trying to use a multi-buildpack setup with these two buildpacks:

https://github.com/virtualstaticvoid/heroku-buildpack-r.git https://github.com/dbrgn/heroku-buildpack-python-sklearn/

I am using rpy2 to call R from python. I detailed the process i used to get the slug to compile here.

It works fine for numpy and scipy with R and rpy2. However, I'm also trying to get matplotlib to work with this setup, and I'm getting an error.

I used matplotlib==1.1.0, as suggested by this StackOverflow post.

However, when I have my LD_LIBRARY_PATH set so that rpy2 will work, like this

LD_LIBRARY_PATH=/app/vendor/R/lib64/R/modules:/app/vendor/R/lib64/R/lib:/app/vendor/gcc-4.3/lib64

I get this error:

>>> from matplotlib import ft2font
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /app/vendor/R/lib64/R/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /app/.heroku/python/lib/python2.7/site-packages/matplotlib/ft2font.so)

If I remove the LD_LIBRARY_PATH settings, then matplotlib works, but rpy2 can't find the R library located in /app/vendor/R/lib64/R/lib. Changing the order of the directories in LD_LIBRARY_PATH doesn't seem to have an effect, for some reason.

So I can get either matplotlib or rpy2 to work, but not at the same time.

I have libraries in these locations:

~ $ find . -name "*libstd*"   
/app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.so.6.0.10
/app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.so.6
/app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.so
/app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.a
/app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.la
/app/vendor/gcc-4.3/gcc-4.3/lib/libstdc++.so.6.0.10
/app/vendor/gcc-4.3/gcc-4.3/lib/libstdc++.so.6
/app/vendor/gcc-4.3/gcc-4.3/lib/libstdc++.so
/app/vendor/gcc-4.3/gcc-4.3/lib/libstdc++.a
/app/vendor/gcc-4.3/gcc-4.3/lib/libstdc++.la
/app/vendor/R/lib64/R/lib/libstdc++.so.6.0.10
/app/vendor/R/lib64/R/lib/libstdc++.so.6
/app/vendor/R/lib64/R/lib/libstdc++.so
/app/vendor/R/lib64/R/lib/libstdc++.a
/app/vendor/R/lib64/R/lib/libstdc++.la

I suspect that matplotlib should be using /app/vendor/gcc-4.3/gcc-4.3/lib64/libstdc++.so.6, but I can't seem to get it to use that one.

Any suggestions? I'm totally stuck. I must say the multi buildpack process is pretty messed up for this kind of thing.

craigschmidt commented 10 years ago

Hi There,

I figured things out, as described here.

You can just close this. I was very unclear in this case exactly what chunk of code was causing the problem, and it wasn't heroku-buildpack-python-sklearn in the end.

Thanks, Craig

dbrgn commented 10 years ago

Great that you could figure it out :) Heroku is quite a pain for complicated setups.