kylebarron / stata_kernel

A Jupyter kernel for Stata. Works with Windows, macOS, and Linux.
https://kylebarron.dev/stata_kernel/
GNU General Public License v3.0
262 stars 55 forks source link

Graph display bug after setting user _graph_keywords? #415

Closed zdlspace0528 closed 2 years ago

zdlspace0528 commented 2 years ago

I use Stata 17.0 MP2 on MacBook Air M1.I have install stata-kernel by

[code] pip install git+https://github.com/mcaceresb/stata_kernel.git@dev-stata17-graph-fix [/code]

I have set [code] user_graph_keywords = coefplot,sepscatter [/code]

but when I run

[code] sysuse auto,clear sepscatter price mpg,sep(foreign) [/code]

it does not display the graph.

Any help will be appreciated.

Best Raymond

mcaceresb commented 2 years ago

@zdlspace0528 This is a known issue and I hadn't gotten around to fixing it mainly because I didn't have access to Stata 17. This has changed recently, so thank you for reminding me of the issue.

There's been a PRs open for it for almost a year in #394; I'm looking it over and it seems fairly straightforward. I'll probably get to testing it out/merging it before weekend. However, feel free to try it in the meantime and see if it helps.

zdlspace0528 commented 2 years ago

@mcaceresb I have tried the PRs in #394.But it seems that setting user_graph_keywords does not work either.

mcaceresb commented 2 years ago

@zdlspace0528 Mmm. I see. Thank you for letting me know. Just to confirm: You tried the PR and no graphs were displayed from the PR branch? Even after running e.g. graph display?

zdlspace0528 commented 2 years ago

@mcaceresb Thank you.I try to run graph dispaly and It displays the graph. This solves my problem. By the way, I hope that it can automatically display the graph, instead of running graph display.

zdlspace0528 commented 2 years ago
image
mcaceresb commented 2 years ago

@zdlspace0528 Yes, it should be automagic; just wanted to check that workaround was still working. I'll be sure to check _graph_keywords works with the PR once I get to it. Thanks!

zdlspace0528 commented 2 years ago

Dear Mauricio, How can I see the variables in jupyter notebook when I run Stata codes? I can only run the codes ,but can not check the variables and data just-in-time.

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/1/2022 05:40,Mauricio Caceres @.***> wrote:

@zdlspace0528 Yes, it should be automagic; just wanted to check that workaround was still working. I'll be sure to check _graph_keywords works with the PR once I get to it. Thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcaceresb commented 2 years ago

@zdlspace0528 Are you looking for %head and %tail magics?

zdlspace0528 commented 2 years ago

I mean that we can see the variables window in jupyter notebook just like Stata’s variables window.

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/2/2022 03:25,Mauricio Caceres @.***> wrote:

@zdlspace0528 Are you looking for %head and %tail magics?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcaceresb commented 2 years ago

@zdlspace0528 AFAIK the kernel doesn't have that functionality. You can always type desc/ds/etc to see the variables in memory.

zdlspace0528 commented 2 years ago

I see.Thank you.

I have another question. I find the Stata command browse is unrecognized.

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/2/2022 03:25,Mauricio Caceres @.***> wrote:

@zdlspace0528 Are you looking for %head and %tail magics?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcaceresb commented 2 years ago

@zdlspace0528 browse is specific to the Stata GUI.

zdlspace0528 commented 2 years ago

Dear Mauricio, I find that you have updated the stata-kernel. How can I update to the lastest version. Can you show me the code to update it?

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/2/2022 03:25,Mauricio Caceres @.***> wrote:

@zdlspace0528 Are you looking for %head and %tail magics?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zdlspace0528 commented 2 years ago

Can I update it by typing "pip install @.***” ?

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/2/2022 03:25,Mauricio Caceres @.***> wrote:

@zdlspace0528 Are you looking for %head and %tail magics?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zdlspace0528 commented 2 years ago

Can I update it by typing "pip install git+https://github.com/mcaceresb/stata_kernel.git@dev-stata17-graph-fix” ?

mcaceresb commented 2 years ago

@zdlspace0528 I think if you uninstall and reinstall from this repo it will work. The changes should be in master (simple upgrade might not do bc I forgot to bump the version, so uninstall and reinstall is the way to go).

zdlspace0528 commented 2 years ago

Does the update solve the problem of graph display binscattter?If I add the binscatter into the user-key-words, can it automatically display the binscatter graph?

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/1/2022 04:58,Mauricio Caceres @.***> wrote:

@zdlspace0528 This is a known issue and I hadn't gotten around to fixing it mainly because I didn't have access to Stata 17. This has changed recently, so thank you for reminding me of the issue.

There's been a PRs open for it for almost a year in #394; I'm looking it over and it seems fairly straightforward. I'll probably get to testing it out/merging it before weekend. However, feel free to try it in the meantime and see if it helps.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zdlspace0528 commented 2 years ago

I wonder if I can update it by typing the codes below?

pip uninstall stata-kernel pip install @.***

Best, Raymond 张德亮

@.*** | 签名由网易邮箱大师定制

On 04/4/2022 12:36,Mauricio Caceres @.***> wrote:

@zdlspace0528 I think if you uninstall and reinstall from this repo it will work. The changes should be in master (simple upgrade might not do bc I forgot to bump the version, so uninstall and reinstall is the way to go).

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcaceresb commented 2 years ago

@zdlspace0528 Your code is censored so I don't know. Probably, but it's hard to say bc parts of your code get replace with asterisks.

zdlspace0528 commented 2 years ago

pip uninstall stata-kernel pip install git+https://github.com/kylebarron/stata_kernel.git@master

Best, Raymond

mcaceresb commented 2 years ago

I think it's stata_kernel; also, I think you need to run python -m stata_kernel.install after, as the docs note.

zdlspace0528 commented 2 years ago

Thanks a lot. Does the update solve the problem of graph display binscattter?If I add the binscatter into the user-key-words, can it automatically display the binscatter graph?

mcaceresb commented 2 years ago

@zdlspace0528 It should, yes.

zdlspace0528 commented 2 years ago

It does not work after I update stata_kernel. After I update it, it can not plot any graph. It runs a long long long time and no results.

张德亮

@.*** | 签名由网易邮箱大师定制

On 04/4/2022 19:51,Mauricio Caceres @.***> wrote:

@zdlspace0528 Kt should

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcaceresb commented 2 years ago

Can you post the relevant code snippet and attach your log file? I can't reproduce this issue.

zdlspace0528 commented 2 years ago
截屏2022-04-04 23 11 52

Firstly, it seems that the I can not use log in jupyter.

Secondly, it is going round and round, but can not get result when I plot the graph.

截屏2022-04-04 23 13 11
mcaceresb commented 2 years ago

@zdlspace0528 I see what you mean; I think I fixed in in #422. Should merge soon.

zdlspace0528 commented 2 years ago

Thanks very much.You solve all my problem.

截屏2022-04-05 03 41 48
zdlspace0528 commented 2 years ago

In the future,If you add Stata variables window in the jupyter , just like python's variables window. It will be more perfect.

zdlspace0528 commented 2 years ago

Dear @mcaceresb , Now there is another problem.When I run xtdidregress ,which is a new official command of Stata 17,it can not display the trendplot graph,even use the graph display.

截屏2022-04-05 05 38 54
mcaceresb commented 2 years ago

@zdlspace0528 Try set more off

zdlspace0528 commented 2 years ago
Yes,I just set more off,and it works well.Thanks. 张德亮

@.*** | 签名由网易邮箱大师定制

On 04/5/2022 05:53,Mauricio Caceres @.***> wrote:

@zdlspace0528 Try set more off

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zdlspace0528 commented 2 years ago

Dear @mcaceresb , I have another problem , I run the synth command,

截屏2022-04-05 09 10 12

I can run the codes successfully in Stata.But should use Rosseta to open Stata. I wonder How can stata-kernel choose Rosseta when run codes in jupyter?

截屏2022-04-05 09 12 59
mcaceresb commented 2 years ago

@zdlspace0528 I don't know what Rosseta is, and I also don't know how you got Stata to use it. One thing you can try is cd into ado/plus/s and see if the kernel still fails.

Btw I was able to install the synth package and run the test code on the kernel without issue, so I am not sure why the plugin would fail to load in your case in the kernel but not on a regular Stata session.

I hope you find a solution; please understand it's hard to provide package-specific help, specially when there are plugins involved and the issue is likely to be platform-specific.