<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">An easy way to do so is to add the path to the QGIS python packages in a PYTHONPATH env variable and the packages will be reachable from your virtual env.</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Another (better) to do so would be having QGIS package packaged as pip/setuptools package so that they can be installed in any virtualenv - assuming that qgis libraires are already installed on</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">your platform.</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">This work well on Linux/OSX since QGis can rely on the python installed on your platform. On windows, this can be painful because of the way python interpreter is packaged, but I know very </div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">little about Qgis on Windows) .</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">David.</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">Le 22 déc. 2017 à 11:07, Olivier Dalang <<a href="mailto:olivier.dalang@gmail.com" class="">olivier.dalang@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Hi !<br class=""><br class=""></div>I always have trouble when I need to use QGIS/OSGeo's python environment from outside of QGIS (e.g. setting up an IDE, running some custom scripts that need access to the same libraries than QGIS, etc...). Suggested solutions are to create some batch file, but I never really manage to make this work in a reasonable amount of time.<br class=""></div><div class=""><br class=""></div><div class="">This contrasts very much with my experience with virtualenv (in non QGIS related python work), where switching from one python environment to another is extremely straightforward (<span style="font-family:monospace,monospace" class=""><span style="background-color:rgb(204,204,204)" class="">source path_to_venv/bin/activate</span></span> on linux or <span style="background-color:rgb(204,204,204)" class=""><span style="font-family:monospace,monospace" class="">path_to_venv\Scripts\activate.bat</span></span> on windows). With those commands, everything works : python, pip, all libraries, etc... I think most python IDEs support virtualenvs.<br class=""></div><div class=""><br class=""></div><div class="">I'm not sure if this is possible or not, but would it be possible to have QGIS/OSGeo's python environment configured as a virtual environment ?</div><div class=""><br class=""></div><div class="">Thanks !</div><div class=""><br class=""></div><div class="">Olivier<br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class=""><div class=""><br class=""><br class=""><br class=""><br class=""><div class=""><br class=""></div></div></div></div>
_______________________________________________<br class="">QGIS-Developer mailing list<br class=""><a href="mailto:QGIS-Developer@lists.osgeo.org" class="">QGIS-Developer@lists.osgeo.org</a><br class="">List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer<br class="">Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer</div></blockquote></div><br class=""></body></html>