[Qgis-user] How to get Spyder IDE working with QGIS

John Walker jdkwalker21 at gmail.com
Thu Oct 18 19:01:51 PDT 2018


Actually, I take that back. It doesn't seem to work in PyCharm after
further testing. I get the following error:

ImportError: DLL load failed: The specified procedure could not be found.

Not sure what to do now.

On Thu, 18 Oct 2018 at 15:43, John Walker <jdkwalker21 at gmail.com> wrote:

> Thanks Luca,
>
> 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:
>
> ImportError: DLL load failed: The specified procedure could not be found.
>
> I read on
> https://nathanw.net/2014/05/10/setting-up-pycharm-for-pyqgis-and-qt/ 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:
>
> An error ocurred while starting the kernel
> File "C:\OSGeo4W64\apps\Python36\lib\site.py", line 177
> file=sys.stderr)
>
> 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.
>
> Cheers.
>
>
>
> On Thu, 4 Oct 2018 at 22:50, Nicolas Cadieux <nicolas.cadieux at archeotec.ca>
> wrote:
>
>> Hi John,
>>
>> If you figure this one out, can you poste the solution?  I would like to
>> do the same thing.
>>
>> Thanks
>> Nicolas
>>
>> Le 2 oct. 2018 à 20:51, John Walker <jdkwalker21 at gmail.com> a écrit :
>>
>> 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:
>>
>> 1. created a new conda environment and installed QGIS via conda using: conda
>> install -c conda-forge qgis. However I get errors when trying to import
>> qgis.core
>>
>> 2. installed Spyder within OSGeo4W QGIS python instance i.e.
>>
>> py3-env
>> python -m pip install spyder
>>
>> But this gives errors in the IPython console i.e.
>>
>> SyntaxError: invalid syntaxFile "C:\OSGEO4~1\apps\Python36\lib\site.py", line 177
>> file=sys.stderr)
>>
>> Thanks for any help.
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20181019/1f659058/attachment-0001.html>


More information about the Qgis-user mailing list