b3m2a1 / PJLink

JLink but for python: a link between Mathematica and python with efficient data transfer
MIT License
24 stars 8 forks source link

Failed to InstallPython[] in Mathematica 12 : ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory #10

Open algorithmx opened 5 years ago

algorithmx commented 5 years ago

Hi I got InstallPython[] running forever in Mathematica 12. Interception gives me the following message:

"Failed to start python process for python executable python3. Got \ message:\\n\\n\!\(\*InterpretationBox[StyleBox[\"\\\"Traceback (most \ recent call last):\\\\\\\\n File \\\\\\\"start_kernel.py\\\\\\\", \ line 59, in <module>\\\\\\\\n reader = \ create_reader_link(init=init, debug_level=debug, log = log)\\\\\\\\n \ File \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-\ 1.1.2/PJLink/factories.py\\\\\\\", line 26, in create_reader_link\\\\\ \\\\n kernel = create_kernel_link(init = init, debug_level = \ debug_level, log = log)\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/factories.py\\\\\\\", line 21, in create_kernel_link\\\\\\\\n \ link =create_math_link(init = init, debug_level= debug_level, log = \ log)\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/factories.py\\\\\\\", line 16, in create_math_link\\\\\\\\n \ link = NativeLink(init, debug_level)\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/NativeLink.py\\\\\\\", line 37, in __init__\\\\\\\\n \ self._loadNativeLibrary(debug_level=debug_level)\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/NativeLink.py\\\\\\\", line 109, in \ _loadNativeLibrary\\\\\\\\n raise e\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/NativeLink.py\\\\\\\", line 106, in \ _loadNativeLibrary\\\\\\\\n import PJLink.PJLinkNativeLibrary.lib \ as pj\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/PJLinkNativeLibrary/lib.py\\\\\\\", line 15, in <module>\\\\\\\ \\n from PJLinkNativeLibrary import *\\\\\\\\nImportError: \ libpython3.6m.so.1.0: cannot open shared object file: No such file or \ directory\\\\\\\\nException ignored in: <function LinkBase.__del__ at \ 0x7fa0c084d048>\\\\\\\\nTraceback (most recent call last):\\\\\\\\n \ File \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-\ 1.1.2/PJLink/MathLink.py\\\\\\\", line 23, in __del__\\\\\\\\n File \ \\\\\\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.1.2/\ PJLink/NativeLink.py\\\\\\\", line 184, in \ close\\\\\\\\nAttributeError: 'NativeLink' object has no attribute \ '_closed'\\\\\\\\n\\\"\",StripOnInput->False,LineColor->RGBColor[1, \ 0, 0],FrontFaceColor->RGBColor[1, 0, 0],BackFaceColor->RGBColor[1, 0, \ 0],GraphicsColor->RGBColor[1, 0, 0],FontColor->RGBColor[1, 0, \ 0]],PythonTraceback[\"Traceback (most recent call last):\\\ File \\\"start_kernel.py\\\", line 59, in <module>\\\ reader = create_reader_link(init=init, debug_level=debug, log = \ log)\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/factories.py\\\", line 26, in create_reader_link\\\ kernel = create_kernel_link(init = init, debug_level = \ debug_level, log = log)\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/factories.py\\\", line 21, in create_kernel_link\\\ link =create_math_link(init = init, debug_level= debug_level, log \ = log)\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/factories.py\\\", line 16, in create_math_link\\\ link = NativeLink(init, debug_level)\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/NativeLink.py\\\", line 37, in __init__\\\ self._loadNativeLibrary(debug_level=debug_level)\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/NativeLink.py\\\", line 109, in _loadNativeLibrary\\\ raise e\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/NativeLink.py\\\", line 106, in _loadNativeLibrary\\\ import PJLink.PJLinkNativeLibrary.lib as pj\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/PJLinkNativeLibrary/lib.py\\\", line 15, in <module>\\\ from PJLinkNativeLibrary import *\\\ ImportError: libpython3.6m.so.1.0: cannot open shared object file: No \ such file or directory\\\ Exception ignored in: <function LinkBase.__del__ at 0x7fa0c084d048>\\\ Traceback (most recent call last):\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/MathLink.py\\\", line 23, in __del__\\\ File \\\"/home/dabajabaza/.Mathematica/Paclets/Repository/PJLink-1.\ 1.2/PJLink/NativeLink.py\\\", line 184, in close\\\ AttributeError: 'NativeLink' object has no attribute '_closed'\\\ \"]]\)"

Apparently, some routine is searching for "libpython3.6m.so.1.0". I don't have it, but I have "libpython3.7m.so.1.0" instead. I found no way to dictate the InstallPython[] function to use the library.

Following your tutorial https://community.wolfram.com/groups/-/m/t/1468475 I tried to set up the Python part. However, ker = SubprocessKernel() fails with the following message. It seems to be the same reason.

`ImportError Traceback (most recent call last) in ----> 1 ker = SubprocessKernel() 2 def MEval (expr, wait = True, kernel = ker) : 3 kernel.drain() 4 return kernel.evaluate (expr, wait = wait) 5 ker.start()

~/.Mathematica/Paclets/Repository/PJLink-1.1.2/SubprocessKernel/SubprocessKernel.py in init(self, init, debug_level) 15 16 def init(self, init = None, debug_level = 0): ---> 17 super().init(NativeLink(init=init, debug_level=debug_level)) 18 self.py_eval_link = None 19 self.reader = None

~/.Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in init(self, init, debug_level, errMsgOut) 35 self._lock = threading.RLock() 36 self._errMsgOut = [""] if errMsgOut is None else errMsgOut ---> 37 self._loadNativeLibrary(debug_level=debug_level) 38 self._markStack = deque() 39 self._closed = None

~/.Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in _loadNativeLibrary(self, initialize, debug_level, *args) 107 except ImportError as e: 108 self.LIBRARY_LOAD_EXCEPTION = e --> 109 raise e 110 else: 111 self.NATIVE_LIBRARY_LOADED = True

~/.Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in _loadNativeLibrary(self, initialize, debug_level, *args) 104 105 try: --> 106 import PJLink.PJLinkNativeLibrary.lib as pj 107 except ImportError as e: 108 self.__LIBRARY_LOAD_EXCEPTION = e

~/.Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/PJLinkNativeLibrary/lib.py in 13 for file in os.listdir(loc): 14 print(file) ---> 15 from PJLinkNativeLibrary import * 16 finally: 17 sys.path.pop(0)

ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory`

I searched the folder for the PJLink source code. I tried (base) dabajabaza@XXX:~/.Mathematica/Paclets/Repository/PJLink-1.1.2$ grep -rnw . -e 'libpython3.6m.so.1.0' I got the result Binary file ./PJLink/PJLinkNativeLibrary/Linux-x86-64/PJLinkNativeLibrary.so matches Was PJLinkNativeLibrary.so locally generated? If yes, how to control the compiler so that it uses my preferred library "libpython3.7m.so.1.0", instead of "libpython3.6m.so.1.0" ?

algorithmx commented 5 years ago

w/o error message

Hi I got InstallPython[] running forever in Mathematica 12. Interception gives me the following message:

...

Apparently, some routine is searching for "libpython3.6m.so.1.0". I don't have it, but I have "libpython3.7m.so.1.0" instead. I found no way to dictate the InstallPython[] function to use the library.

Following your tutorial https://community.wolfram.com/groups/-/m/t/1468475 I tried to set up the Python part. However, ker = SubprocessKernel() fails with the following message. It seems to be the same reason.

ImportError Traceback (most recent call last) ... ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

I searched the folder for the PJLink source code. I tried (base) dabajabaza@XXX:~/.Mathematica/Paclets/Repository/PJLink-1.1.2$ grep -rnw . -e 'libpython3.6m.so.1.0' I got the result Binary file ./PJLink/PJLinkNativeLibrary/Linux-x86-64/PJLinkNativeLibrary.so matches Was PJLinkNativeLibrary.so locally generated? If yes, how to control the compiler so that it uses my preferred library "libpython3.7m.so.1.0", instead of "libpython3.6m.so.1.0" ?