<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks Luca, </div><div dir="ltr"><br></div><div dir="ltr">That script is actually similar to the script contained in C:\OSGeo4W64\bin\python-qgis.bat which I have been testing. When I open a OSGeo4W Shell and execute that script and type 'import qgis.core' into the python console, it has no issues. When I exit the python console (pressing ctrl-z) and start spyder3 (which I pip installed previously) it have no issues with 'import qgis', but it complains when I 'import qgis.core', giving me the error: </div><div dir="ltr"><br></div><div dir="ltr">ImportError: DLL load failed: The specified procedure could not be found.</div><div dir="ltr"><br></div><div>I read on <a href="https://nathanw.net/2014/05/10/setting-up-pycharm-for-pyqgis-and-qt/">https://nathanw.net/2014/05/10/setting-up-pycharm-for-pyqgis-and-qt/</a> that when you want to get PyCharm working with qgis, you need to change the python interpreter in PyCharm. So I changed the python interpreter in spyder to C:\OSGeo4W64\bin\python3.exe, and restarted the kernel. I now get the following error in spyder's python console:</div><div><br></div><div><div>An error ocurred while starting the kernel</div><div>File "C:\OSGeo4W64\apps\Python36\lib\site.py", line 177</div><div>file=sys.stderr)</div></div><div><br></div><div>If however I execute PyCharm after running the C:\OSGeo4W64\bin\python-qgis.bat script, and setting the PyCharm python interpreter to C:\OSGeo4W64\bin\python3.exe, it works flawlessly. I guess at this stage I will use PyCharm and abandon my efforts with getting things working in Spyder, which will be a pain for me as I really love spyder. Thanks again for your help.</div><div><br></div><div>Cheers.</div><div><br></div><div dir="ltr"><br></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 4 Oct 2018 at 22:50, Nicolas Cadieux <<a href="mailto:nicolas.cadieux@archeotec.ca">nicolas.cadieux@archeotec.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>Hi John,</div><div><br></div><div>If you figure this one out, can you poste the solution?  I would like to do the same thing.</div><div><br></div><div>Thanks</div><div>Nicolas</div><div><br>Le 2 oct. 2018 à 20:51, John Walker <<a href="mailto:jdkwalker21@gmail.com" target="_blank">jdkwalker21@gmail.com</a>> a écrit :<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi, would anyone know how to configure Spyder to work with the QGIS library? I am finding the python editor in QGIS difficult to work with because it has no debugger and I cannot run highlighted code. I have tried a few things:<div><br></div><div>1. created a new conda environment and installed QGIS via conda using: <span class="m_-3952417115033876387gmail-pln">conda install </span><span class="m_-3952417115033876387gmail-pun">-</span><span class="m_-3952417115033876387gmail-pln">c conda</span><span class="m_-3952417115033876387gmail-pun">-</span><span class="m_-3952417115033876387gmail-pln">forge qgis. However I get errors when trying to import qgis.core</span></div><div><span class="m_-3952417115033876387gmail-pln"><br></span></div><div><span class="m_-3952417115033876387gmail-pln">2. installed Spyder within OSGeo4W QGIS python instance i.e.</span></div><div><span class="m_-3952417115033876387gmail-pln"><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"><code><span class="m_-3952417115033876387gmail-pln">py3</span><span class="m_-3952417115033876387gmail-pun">-</span><span class="m_-3952417115033876387gmail-pln">env
python </span><span class="m_-3952417115033876387gmail-pun">-</span><span class="m_-3952417115033876387gmail-pln">m pip install spyder</span></code></pre><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">But this gives errors in the IPython console i.e.</span></pre><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"><code><span class="m_-3952417115033876387gmail-typ">SyntaxError</span><span class="m_-3952417115033876387gmail-pun">:</span><span class="m_-3952417115033876387gmail-pln"> invalid syntax
</span><span class="m_-3952417115033876387gmail-typ">File</span><span class="m_-3952417115033876387gmail-pln"> </span><span class="m_-3952417115033876387gmail-str">"C:\OSGEO4~1\apps\Python36\lib\site.py"</span><span class="m_-3952417115033876387gmail-pun">,</span><span class="m_-3952417115033876387gmail-pln"> line </span><span class="m_-3952417115033876387gmail-lit">177</span><span class="m_-3952417115033876387gmail-pln">
file</span><span class="m_-3952417115033876387gmail-pun">=</span><span class="m_-3952417115033876387gmail-pln">sys</span><span class="m_-3952417115033876387gmail-pun">.</span><span class="m_-3952417115033876387gmail-pln">stderr</span><span class="m_-3952417115033876387gmail-pun">)</span></code></pre><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">Thanks for any help.</span></pre><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"></pre></pre><pre class="m_-3952417115033876387gmail-lang-py m_-3952417115033876387gmail-prettyprint m_-3952417115033876387gmail-prettyprinted"></pre></span></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Qgis-user mailing list</span><br><span><a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a></span><br><span>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span><br><span>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></span></div></blockquote></div></blockquote></div>