codota / tabnine-jupyterlab

JupyterLab client for Tabnine. https://pypi.org/project/jupyterlab-tabnine/
https://www.tabnine.com/install/jupyterlab
36 stars 8 forks source link

FileNotFoundError happen when jupyterhub on k8s #33

Open lordk911 opened 1 year ago

lordk911 commented 1 year ago

[E 2022-12-27 10:35:23.200 SingleUserLabApp web:1789] Uncaught exception POST /user/abc/tabnine?1672137512233 (10.1.178.27) HTTPServerRequest(protocol='http', host='jupyterhub.dg-poc-k8s.com', method='POST', uri='/user/abc/tabnine?1672137512233', version='HTTP/1.1', remote_ip='10.1.178.27') Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/tornado/web.py", line 1702, in _execute result = method(*self.path_args, *self.path_kwargs) File "/opt/conda/lib/python3.10/site-packages/tornado/web.py", line 3173, in wrapper return method(self, args, **kwargs) File "/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/handler.py", line 19, in post response = self.tabnine.request(request) File "/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/tabnine.py", line 107, in request proc = self._get_running_tabnine() File "/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/tabnine.py", line 149, in _get_running_tabnine self._restart() File "/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/tabnine.py", line 127, in _restart path = get_tabnine_path(self._binary_dir) File "/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/tabnine.py", line 224, in get_tabnine_path versions = os.listdir(binary_dir) FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/binaries'

lordk911 commented 1 year ago
ls -l /opt/conda/lib/python3.10/site-packages/jupyterlab_tabnine/
total 20
-rw-r--r-- 1 root users  752 Dec 27 09:56 handler.py
-rw-r--r-- 1 root users  713 Dec 27 09:56 __init__.py
drwxr-sr-x 4 root users   55 Dec 27 09:56 labextension
drwxr-sr-x 2 root users  132 Dec 27 09:56 __pycache__
-rw-r--r-- 1 root users 7577 Dec 27 09:56 tabnine.py
-rw-r--r-- 1 root users  266 Dec 27 09:56 _version.py
lordk911 commented 1 year ago

it's not a bug , conda installed with user root , but tabnine binaries download when normal user use jupyterlab, he/she has no Permission to write to conda env path , I download tabnine binaries manually and it works for me.