You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ro...@apache.org on 2018/07/30 23:49:52 UTC

[arrow] branch master updated: ARROW-2940: [Python] Fix OSError when trying to load libcaffe2.so in pytorch 0.3.0

This is an automated email from the ASF dual-hosted git repository.

robertnishihara pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 26affd7  ARROW-2940: [Python] Fix OSError when trying to load libcaffe2.so in pytorch 0.3.0
26affd7 is described below

commit 26affd7b35a1bf3800ab08df3347fe07d220f87d
Author: Philipp Moritz <pc...@gmail.com>
AuthorDate: Mon Jul 30 16:49:43 2018 -0700

    ARROW-2940: [Python] Fix OSError when trying to load libcaffe2.so in pytorch 0.3.0
    
    I also made sure pytorch 0.3 doesn't clash with our threadpool.
    
    Author: Philipp Moritz <pc...@gmail.com>
    
    Closes #2342 from pcmoritz/fix-pytorch-0.3.0 and squashes the following commits:
    
    bc7ebbf <Philipp Moritz> fix pytorch 0.3.0
---
 python/pyarrow/compat.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/compat.py b/python/pyarrow/compat.py
index bbb1bd8..85ad91e 100644
--- a/python/pyarrow/compat.py
+++ b/python/pyarrow/compat.py
@@ -246,7 +246,12 @@ def import_pytorch_extension():
     import os
 
     for path in _iterate_python_module_paths("torch"):
-        ctypes.CDLL(os.path.join(path, "lib/libcaffe2.so"))
+        try:
+            ctypes.CDLL(os.path.join(path, "lib/libcaffe2.so"))
+        except OSError:
+            # lib/libcaffe2.so only exists in pytorch starting from 0.4.0,
+            # in older versions of pytorch there are not symbol clashes
+            pass
 
 
 integer_types = six.integer_types + (np.integer,)