Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError on startup when using the extension in JupyterHub #168

Closed
mschroering opened this issue May 12, 2023 · 1 comment · Fixed by #178
Closed

RecursionError on startup when using the extension in JupyterHub #168

mschroering opened this issue May 12, 2023 · 1 comment · Fixed by #178
Labels
bug Something isn't working

Comments

@mschroering
Copy link
Contributor

mschroering commented May 12, 2023

Description

RecursionError on startup when using the extension in JupyterHub

Reproduce

  1. Installed latest jupyter_ai and openai packages in Jupyterlab notebook server image.
  2. Started a new notebook server using the image in a JupyterHub deployment running in Kubernetes.
  3. On page load, the chat window says an error occurred.

image

Running the Jupyterlab docker image locally in standalone mode works.

Expected behavior

The jupyter_ai extension loads and works properly in JupyterHub deployments.

Context

  • Operating System and version: Debian GNU/Linux 11 (bullseye)
  • Browser and version: Chrome 112
  • JupyterLab version: 3.6.3
  • jupyter_ai version: 0.7.1
  • Jupyter core packages:
    IPython : 8.12.0
    ipykernel : 6.22.0
    ipywidgets : 8.0.6
    jupyter_client : 8.2.0
    jupyter_core : 5.3.0
    jupyter_server : 2.5.0
    jupyterlab : 3.6.3
    nbclient : 0.7.3
    nbconvert : 7.3.1
    nbformat : 5.8.0
    notebook : 6.5.4
    qtconsole : 5.4.2
    traitlets : 5.9.0
Command Line Output - Taken from notebook server running in JupyterHub
[E 2023-05-12 09:46:57.278 SingleUserLabApp web:1854] Uncaught exception GET /user/mark.schroering/api/ai/chats?token=*********** (::ffff:10.1.6.237)                                                         │
     HTTPServerRequest(protocol='http', host='jupyterhub.**********.net', method='GET', uri='/user/mark.schroering/api/ai/chats?token=*********', version='HTTP/1.1', remote_ip='::ffff:10.1.6.237')           │
     Traceback (most recent call last):                                                                                                                                                                                           
       File "/opt/venv/lib/python3.10/site-packages/tornado/web.py", line 1748, in _execute                                                                                                                              
        result = await result  # type: ignore                                                                                                                                                                                    
       File "/opt/venv/lib/python3.10/site-packages/jupyter_server/base/handlers.py", line 605, in prepare                                                                                                               
         _user = self.identity_provider.get_user(self)                                                                                                                                                                            
      File "/opt/venv/lib/python3.10/site-packages/jupyter_server/auth/identity.py", line 705, in get_user                                                                                                              
         user = self.login_handler_class.get_user(handler)                                                                                                                                                                        
       File "/opt/venv/lib/python3.10/site-packages/jupyterhub/singleuser/mixins.py", line 129, in get_user                                                                                                              
         return handler.get_current_user()                                                                                                                                                                                        
       File "/opt/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 175, in get_current_user                                                                                                               
         username=self.current_user.username,                                                                                                                                                                                     
       ....
       File "/opt/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 175, in get_current_user                                                                                                               
        username=self.current_user.username,                                                                                                                                                                                           
       File "/opt/venv/lib/python3.10/site-packages/tornado/web.py", line 1403, in current_user                                                                                                                          
         self._current_user = self.get_current_user()                                                                                                                                                                             
       File "/opt/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 175, in get_current_user                                                                                                               
         username=self.current_user.username,                                                                                                                                                                                     
       File "/opt/venv/lib/python3.10/site-packages/tornado/web.py", line 1403, in current_user                                                                                                                          
         self._current_user = self.get_current_user()                                                                                                                                                                             
       File "/opt/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 175, in get_current_user                                                                                                               
         username=self.current_user.username,                                                                                                                                                                                     
       File "/opt/venv/lib/python3.10/site-packages/tornado/web.py", line 1403, in current_user                                                                                                                          
         self._current_user = self.get_current_user()                                                                                                                                                                             
       File "/opt/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 173, in get_current_user                                                                                                               
         login = getpass.getuser()                                                                                                                                                                                                
       File "/usr/local/lib/python3.10/getpass.py", line 163, in getuser                                                                                                                                                          
         user = os.environ.get(name)                                                                                                                                                                                              
       File "/usr/local/lib/python3.10/_collections_abc.py", line 824, in get                                                                                                                                                     
         return self[key]                                                                                                                                                                                                         
       File "/usr/local/lib/python3.10/os.py", line 677, in __getitem__                                                                                                                                                           
         value = self._data[self.encodekey(key)]                                                                                                                                                                                  
       File "/usr/local/lib/python3.10/os.py", line 756, in encode                                                                                                                                                                
         if not isinstance(value, str):                                                                                                                                                                                           
    RecursionError: maximum recursion depth exceeded while calling a Python object
@mschroering mschroering added the bug Something isn't working label May 12, 2023
@welcome
Copy link

welcome bot commented May 12, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant