<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Greg,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you for your reply. </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">"</span><span style="letter-spacing: normal; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, "system-ui", Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255); font-weight: 400;">Overall,
 I'd rather see plugins fail with a message and leave installation as a manual decision than have plugins run pip install.</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">"</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I would be fine with asking users to manually install the dependency after installing
 the plugin however, the problem is that QGIS seems to use its own version of Python, rather than the system Python. Opening a terminal and running 'pip install whitebox-workflows' is going to install the package in a place that my QGIS plugin is unable to
 run. And the process for manually pip installing within QGIS does not seem that straight-forward to me (at least on MacOS). This would be a big ask for my potential users. If Whitebox Worfklows were pure Python code, then the simplest solution would be just
 to package that code along with my plugin. However, this isn't the case. WbW is actually a native Rust-based library that I have used PyO3 to base a Python extension on. And so, that native library needs to be compiled for the user's OS and that means pip-based
 installation is the best option. Based on your answer though, I'm wondering if this frontend is even possible given what I have in mind. It's unfortunate if it can't work because the plugin has many hundred very useful tools for geospatial data processing
 that would be great to access from QGIS for users that are perhaps less interested in Python scripting. Anyhow, thanks very much for taking the time to reply.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Regards,</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">John</span></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<p style="margin-top: 0px; margin-bottom: 0px;">Prof. John Lindsay</p>
<p style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif;">
<span style="font-size: 12pt; color: rgb(0, 0, 0);">Dept. of Geography, Environment & Geomatics,</span></p>
<p style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif;">
The University of Guelph,</p>
<p style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif;">
Room 122, Hutt Building,</p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">E-mail: jlindsay@uoguelph.ca</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;">Phone: (519) 824-4120 ext. 56074</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Web: <a href="https://geg.uoguelph.ca/faculty/lindsay-john" style="margin-top: 0px; margin-bottom: 0px;">
https://geg.uoguelph.ca/faculty/lindsay-john</a></p>
<p style="margin-top: 0px; margin-bottom: 0px;">Research page: <a href="https://jblindsay.github.io/ghrg/index.html" title="https://jblindsay.github.io/ghrg/index.html" style="margin-top: 0px; margin-bottom: 0px;">
https://jblindsay.github.io/ghrg/index.html</a></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">WhiteboxTools GIS project:
<a href="https://www.whiteboxgeo.com/" style="margin-top: 0px; margin-bottom: 0px;">
https://www.whiteboxgeo.com/</a></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Twitter:
<a href="https://twitter.com/whiteboxgeo" style="margin-top: 0px; margin-bottom: 0px;">
https://twitter.com/whiteboxgeo</a></span><br>
</p>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> QGIS-Developer <qgis-developer-bounces@lists.osgeo.org> on behalf of Greg Troxel via QGIS-Developer <qgis-developer@lists.osgeo.org><br>
<b>Sent:</b> Friday, January 19, 2024 12:13 PM<br>
<b>To:</b> John Lindsay via QGIS-Developer <qgis-developer@lists.osgeo.org><br>
<b>Subject:</b> Re: [QGIS-Developer] QGIS plugin depends on pypi package</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">CAUTION: This email originated from outside of the University of Guelph. Do not click links or open attachments unless you recognize the sender and know the content is safe. If in doubt, forward suspicious emails to IThelp@uoguelph.ca.<br>
<br>
<br>
John Lindsay via QGIS-Developer <qgis-developer@lists.osgeo.org> writes:<br>
<br>
> Besides, a better solution would be for the plugin to install this<br>
> package via pip when it is itself first installed and launched. I<br>
> tried to accomplish this with the following code:<br>
><br>
> <a href="https://github.com/jblindsay/whitebox_workflows_for_qgis/blob/4e463262f6cfd1987afa2f3f7e0e79656eb8d27e/whitebox_workflows_for_qgis_provider.py#L56">
https://github.com/jblindsay/whitebox_workflows_for_qgis/blob/4e463262f6cfd1987afa2f3f7e0e79656eb8d27e/whitebox_workflows_for_qgis_provider.py#L56</a><br>
><br>
> This code, which runs whenever the plugin is launched, first checks to<br>
> see if whitebox_workflows can be imported and if not, it runs pip from<br>
> the Python script to install it. Unfortunately, some users have<br>
> reported issues with this not working correctly:<br>
<br>
(Writing from the UNIX perspective.) <br>
<br>
Perhaps biased by my packaing background, I view any code that downloads<br>
other code at runtime (without an explicit user request) as a security<br>
bug.   This is especially true if it isn't getting sources pinned to a<br>
version and validated by checksum.<br>
<br>
That said, there's a lot of interesting questions about how to deal with<br>
dependencies of plugins.   For qgis itself, dependencies are properly<br>
dealt with by a packaging system and that seems ok.<br>
<br>
For plugins, I could see treating them as python modules and packaging<br>
them, but qgis wants to have its own package management system.<br>
<br>
qgis is usually installed, via packaging, globally (/usr or /usr/pkg, or<br>
similar).  The immediate question is where plugins go.  I'd expect them<br>
to be in the user's file area vs system, unless installing them in some<br>
administrator role.  The next question is, if they depend on something,<br>
what prefixes and install methods are expected for those things, both<br>
regular packages (programs and shlibs) and python modules.  Which is<br>
partly/mostly about what the search paths are in the plugin execution<br>
environment.<br>
<br>
Overall, I'd rather see plugins fail with a message and leave<br>
installation as a manual decision than have plugins run pip install.<br>
But I get it that most people probably don't see it that way.<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
QGIS-Developer@lists.osgeo.org<br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br>
</div>
</span></font></div>
</body>
</html>