stata_kernel icon indicating copy to clipboard operation
stata_kernel copied to clipboard

IFrame plots don't display on Edge on Windows

Open amichuda opened this issue 6 years ago • 25 comments

Hi,

Yet another problem I've run into. On Windows computers, the stata kernel works and makes output for regressions and what have you, but plots don't display. There's only a large amount of whitespace for where the plot should be. Any ideas as to why this might be happening? The console doesn't seem to show a problem, but is there a log file somewhere that I can get you more information?

amichuda avatar Jan 10 '19 02:01 amichuda

Can you give a reproducible example?

kylebarron avatar Jan 10 '19 02:01 kylebarron

The bug report template explains the log file https://github.com/kylebarron/stata_kernel/issues/new?template=bug_report.md

kylebarron avatar Jan 10 '19 02:01 kylebarron

My example would be:

sysuse auto
twoway (scatter mpg weight) (lfit mpg weight)

The first time I installed stata_kernel, running python -m stata_kernel.install as an ordinary user, my example worked fine. After trying to uninstall the individual configuration file and re-running (as admin) python -m stata_kernel.install --sys-prefix, graphs give me the behavior "lordflaron" describes: a large empty space where I expect to see a graph (as if something invisible is embedded there?)

Hemken avatar Jan 10 '19 19:01 Hemken

I just uninstalled and reinstalled stata_kernel and it seems to work for me, even with --sys-prefix. image

I'm not intricately familiar with how --sys-prefix works. Here are a few things you can do to help debug this:

  • What version of Windows and Stata are you running?
  • Can you paste the output of jupyter kernelspec list --json? In order to uninstall a Jupyter kernel like Stata from the Jupyter registry, you have to run jupyter kernelspec uninstall stata. This command will reset the Jupyter settings to the point before you first ran python -m stata_kernel.install.

kylebarron avatar Jan 10 '19 19:01 kylebarron

Let me amend that: in the .stata_kernel_cache I find both a .pdf and an .svg version of my graph, it just isn't rendered in Jupyterlab for some reason. If I rerun the cell, I get new versions of both, so this is not a Stata problem.

When I export as a PDF, I get the full document. When I export as HTML, I get the same blank space. If I look at the HTML source, I find SVG instructions (generated by Stata) for the graph, see attached Stata_kernel tests.zip Stata_kernel tests.zip

Hemken avatar Jan 10 '19 19:01 Hemken

This is on Windows 10, Stata 15.1. I've been using your uninstall instructions as well.

Hemken avatar Jan 10 '19 19:01 Hemken

Ok, cool. Which browser are you using? This might be related to the attempted fix of https://github.com/kylebarron/stata_kernel/issues/234.

kylebarron avatar Jan 10 '19 19:01 kylebarron

Edge

Hemken avatar Jan 10 '19 19:01 Hemken

I just tried it out on Edge on Windows 10 and I can reproduce your issue.

You can read through #234 to see the annoying problem we were trying to solve. Basically, SVG images were interfering with each other, and the way we solved that was by putting each SVG image inside an <iframe> tag. Apparently that works fine on all browsers but IE/Edge. StataCorp acknowledged a bug, but a fix won't come out until the next major or minor release, and who knows when that will be.

Easy solutions:

  • Don't use IE/Edge

  • Set the graph format to PNG instead of SVG. Run %set graph_format png or %set graph_format png --permanently.

    I haven't created any way to use a system-wide configuration file, so there's no way to have this option be the default for multiple users on the system. (i.e. each user would have to run %set graph_format png --permanently themselves).

kylebarron avatar Jan 10 '19 19:01 kylebarron

If I open the saved HTML file in Chrome, everything is good. Also good in Firefox.

I did read through that issue. In the past I have found and reported a number of bugs in Stata's graphs (visible within the Stata IDE).

We'll probably go with the PNG advice, and try the --sys-prefix route again. Can I set this (png) within Stata? My users will be more familiar with Stata than with Python.

Lots of software has both site and personal config options ... just sayin' ! Great kernel though, thanks for putting it together. We'll be using this for teaching, beginning in a couple of weeks.

Hemken avatar Jan 10 '19 19:01 Hemken

We'll probably go with the PNG advice, and try the --sys-prefix route again. Can I set this (png) within Stata? My users will be more familiar with Stata than with Python.

Yes. %set is run inside Stata when using stata_kernel. There are several such commands, called magics that provide extra functionality.

image

Lots of software has both site and personal config options ... just sayin' ! Great kernel though, thanks for putting it together. We'll be using this for teaching, beginning in a couple of weeks.

Yes, I agree, and it's definitely a good feature, but I don't have as much time for new features at the moment. This in particular would probably be pretty easy to implement. Though I'm not sure what the usual system-wide configuration file locations are on Windows.

kylebarron avatar Jan 10 '19 19:01 kylebarron

I added this to the troubleshooting docs page. https://kylebarron.github.io/stata_kernel/using_stata_kernel/troubleshooting/#graphs-wont-display

kylebarron avatar Jan 10 '19 19:01 kylebarron

So many problems with graphics! SVG renders more sharply, but the axis is clipped on the right (both Chrome and Firefox, so this is likely a Stata issue)! At least the PDF is both clear and unclipped. PNG must be specified in the %magic, not in the Stata code.

In case it’s useful: As for site configs, I find kernelspecs in c:\ProgramData\jupyter\kernels (R, for example, when installed for everyone). And also in c:\ProgramData\Anaconda3\share\jupyter\kernels (Python itself, for example).

I also have 4 different kernels that ended up in my personal \AppData\Roaming\jupyter\kernels (Stata, SAS, Julia, and another version of R) (different computer, different OS).

From: Kyle Barron [mailto:[email protected]] Sent: Thursday, January 10, 2019 1:54 PM To: kylebarron/stata_kernel [email protected] Cc: Doug Hemken [email protected]; Comment [email protected] Subject: Re: [kylebarron/stata_kernel] Plots don't display (#283)

I added this to the troubleshooting docs page. https://kylebarron.github.io/stata_kernel/using_stata_kernel/troubleshooting/#graphs-wont-display

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kylebarron/stata_kernel/issues/283#issuecomment-453231400, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALAWE6T6VZYCxOP4ubw6YtFDVe3paDXEks5vB5pegaJpZM4Z4rrs.

Hemken avatar Jan 10 '19 20:01 Hemken

I suppose I should mention that the syntax highlighting hung when I tried to install it, so I’ve just given up on that. I’m not that strongly interested, anyway.

From: Kyle Barron [mailto:[email protected]] Sent: Thursday, January 10, 2019 1:54 PM To: kylebarron/stata_kernel [email protected] Cc: Doug Hemken [email protected]; Comment [email protected] Subject: Re: [kylebarron/stata_kernel] Plots don't display (#283)

I added this to the troubleshooting docs page. https://kylebarron.github.io/stata_kernel/using_stata_kernel/troubleshooting/#graphs-wont-display

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kylebarron/stata_kernel/issues/283#issuecomment-453231400, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALAWE6T6VZYCxOP4ubw6YtFDVe3paDXEks5vB5pegaJpZM4Z4rrs.

Hemken avatar Jan 10 '19 20:01 Hemken

the axis is clipped on the right (both Chrome and Firefox, so this is likely a Stata issue)!

Can you give an example of this?

kylebarron avatar Jan 10 '19 20:01 kylebarron

I suppose I should mention that the syntax highlighting hung when I tried to install it, so I’ve just given up on that. I’m not that strongly interested, anyway.

Can you run ctrl-C and try again? It's worked for me each time I've tried to install.

kylebarron avatar Jan 10 '19 20:01 kylebarron

In the image you produced, the “5,000” on the x axis is clipped. Same for me in both browsers. Consistent with other Stata graphics problems, probably not Jupyter or stata_kernel in my opinion.

From: Kyle Barron [mailto:[email protected]] Sent: Thursday, January 10, 2019 2:23 PM To: kylebarron/stata_kernel [email protected] Cc: Doug Hemken [email protected]; Comment [email protected] Subject: Re: [kylebarron/stata_kernel] Plots don't display (#283)

the axis is clipped on the right (both Chrome and Firefox, so this is likely a Stata issue)!

Can you give an example of this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kylebarron/stata_kernel/issues/283#issuecomment-453240339, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALAWE2-zhiML95Nt_GRCkp9bzi1-Uofeks5vB6E1gaJpZM4Z4rrs.

Hemken avatar Jan 10 '19 20:01 Hemken

I tried it multiple times, on two different computers (windows 10 and windows 7). Still trying to recover the Windows 7 machine, if I can figure out how to uninstall. Never would finish installing (even overnight).

From: Kyle Barron [mailto:[email protected]] Sent: Thursday, January 10, 2019 2:24 PM To: kylebarron/stata_kernel [email protected] Cc: Doug Hemken [email protected]; Comment [email protected] Subject: Re: [kylebarron/stata_kernel] Plots don't display (#283)

I suppose I should mention that the syntax highlighting hung when I tried to install it, so I’ve just given up on that. I’m not that strongly interested, anyway.

Can you run ctrl-C and try again? It's worked for me each time I've tried to install.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kylebarron/stata_kernel/issues/283#issuecomment-453240528, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALAWEwy5iVao2Z5N47Aj0OAZ3c2Zezqrks5vB6FagaJpZM4Z4rrs.

Hemken avatar Jan 10 '19 20:01 Hemken

Ok, I've only tried on Windows 10. You did run the command to install node, right? What was the last thing printed to the console where it stopped?

kylebarron avatar Jan 10 '19 20:01 kylebarron

Yup, ran both

conda install -c conda-forge nodejs -y jupyter labextension install jupyterlab-stata-highlight

and it hung on a message that said it was installing jupyterlab-stata-highlight.tgz or some such. Got through all the preliminaries and hung on the main package.

Hemken avatar Jan 10 '19 20:01 Hemken

Same place on both OS's.

Hemken avatar Jan 10 '19 20:01 Hemken

Are you behind a firewall? I think that means it wasn't able to download it.

kylebarron avatar Jan 10 '19 20:01 kylebarron

I’ll look into that.

Hemken avatar Jan 10 '19 21:01 Hemken

To test, download the library separately (go here and download and extract the files) then run jupyter labextension install ./path/to/unzipped/folder.

kylebarron avatar Jan 10 '19 21:01 kylebarron

Downloaded. I have one test machine each of Windows 10 and Windows 7 running properly without, going to wait until our sysadmin can get that pushed out, then I'll test further. Could be tomorrow, could be next week, but I'll get back to you ... I appreciate having a willing guinea pig, myself.

Hemken avatar Jan 10 '19 21:01 Hemken