Package: rpyc-ikernel
RPyC の IPykernelKernel installationpip install rpyc_ikernelpython -m rpyc_ikernel.installKernel introductionInherit the IPythonKernel (iPython) class, and support low-end hardware (armv7l) for Python programming and real-time image and video streaming with less occupation 16M.Implement remote call (RPC) core throughrpyc, see thisdocs.Set up an RPC service for the remote machine withMaixPy3and transfer the local code to the remote (remote) to run & display images & get results.Special functionsCommand formatCommand functionHow to use$connect("localhost")Connect to the remote IP address (for example: "192.168.44.171:18812")usage_connect.ipynbinstallation methodExplain in the following order:Configure rpyc service for [Remote Python].Install jupyter environment for [Local Python].Configure rpyc service for [Remote Python].Useifconfigoripconfigon your remote device to get your IP address, please make sure that the address can beping.MaixPy3 seriesMake sure that the remote device is configured in thePython3environment, enterpip3 install maixpy3to install therpycservice, copy the following command and run it to start the service.python-c"import maix.mjpg;maix.mjpg.start()"Other environmentalThe following code provides the remote call environment.try:fromrpyc.utils.serverimportThreadedServerfromrpyc.core.serviceimportSlaveServicerpyc_server=ThreadedServer(SlaveService,hostname=HostName,port=RpycPort,reuse_addr=True)rpyc_server.start()exceptOSErrorase:# logging.debug('[%s] OSError: %s' % (__file__, str(e))) # [Errno 98] Address already in useexit(0)At this time your rpyc service has been up.Install jupyter environment for [local Python].Take Python3 as an example, please make sure that the basic environment/commands of python3 and pip3 have been installed, just call the code under the command line.pip3installrpyc_ikernel&&python3-mrpyc_ikernel.installTsinghua source can be used for domestic download acceleration.pip3install-ihttps://pypi.tuna.tsinghua.edu.cn/simplerpyc_ikernel&&python3-mrpyc_ikernel.installAfter the above package is installed, enterjupyter notebookto start the service. After startup, the system default browser will be opened automatically (recommended foreign Google browser or domestic 360 speed browser), please select the kernel of rpyc and create a new (new) designation The code file of the kernel.If you don't see it, you can enterpython3 -m rpyc_ikernel.installto complete the kernel installation, and you can see it now.On Windowsenterpython -m rpyc_ikernel.installto complete the kernel installation.If there are the following common errors that cannot find modules, they are common in py2 and py3 environments. Please confirm whether the system environment variable is python / pip command./usr/bin/python3: Error while finding module specification for'rpyc-ikernel.install' (ModuleNotFoundError: No module named'rpyc-ikernel')/usr/bin/python: No module named rpyc-ikernelFor some machine environment variables, python3 is python, or multiple versions of python and pip coexist, then the python command is required at this time.You can enterjupyter kernelspec listto view the currently installed jupyter kernel. If there is no rpyc, the kernel is not installed.Availablekernels:bash/home/juwan/.local/share/jupyter/kernels/bashmicropython/home/juwan/.local/share/jupyter/kernels/micropythonpython3/home/juwan/.local/share/jupyter/kernels/python3rpyc/home/juwan/.local/share/jupyter/kernels/rpycRun Python code in NotebookBefore running the code, please configure the IP address to connect, otherwise it will connect to the "localhost" address to request the service by default.$connect("192.168.43.44")importplatformprint(platform.uname())It can be seen that the returned results are as follows:uname_result(system='Linux',node='linux-lab',release='5.4.0-56-generic',version='#62-Ubuntu SMP Mon Nov 23 19:20:19 UTC 2020',machine='x86_64',processor='x86_64')common problemYou can troubleshoot problems in the following order:Environmental issuesWhen you find that there is no response after the Python code is executed, you can follow the steps below to troubleshoot the error.Check if the rpyc service of the remote device exists/runs. (Ps -a)If pressing the interrupt button fails to stop while the code is still running, please refresh the code page or restart the kernel and try to execute the code again.Restart the jupyter service and reconnect to the remote device to execute code.If it still does not work, it may be a network problem, so continue to troubleshoot.Internet problemMake sure that the local machine can connect to the remote machine, and use Ping or socket to connect.Determine the network to which the machine belongs, and try to ping the IP address of the slave machine.Determine the network to which the remote end belongs, and try to ping the host IP address.Make sure that the forwarding rules of the upper router do not restrict the service ports 18811, 18812, 18813.other problemsUnplug the network cable or restart the machine, reset the hardware and other reset operations.Design inspirationThe kernel design is taken from the following Python repository.maixpy3ipykernelrpycThe reference kernel is as follows.bash_kernelubit_kernelremote_ikerneljupyter_micropython_kernel