QUTIP output displayed as image in iPython console within Spyder - ipython

I have been having this issue for a while:
Using iPython console in Spyder 2.3.8, and installed QUTIP 3.1.0,
I tried to run a simple code:
qt.coherent(3,1)
where I was expecting the output to be displayed as an array.
However, doing so in iPython in Spyder it shows an image:
It seems for some reasons it rendered the array as image, and this is awkward to read in most cases, which I prefer to have the array displayed, which actually works if I use the Python3 console in Spyder.
May I know if you have any idea what the cause maybe?
The weird thing is that, this happens only to my Fedora Scientific 23, to the Spyder3 running Python3.4.
Another computer running Windows and WinPython didn't share the same problem, which the array got displayed correctly.
Thanks for your attention.

It seems that the ipython in spyder is calling the latex_repr method rather than just repr. Seems to be a bug somewhere in spyder as the standard ipython terminal has no such error.

The image printing problem appears when I automatically loaded SymPy which is done by: go to spyder Tools>>Prefeneces>>Ipython console>> Advance setting>> check or uncheck symbolic mathematic
When I check the symbolic mathematic, I generally get the result as an image, so I uncheck it and restart spyder, now it works well.
However, if you want to calculate something from symbolic math, it is better to check the "symbolic math" box again. I try to load sympy to ipython but I constantly get a typeerror.

Related

How do I get transformers' .from_pretrained("model") to consistently show download progress in a Jupyter Notebook?

I'm running a Jupyter Lab instance on a remote server which I access through my browser
I'm working with a notebook from a venv kernel that imports the AutoTokenizer and AutoModelForCausalLM classes from transformers, then downloads the elements for each from a model we'll call "model", using each class' .from_pretrained method.
the actual importing and downloading works fine; however, the first time I ran the cells containing AutoTokenizer.from_pretrained("model") and AutoModelForCausalLM.from_pretrained("model"), a text-based download progress bar appeared in the output text. this went through each file download until the kernel crashed (for reasons that I am yet to troubleshoot, but I suspect are related to storage allocations).
when I ran the code again, everything worked the same, but the progress bars never reappeared. the same thing happened a few weeks ago when I tried this the first time with a different model and slightly different environment
What I've tried:
I've tried creating a new kernel from a new venv. I've tried restarting jupyter. neither made a difference
there was a warning that appeared underneath the transformers import that suggested I should install ipywidgets. this was there the first time when the progress bar did appear, and again when it didn't, but somewhere online suggested that ipywidgets and progress bars could be linked, so I imported it to the venv anyway. this unsurprisingly did not help
I've tested whether I get output at all: I do. if I enter 1+1, "2" outputs. I also still got the ipywidgets a warning a few times before I installed it
I made sure that the output is not just being collapsed. View -> Menu -> Collapse/Expand all Outputs does not make anything new appear, besides some ellipses.
I tried doing pip install --upgrade jupyter_client, but it basically said there's nothing further to upgrade.
I tried a browser based on a different engine (chromium instead of ff). I tried with my adblocker on and off
if I download a different model, that does seem to work, once, but then as soon as the kernel crashes a single time trying to download that model, it will never show them again, even when it's clearly actually downloading them

Jupyter notebook auto indentation doesn't work for scala

I have being using jupyter notebook from the anaconda distribution for quite awhile, and I have installed both Python 2 and 3, and R kernels. They all work fine.
Recently, however, after I installed scala kernel, everything works fine except for the auto indentation, i.e. the cursor always sits at the beginning of a line after the enter is hit, and this problem only occurs in scala notebook.
I have tried jupyter-scala and Apache toree. They both have this issue. This issue is troublesome, for example, when you write nested loops as you have to tab the mouse cursor to the right position on every new line.
I have tried the conventional methods such as modifying the custom.js file, and issuing the mirrorcode commands on the browser console to set the indentUnit. It has effect on Python and R notebooks but Scala notebook just won't change.
Highly appreciate your help! I have been bothered by this issue for awhile now. Thank you very much in advance!

Matlab failed to open m file

I am new to matlab and I've installed it successfully. Everything works fine. But when ever I try to open .m files, I always get following error popping out of dialog box:
Error using open(line 162)
Failed to open matlab editor.
And in command window it throws a lot of Java exceptions.
First of all please forgive my poor English.
I've been searching for this problem all over the internet but couldn't find any useful solution.
I'm using windows 8.1 pro 64-bit os.
Your error message indicates that there is an error in a line that justs consists of
<br>
This is not valid matlab code (looks more like html). As such it seems like you have either messed up the open function, or overloaded it somehow.
I think the first thing to do is check which open and see where this points you.
If this does not help, try to look at the matlab path carefully and see whether you accidentally added a (html?) file on it called open.m.
Lastly, you could try to use the built in open function directly, check doc builtin for this. If you succeed at least you are sure it is not a matter of corrupting the standard file.

How to detect if running ipython qtconsole?

The IPython notebook and Qt console both support displaying rich representations of objects. This is done by defining, for example, a _repr_html_ method.
The problem is that these two render the HTML differently. Is there a way for me to detect whether running under ipython qtconsole so that I can use a more basic set of HTML? Preferably a documented way that is not likely to break in the future?
I have a similar problem. Doing color in IPython terminal requires calling in to windows DLL's, but the color in qtconsole seems to support the linux based escape sequences....anyway. here's what I have found. Its ugly...but it will at least tell you terminal vs. qtconsole...Oh, and I haven't tried with the notebook:
import __main__
if hasattr(__main__,"get_ipython"):
import IPython.kernel.zmq.zmqshell as z
if isinstance(get_ipython(), z.ZMQInteractiveShell):
print 'yep...its qtconsole'

IPython auto-completion emacs24 doesn't work

I'm using emacs24.0.92 with IPython 12.
I took ipython.el file from IPython repository and also tried this patch however auto-completion still does not work for me.
Can someone give any hint about it ?
That's an old question but since I was looking for it:
1- python-mode.el
A quick search lead me to this working solution: http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc5
2- jedi
You still can use the completion given by jedi.el:
http://jedi.jedidjah.ch/en/latest/
http://wikemacs.org/index.php/Python#Jedi
http://aliquote.org/memos/2013/02/11/emacs-auto-completion-for-python
Install with packages.el and call M-x jedi:setup. Now the completion fires at the third character. We still can not inspect an object with TAB like in a terminal, but with the 1st solution we can.
edit: false, it's just a matter of configuration: http://tkf.github.io/emacs-jedi/released/#configuration (use jedi:complete-on-dot to complete as soon as we enter a dot).