Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage: misc fixes #51337

Merged
merged 2 commits into from Dec 1, 2018
Merged

sage: misc fixes #51337

merged 2 commits into from Dec 1, 2018

Conversation

timokau
Copy link
Member

@timokau timokau commented Dec 1, 2018

Motivation for this change

Fixes #51326.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@fusion809
Copy link
Contributor

Sadly this didn't fix it for me. After my Sage script has successfully run, I now see absolutely nothing. No plot, no error, nothing at all.

After it is run this is what I see:

screenshot_20181202_055609

@timokau timokau changed the title sagenb: fix matplotlib path sage: misc fixes Dec 1, 2018
@timokau
Copy link
Member Author

timokau commented Dec 1, 2018

This does fix the mathjax issue. I also added a commit to fix a jmol issue I noticed while playing with it (its a shame we can't properly automatically test the interactive things).

The empty display is because we actually build matplotlib without any graphical backend by default. Sage comes with tkinter, so you can explicitly set the backend with plt.switch_backend("tkagg"). We should probably change that.

In the jupyter notebook or the CLI you can select a backend using %matplotlib tk or %matplotlib inline.

@timokau timokau merged commit 88b69a0 into NixOS:master Dec 1, 2018
@timokau timokau deleted the sagenb-matplotlib-fix branch December 1, 2018 21:04
@timokau
Copy link
Member Author

timokau commented Dec 1, 2018

Oops, meant to change the commit message first. I actually fixed the mathjax path, not matplotlib. Anyways, no big deal.

@timokau
Copy link
Member Author

timokau commented Dec 1, 2018

Follow-up: #51344

timokau added a commit to timokau/nixpkgs that referenced this pull request Dec 3, 2018
We currently do not build mathplotlib with any backend. This can be very
confusing for users. They will try to use matplotlib and it will simply
display nothing (see NixOS#51337). We should ship at least one backend. `tk`
was chosen somewhat arbitrarily. The gtk backend is problematic (see
NixOS#50959 (comment))
so tkinter seems like a good choice.

There is already a backend provided on darwin so there is no reason to
include tk there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants