> Le 12 juil. 2019 à 22:47, David Bailey <d...@dbailey.co.uk> a écrit :
> 
> On 12/07/2019 14:48, Jean ABOU SAMRA wrote:
> 
> Cough. It's more complicated than I thought at first.
> Thank you! Amazingly, all that worked first time - I certainly would not have 
> stumbled upon that solution on my own! Pip did the job, I did not need to use 
> a variant:
> 
Great! Glad you solved your problem.
> pip --version
> pip 19.1.1 from c:\pythonsystem\lib\site-packages\pip (python 3.7)
> 
That's fine. I said this because on some systems (mostly Unix), `pip` refers to 
pip being used on Python 2 and pip with Python 3 has to be referred to as pip3. 
Many users get confused, so it's always worth a check.
> Tell me, if I want to create an application for others to use, I'd certainly 
> not want everyone to have to go through that procedure. Do I take it that I 
> can put a suitably configured Python directory in a subdirectory of the 
> directory containing the application so that my code will run out of the box 
> (so to speak)?
> 
You can surely do that. You will have to execute Python from the right place. 
But there are some problems, especially the fact that the methods to do that 
vary depending on the client OS. Fortunately, there are some tools around that 
will help you (keep reading).
> Also are there any legal complications to doing that?
> 
There aren't any because Python is free and open source software and the Python 
license explicitly states that you have the right to "to reproduce, analyze, 
test, perform and/or display publicly, prepare derivative works, distribute, 
and otherwise use Python".
> I take it more than one backend can be installed and selected by the 
> matplotlib.use() instruction?
> 
All matplotlib backends ship with matplotlib, they don't have to be "installed" 
but some of them have dependencies that you have to install. To use TkAgg, you 
need Tk, PyQt5 to use Qt5Agg, wxpython to use WXAgg, and so on. Then, you tell 
matplotlib which one you prefer. As 
https://matplotlib.org/faq/usage_faq.html#what-is-a-backend 
<https://matplotlib.org/faq/usage_faq.html#what-is-a-backend> specifies, there 
are several methods to do this. You can set your default backend, and you can 
also tell matplotlib that this script absolutely requires this backend whatever 
the default is throug the matplotlib.use() function.
> OK - I certainly don't want to sound grudging after helping me like that, but 
> I guess this forum is concerned with ways to improve sympy as much as 
> possible, so here goes.
> 
> Can't this all be tidied up a bit - users must hit this problem very often. 
> In fact I thought I did everything in a completely standard way - I 
> downloaded and installed Pyethon3.7, installed sympy and (I remember now) 
> installed matplotlib. Is there any reason why that should not work by default?
> 
It's a bit more complicated than this because Tk is a separate tool but it has 
to be detected at compile time. PyQt5 (a binding for the Qt5 framework) doesn't 
have this issue. Though, I'm quite puzzled because I thought that starting from 
3.7, Python would always include a suitable Tk. I agree that tkinter is 
surprisingly difficult to install -- as https://wiki.python.org/moin/TkInter 
<https://wiki.python.org/moin/TkInter> shows.
> Surely if a suitable backend is not available, the system could detect this 
> and emit a meaningful error message - or better still attempt to download and 
> install the necessary files (rather as Latex does), and then continue?
> 
There is better.
First, you can always specifiy PyQt5 as a dependency to your application in 
addition to SymPy and matplotlib. If your project is installable via pip (ie 
you put it on PyPI) then it's easy to tell what dependencies your app relies on 
and they will be automatically installed with it.
Additionally, 'm not a specialist but you certainly want to use a Python 
virtual environment using the virtualenv module. Your idea of putting a Python 
executable inside your application is quite like this. A virtual environment is 
an Python environment that you can separate from your system. An environment is 
a version of Python, and separate packages each with its version.
This way, you can manage to have PyQt5 installed locally (so any people copying 
the directory will get the right PyQt5 with it) and force the backend to be 
Qt5Agg -- through matplotlib.use() -- so everything runs smoothly.

Kind regards,
Jean Abou Samra.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/6F25DF23-D39A-4C10-AC2E-2787CE500D17%40abou-samra.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to