{"id":15015218,"url":"https://github.com/sipeed/rpyc_ikernel","last_synced_at":"2025-04-09T19:24:18.727Z","repository":{"id":45172672,"uuid":"321359273","full_name":"sipeed/rpyc_ikernel","owner":"sipeed","description":"more lightweight remote calling Python on jupyter.","archived":false,"fork":false,"pushed_at":"2022-12-02T07:19:31.000Z","size":6027,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T21:12:24.436Z","etag":null,"topics":["ipykernel","ipython","jupyter","python","python3","rpc","rpyc"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sipeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-14T13:40:08.000Z","updated_at":"2024-01-04T19:10:41.000Z","dependencies_parsed_at":"2023-01-23T22:02:13.214Z","dependency_job_id":null,"html_url":"https://github.com/sipeed/rpyc_ikernel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sipeed%2Frpyc_ikernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sipeed%2Frpyc_ikernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sipeed%2Frpyc_ikernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sipeed%2Frpyc_ikernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sipeed","download_url":"https://codeload.github.com/sipeed/rpyc_ikernel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248096343,"owners_count":21047036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ipykernel","ipython","jupyter","python","python3","rpc","rpyc"],"created_at":"2024-09-24T19:46:38.087Z","updated_at":"2025-04-09T19:24:18.701Z","avatar_url":"https://github.com/sipeed.png","language":"Jupyter Notebook","readme":"\n\u003cp align=\"center\"\u003e\n    \u003ch1 align=\"center\"\u003e RPyC の IPykernel \u003c/h1\u003e\n\u003c/p\u003e\n\n[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![PyPI version](https://badge.fury.io/py/rpyc-ikernel.svg)](https://badge.fury.io/py/rpyc-ikernel)\n\n[中文文档](README_cn.md)\n\n## Kernel installation\n\n- pip install rpyc_ikernel\n- python -m rpyc_ikernel.install\n\n![index.png](./tests/images/index.png)\n\n## Kernel introduction\n\nInherit the IPythonKernel (iPython) class, and support low-end hardware (armv7l) for Python programming and real-time image and video streaming with less occupation 16M.\n\n- Implement remote call (RPC) core through [rpyc](https://github.com/tomerfiliba-org/rpyc), see this [docs](http://rpyc.readthedocs.org/).\n\n- Set up an RPC service for the remote machine with [MaixPy3](https://github.com/sipeed/MaixPy3) and transfer the local code to the remote (remote) to run \u0026 display images \u0026 get results.\n\n### Special functions\n\n| Command format | Command function | How to use |\n| ---- | ---- | ---- |\n| $connect(\"localhost\") | Connect to the remote IP address (for example: \"192.168.44.171:18812\") | [usage_connect.ipynb](./tests/usage_connect.ipynb) |\n\n## installation method\n\nExplain in the following order:\n\n- Configure rpyc service for [Remote Python].\n- Install jupyter environment for [Local Python].\n\n## Configure rpyc service for [Remote Python].\n\nUse **ifconfig** or **ipconfig** on your remote device to get your IP address, please make sure that the address can be **ping**.\n\n### MaixPy3 series\n\nMake sure that the remote device is configured in the **Python3** environment, enter `pip3 install maixpy3` to install the **rpyc** service, copy the following command and run it to start the service.\n\n```shell\npython -c \"import maix.mjpg;maix.mjpg.start()\"\n```\n\n### Other environmental\n\nThe following code provides the remote call environment.\n\n```python\ntry:\n  from rpyc.utils.server import ThreadedServer\n  from rpyc.core.service import SlaveService\n  rpyc_server = ThreadedServer(\n      SlaveService, hostname=HostName, port=RpycPort, reuse_addr=True)\n  rpyc_server.start()\nexcept OSError as e:\n  # logging.debug('[%s] OSError: %s' % (__file__, str(e))) # [Errno 98] Address already in use\n  exit(0)\n```\n\nAt this time your rpyc service has been up.\n\n## Install jupyter environment for [local Python].\n\nTake 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.\n\n```shell\npip3 install rpyc_ikernel \u0026\u0026 python3 -m rpyc_ikernel.install\n```\n\nTsinghua source can be used for domestic download acceleration.\n\n```shell\npip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple rpyc_ikernel \u0026\u0026 python3 -m rpyc_ikernel.install\n```\n\nAfter the above package is installed, enter `jupyter notebook` to 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.\n\n![kernels.png](./tests/images/kernels.png)\n\nIf you don't see it, you can enter `python3 -m rpyc_ikernel.install` to complete the kernel installation, and you can see it now.\n\n### On Windows\n\nenter `python -m rpyc_ikernel.install` to complete the kernel installation.\n\nIf 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.\n\n- `/usr/bin/python3: Error while finding module specification for'rpyc-ikernel.install' (ModuleNotFoundError: No module named'rpyc-ikernel')`\n- `/usr/bin/python: No module named rpyc-ikernel`\n\n\u003e For some machine environment variables, python3 is python, or multiple versions of python and pip coexist, then the python command is required at this time.\n\nYou can enter `jupyter kernelspec list` to view the currently installed jupyter kernel. If there is no rpyc, the kernel is not installed.\n\n```shell\nAvailable kernels:\n  bash /home/juwan/.local/share/jupyter/kernels/bash\n  micropython /home/juwan/.local/share/jupyter/kernels/micropython\n  python3 /home/juwan/.local/share/jupyter/kernels/python3\n  rpyc /home/juwan/.local/share/jupyter/kernels/rpyc\n```\n\n## Run Python code in Notebook\n\nBefore running the code, please configure the IP address to connect, otherwise it will connect to the \"localhost\" address to request the service by default.\n\n```python\n$connect(\"192.168.43.44\")\nimport platform\nprint(platform.uname())\n```\n\nIt can be seen that the returned results are as follows:\n\n```shell\nuname_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')\n```\n\n## common problem\n\nYou can troubleshoot problems in the following order:\n\n### Environmental issues\n\nWhen you find that there is no response after the Python code is executed, you can follow the steps below to troubleshoot the error.\n\n- Check if the rpyc service of the remote device exists/runs. (Ps -a)\n- 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.\n- Restart the jupyter service and reconnect to the remote device to execute code.\n\nIf it still does not work, it may be a network problem, so continue to troubleshoot.\n\n### Internet problem\n\nMake sure that the local machine can connect to the remote machine, and use Ping or socket to connect.\n\n- Determine the network to which the machine belongs, and try to ping the IP address of the slave machine.\n- Determine the network to which the remote end belongs, and try to ping the host IP address.\n- Make sure that the forwarding rules of the upper router do not restrict the service ports 18811, 18812, 18813.\n\n### other problems\n\nUnplug the network cable or restart the machine, reset the hardware and other reset operations.\n\n## Design inspiration\n\nThe kernel design is taken from the following Python repository.\n\n- [maixpy3](https://github.com/sipeed/maixpy3)\n- [ipykernel](https://github.com/ipython/ipykernel)\n- [rpyc](https://github.com/tomerfiliba-org/rpyc)\n\nThe reference kernel is as follows.\n\n- [bash_kernel](https://github.com/takluyver/bash_kernel)\n- [ubit_kernel](https://github.com/takluyver/ubit_kernel)\n- [remote_ikernel](https://github.com/tdaff/remote_ikernel)\n- [jupyter_micropython_kernel](https://github.com/goatchurchprime/jupyter_micropython_kernel)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsipeed%2Frpyc_ikernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsipeed%2Frpyc_ikernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsipeed%2Frpyc_ikernel/lists"}