underworld2 icon indicating copy to clipboard operation
underworld2 copied to clipboard

Autocomplete not working in Jupyter notebooks (Docker)

Open plovely opened this issue 4 years ago • 10 comments

Hi Julian, Romain, et al.,

This may be user error, but I am having trouble with autocompletion when using Jupyter Notebooks in docker. I've tried versions underworldcode/uwgeodynamics:latest and underworldcode/uwgeodynamics:v2.9.5.

Autocompletion works in some cases, but the specific issue I am having is when defining rheologies. I cannot see the rheology names that are available in the library. The readthedocs example shows a drop-down list of options after typing 'rh'. Below is a screenshot in which I added In [12] to Tutorial_1_thermoMechanical_Model.ipynb. After typing 'rh' or 'rh.', tab does nothing. Running a cell with just rh doesn't output meaningful results. How can I see the options available in the rheology library?

Thanks, Peter

image

plovely avatar Feb 19 '21 15:02 plovely

Thanks @plovely for reporting this. I will have a look

rbeucher avatar Feb 21 '21 23:02 rbeucher

I can reproduce the issue. Let's see if I can resolve that.

rbeucher avatar Feb 21 '21 23:02 rbeucher

As a temporary workaround, you can access all the options by doing

dir(rh)

rbeucher avatar Feb 21 '21 23:02 rbeucher

Looks like a ipython / jupyter issue

https://github.com/ipython/ipython/issues/12740

rbeucher avatar Feb 21 '21 23:02 rbeucher

Looks like a ipython / jupyter issue

ipython/ipython#12740

I suppose we could lock down jedi in the docker for now with pip install jedi==0.17.2 https://github.com/ipython/ipython/issues/12740#issuecomment-753614077

julesghub avatar Feb 22 '21 01:02 julesghub

I have tried that, I think there is something else...

rbeucher avatar Feb 22 '21 02:02 rbeucher

@julesghub There seem to be an issue when overriding both getattr and dir in a class. I have asked the ipython people. Could be a security thing as I can see how this could be used to run maleficent code.

rbeucher avatar Feb 22 '21 04:02 rbeucher

Thanks for working on it so quickly! For now, the dir(rh) workaround gets the job done. Cheers!

plovely avatar Feb 22 '21 14:02 plovely

I suspect this is related to ipython / Jupyter and may have security reasons... I'll see if I can find a way around.

rbeucher avatar Feb 22 '21 22:02 rbeucher

It's still a pb... We need to fix that...@julesghub

rbeucher avatar Jan 17 '22 05:01 rbeucher