[go: nahoru, domu]

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

interplay with jupyter #16

Closed
flying-sheep opened this issue May 1, 2017 · 7 comments
Closed

interplay with jupyter #16

flying-sheep opened this issue May 1, 2017 · 7 comments

Comments

@flying-sheep
Copy link
Member
%matplotlib inline
import scanpy

when importing scanpy from a jupyter notebook I get this warning, because apparently scanpy calls matplotlib.use(). if at all, it should only do that after checking that no backend is already selected

/home/icb/philipp.angerer/.local/lib/python3.5/site-packages/matplotlib/__init__.py:1401: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

and this, which isn’t actually a Warning, is printed to stdout (why?)

... WARNING: did not find DISPLAY variable needed for interactive plotting
--> try ssh with `-X` or `-Y`
    setting `sett.savefigs = True`

in an interactive notebook or other shell, sett.savefigs shouldn’t be automatically set to True

@falexwolf
Copy link
Member

yes! i will look into that. i just started using something different than emacs and the command line. so, yes, it wasn't very thoughtful to put such settings.

@flying-sheep
Copy link
Member Author

you can’t think of everything! thanks for your work

@falexwolf
Copy link
Member

I removed all this automatic setting of backends etc.

Currently "is_interactive" is only used to choose different progress bars (tqdm behaves very differently on the command line, in jupyter and then, unfortunately again differently in Rodeo) and to decide on whether a total wall time should be output when leaving the session.

It's now left to the user to choose the matplotlib backend. If she/he logs in via ssh without setting an -X tunnel, the default interactive backend will simply fail. But that's left to the user now, no longer output of, which seemed to annoy you (I can understand that)

... WARNING: did not find DISPLAY variable needed for interactive plotting
--> try ssh with `-X` or `-Y`
    setting `sett.savefigs = True`

@flying-sheep
Copy link
Member Author
flying-sheep commented May 2, 2017

here’s code to detect if we’re in a notebook or not.

we could use that to decide if we want to use tqdm_notebook or tqdm

@falexwolf
Copy link
Member
falexwolf commented May 3, 2017

Ah, looks great! Better than what I do right now. matplotlibs is_interactive() is not useful for this.

The solution I have now does the job when comparing jupyter and running a script. But it will fail in the regular Python shell.

@falexwolf
Copy link
Member
falexwolf commented May 3, 2017

Btw: I plan to release version 0.1 later today. Together with benchmarks and many examples for the 10x datasets. Any objections?

@flying-sheep
Copy link
Member Author
flying-sheep commented May 3, 2017

protip: when wanting to link to lines, press the y key to change the url from …/master/… to …/<sha1sum>/…. that way the copied URL will stay valid and not break once the file is modified on the master branch.

no objections to the release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants