robert-dodier / maxima-jupyter

A Maxima kernel for Jupyter, based on CL-Jupyter (Common Lisp kernel)
Other
185 stars 31 forks source link

Error Message ext.toLowerCase() No Such Function #85

Closed doswellf closed 3 years ago

doswellf commented 3 years ago

After a ubuntu update including an update-all for python3, maxima-jupyter notebooks are not loading. When loading a maxima-jupyter notebook I get Error: ext.toLowerCase() No Such Function. The contents of the notebook are not loaded. When I hit Ok the kernel is running and stable, but no content.

The jupyter kernel spec software has been updated - they require a path and a version number now.

There are no instances of ext.toLowerCase() in any of the notebooks. Looks like generated code is getting mangled.

Will hunt down the urls of the various posts and update this issue.

Am still wondering if it's something I did. After the update caused the failures, did a pip upgrade of jupyter and nbformat as someone suggested. This made no difference to either the python3 notebooks working or maxima notebooks not working,

Tried forcing re-install of jupyter and nbformat, but they depend on some ubuntu-installed pip packages that can't be removed.

For now I can use python3 from my 2 alternate created accounts. One for anaconda3 and one for python 3.9 installed from source in /usr/local to get away from the netherworld of half-pip half-apt installed packages. Docker Hub is another good option for isolating python environments from unwanted changes, which I use for software stacks that are hard to build.

Robert can you update a python3 stack to the latest jupyter and nbformat in a test scenario and see if that maxima-jupyter fails as well? That would tell us whether it's a python3 problem or a ubuntu-caused issue. The latter seems more likely, but don't want others to have their maxima-jupyter fail because of api changes.

If not, then the problem is with Ubuntu packages. That is a common problem for ubuntu users. There are ways to stop the update of packages, but I just installed this Ubuntu and didn't turn off auto-updates for python3.

Fraser

robert-dodier commented 3 years ago

Hi Fraser, a web search suggests that others have bumped into the ext.toLowerCase error also so that suggests to me that the problem is in Jupyter or something loaded by Jupyter. Can you see if anything is known in the Jupyter world about fixing that? It seems like if it affects more than a few people there should be a bug fix figured out in some way.

doswellf commented 3 years ago

Apparently the method call is ext.toLowerCase() not text.toLowerCase(). It applies to the file extension, not a general text function. Going to sign up with the jupyter developers list and see what they think.

doswellf commented 3 years ago

Getting no quick responses from the mailing lists.Have posted on 3 of the jupyter-related mailing lists already. Ready to this myself and fire up the python debuggers and log analyzers.

Have found the git repos for jupyter and sphinx. Will grep through the source for various kernels. Cannot find that method in the installed jupyter. Grepped through my ~/local/share directory and the python3 /usr/share/python3 and /usr/lib/python3 for ext.toLowerCase() . Still a few places to hunt for that method, including the main python docs.

Also realized I can create a virtualenv in the current python that inherits no packages from the system-level package installations. Then install the same versions with pip, which should give me a synchronized set of packages.

doswellf commented 3 years ago

Apparently Javascript also has a string.toLowerCase() method. This matches the name in the message perfectly. The code is trying to change to lowercase (ext) an object that is not a string. Whatever is to be changed of course needs ext.toString().toLowerCase The python equivalent is ext.tolower().

Will dig around for the javascript components of jupyter and your kernel package source.

doswellf commented 3 years ago

The firefox web console has revealed some details about the javascript libraries used and 2 stack traces from different javascript files.

Have cloned source for Jupyter notebook which contains notebook.js which is where the errors show in the console stack trace. Two stack traces show up - both pointing to notebook.js. Will search in my cloned source tree so I don't disturb the system-level installation (yet).

Also looks like my user-level packages are not dependent on apt-get in any way.

doswellf commented 3 years ago

YAY! WE CAN BLAME UBUNTU! Installed all synced and updated python packages in: /home/fraser/.local/lib/python3.8/site-packages

Changed my PYTHONPATH in my ~/.bashrc to: export PYTHONPATH='/home/fraser/.local/lib/python3.8/site-packages':$PYTHONPATH

Ran the jupyter from: /home/fraser/.local/bin/jupyter

The maxima-jupyter notebooks

Your demo and talk notebooks did not appear to have any content but no error message. I have created a few short demo files to test during the debug process and attached them here

During the debug process I started homing in on the notebook.js file readJSON() needs a string on the language or locale meta data. This doesn't happen with a synchronized and updated set of packages.

We should recommend using Anaconda3 or only user-local package installations for maxima-jupyter on ubuntu or pinning python versions in apt-get to stop any automatic updates. Looks like I should completely remove all jupyter-related packages from the system python3 and re-install at some point. Now that maxima-jupyter is back its time to get back to the original tasks for now. more-maxima-jupypter-examples.zip

doswellf commented 3 years ago

Done For Now - Back To Maxima!

robert-dodier commented 3 years ago

Hi Fraser, I'm glad to hear you got it sorted out! Yeah, I try to avoid updating packages for the most part unless it's something I know I need ... too much inconvenience and confusion around that! Anyway sounds like you're rolling again.