Open
Description
My Environment:
Activated MMA 12.0 works correctly on my Ubuntu 16.04 system.
I install WolframClient with following code:
pip install wolframclient -i https://pypi.doubanio.com/simple
Then I execute following codes in python 3.6.10:
from wolframclient.evaluation import WolframLanguageSession
sess = WolframLanguageSession(path)
sess.start()
where, the path I try different values like the result of :
$ which WolframKernel
in my case, it's '/usr/local/bin/WolframKernel' , or the output of
First@$CommandLine
which is
'/usr/local/Wolfram/Mathematica/12.0/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel'
or use this path
'/usr/local/Wolfram/Mathematica/12.0/Executables/WolframKernel' which is default path of WolframLanguageSession().
Then errors are vary when I choose different paths, but can be concluded into 2 types.
- When path = '/usr/local/Wolfram/Mathematica/12.0/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel' , it immediately returns following errors info:
Socket exception: Socket operation aborted.
Failed to start.
---------------------------------------------------------------------------
SocketAborted Traceback (most recent call last)
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _kernel_start(self)
436 timeout=self.get_parameter("STARTUP_TIMEOUT"),
--> 437 abort_event=_StartEvent(self.kernel_proc, self.trigger_termination_requested),
438 )
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/zmqsocket.py in recv_abortable(socket, timeout, abort_check_period, abort_event, **kwargs)
49 if abort_event.is_set():
---> 50 raise SocketAborted("Socket operation aborted.")
51 if timeout and (time.perf_counter() - start > timeout):
SocketAborted: Socket operation aborted.
During handling of the above exception, another exception occurred:
WolframKernelException Traceback (most recent call last)
<ipython-input-4-84c234a8332d> in <module>
----> 1 sess.start()
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/localsession.py in start(self, block, timeout)
155 self.terminate()
156 finally:
--> 157 raise e
158
159 def start_future(self):
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/localsession.py in start(self, block, timeout)
150 future = self.start_future()
151 if future and block:
--> 152 future.result(timeout=timeout)
153 except Exception as e:
154 try:
~/anaconda3/envs/detectron2/lib/python3.6/concurrent/futures/_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
~/anaconda3/envs/detectron2/lib/python3.6/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in run(self)
525 # Kernel start requested.
526 if payload is self.START:
--> 527 self._safe_kernel_start()
528 future.set_result(True)
529 future = None
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _safe_kernel_start(self)
364 self._kernel_terminate()
365 finally:
--> 366 raise e
367
368 _KERNEL_OK = b"OK"
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _safe_kernel_start(self)
358 """ Start a kernel. If something went wrong, clean-up resources that may have been created. """
359 try:
--> 360 self._kernel_start()
361 except Exception as e:
362 logger.warning("Failed to start.")
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _kernel_start(self)
454 logger.warning("Socket exception: %s", se)
455 raise WolframKernelException(
--> 456 "Failed to communicate with kernel: %s." % self.kernel
457 )
458
WolframKernelException: Failed to communicate with kernel: [path].
- When path != '/usr/local/Wolfram/Mathematica/12.0/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel', it will wait for several seconds and return following errors:
Socket exception: Failed to read any message from socket tcp://127.0.0.1:39963 after 20.1 seconds and 200 retries.
Failed to start.
---------------------------------------------------------------------------
SocketOperationTimeout Traceback (most recent call last)
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _kernel_start(self)
436 timeout=self.get_parameter("STARTUP_TIMEOUT"),
--> 437 abort_event=_StartEvent(self.kernel_proc, self.trigger_termination_requested),
438 )
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/zmqsocket.py in recv_abortable(socket, timeout, abort_check_period, abort_event, **kwargs)
54 "Failed to read any message from socket %s after %.1f seconds and %i retries."
---> 55 % (socket.uri, time.perf_counter() - start, retry)
56 )
SocketOperationTimeout: Failed to read any message from socket tcp://127.0.0.1:39963 after 20.1 seconds and 200 retries.
During handling of the above exception, another exception occurred:
WolframKernelException Traceback (most recent call last)
<ipython-input-3-84c234a8332d> in <module>
----> 1 sess.start()
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/localsession.py in start(self, block, timeout)
155 self.terminate()
156 finally:
--> 157 raise e
158
159 def start_future(self):
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/localsession.py in start(self, block, timeout)
150 future = self.start_future()
151 if future and block:
--> 152 future.result(timeout=timeout)
153 except Exception as e:
154 try:
~/anaconda3/envs/detectron2/lib/python3.6/concurrent/futures/_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
~/anaconda3/envs/detectron2/lib/python3.6/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in run(self)
525 # Kernel start requested.
526 if payload is self.START:
--> 527 self._safe_kernel_start()
528 future.set_result(True)
529 future = None
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _safe_kernel_start(self)
364 self._kernel_terminate()
365 finally:
--> 366 raise e
367
368 _KERNEL_OK = b"OK"
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _safe_kernel_start(self)
358 """ Start a kernel. If something went wrong, clean-up resources that may have been created. """
359 try:
--> 360 self._kernel_start()
361 except Exception as e:
362 logger.warning("Failed to start.")
~/anaconda3/envs/detectron2/lib/python3.6/site-packages/wolframclient/evaluation/kernel/kernelcontroller.py in _kernel_start(self)
454 logger.warning("Socket exception: %s", se)
455 raise WolframKernelException(
--> 456 "Failed to communicate with kernel: %s." % self.kernel
457 )
458
WolframKernelException: Failed to communicate with kernel: [path]
Metadata
Metadata
Assignees
Labels
No labels