ChatGPT prompt engineering (if your chatbot panel keeps spinning)

Hey there,

Just a quick note so others can avoid a problem I had. If you’re “programming along” with this course note that interactive widgets in panel (the gui library used in the “chatbot” chapter) seem not to work quite right with notebook version 7 beta. The symptom is the busy spinner just keeps on spinning and the panel never updates.

You can work around this by making sure you specify notebook=6.5.4 in your dependencies then things will use the old version of notebook and the chatbot will respond properly. The other way to work around is change the dashboard = line to dashboard = pn.Column(inp, pn.Row(button_conversation), pn.panel(interactive_conversation, height=300), ).servable() (so I’ve added .servable() and then rather than trying to run it in a notebook, run the app in a standalone panel like panel serve mynotebook.ipynb --show --reload. You can then edit the code in a normal editor and the web page will reload with the chatbot in it.


Thank you so much @Huntse - it worked !!! :grinning:

You are most welcome! Glad to hear it worked.

Appreciate this post, as I for sure have this issue with the project in my local environment.

I am not clear what

sure you specify notebook=6.5.4 in your dependencies

means, can you explain what I need to change exactly? (I have been searching and can’t find where to specify this)

Well like lots of things in python it sort of depends how things got installed in the first place. If you installed by doing something like pip install notebook then you could specify a version by doing pip install notebook==6.5.4. Since you already have notebook installed you would probably have to do pip uninstall notebook first, then pip install notebook==6.5.4 to get that version.

If you are installing things using poetry then you would do poetry add 'notebook@^654'.

If you don’t know then you’re probably using pip.

1 Like

Thanks so much for your prompt and helpful response! It solved my problem.

I am using pip and when I installed the tools, I installed jupyter-labs (not notebook). pip informed me that I didn’t have notebook when I tried to uninstall, so pip install notebook==6.5.4 was all I needed and my chatbot is no longer spinning!

You are the king! Thank you.

Very happy to help.

just fyi for anyone who comes later and the advice above doesn’t work:

I had installed notebook==6.5.4 but then jupyter notebook wouldn’t work - tried to start, lots of text and then some error message which I suspect is because I’m running python 3.10 and notebook 6.5.4 doesn’t like it.

I could have tried installing a lower version of python in the virtual environment but on running jupyter-lab from cmdline the notebook server sprang to life and the chatbot panel no longer was spinning.

ps. @Huntse thanks for the initial hints!

Hey there. I have more details in a post below, but it all depends on how you have installed notebook. Most people use pip, in which case, do pip uninstall notebook to remove the version you have, and then pip install notebook=6.5.4 to install the new one. Someone below said the version of jupyter they had didn’t like notebook 6.5.4, so if that’s the case you would pip uninstall notebook jupyter and then pip install notebook=6.5.4 jupyter to reinstall with notebook 6.5.4 and a version of jupyter that was going to play nice. Python dependencies are a bit annoying but that’s the price you pay for having such a rich ecosystem.

1 Like