Spyder 2.7 doesn't recognize gdal bindings on windows 7

604 views
Skip to first unread message

Oliver

unread,
Oct 16, 2014, 6:56:04 AM10/16/14
to spyd...@googlegroups.com
I am using 32-bit Python 2.7 with gdal binaries 1.11 on windows 7. The "import gdal" command works well in the default python console but in the spyder python shell the command gives an import error: DLL load failed: procedure not found. I added all kind of paths to the gdal libs with the PYTHONPATH manager without success.
Can anyone give me a hint?

Adrian Klaver

unread,
Oct 16, 2014, 5:25:00 PM10/16/14
to spyd...@googlegroups.com
On 10/16/2014 03:56 AM, Oliver wrote:
> I am using 32-bit Python 2.7 with gdal binaries 1.11 on windows 7. The
> "*import gda*l" command works well in the default python console but in
> the spyder python shell the command gives an import error: DLL load
> failed: procedure not found. I added all kind of paths to the gdal libs
> with the PYTHONPATH manager without success.
> Can anyone give me a hint?

How did you install Spyder?

Is it part of the same package that installed Python?

What does sys.path show in the default console versus the Spyder console?



--
Adrian Klaver
adrian...@aklaver.com

Taylor

unread,
Oct 27, 2014, 9:25:21 AM10/27/14
to spyd...@googlegroups.com
I am having the same issue. Starting python from the command prompt/IDLE lets me do 'from osgeo import gdal, osr, ogr', but running the same in Spyder results in:
 
"Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found."

I looked at the output of sys.path in both, and the only difference is that 'C:\\Python27\\lib\\site-packages\\spyderlib\\utils\\external' appears immediately after '' in the path listing, and not in the sys.path output from the command prompt. 

I installed Spyder via Python(x,y), and installed GDAL/Python bindings from two .msi files (not from source, second file for the python bindings). Since GDAL works fine from the default prompt I assume it is installed correctly. 

Any ideas?

Adrian Klaver

unread,
Oct 28, 2014, 7:55:36 PM10/28/14
to spyd...@googlegroups.com
On 10/27/2014 06:25 AM, Taylor wrote:
> I am having the same issue. Starting python from the command prompt/IDLE
> lets me do 'from osgeo import gdal, osr, ogr', but running the same in
> Spyder results in:
> "Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 21, in
> <module>
> _gdal = swig_import_helper()
> File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 17, in
> swig_import_helper
> _mod = imp.load_module('_gdal', fp, pathname, description)
> ImportError: DLL load failed: The specified module could not be found."
>
> I looked at the output of sys.path in both, and the only difference is
> that 'C:\\Python27\\lib\\site-packages\\spyderlib\\utils\\external'
> appears immediately after '' in the path listing, and not in the
> sys.path output from the command prompt.
>
> I installed Spyder via Python(x,y), and installed GDAL/Python bindings
> from two .msi files (not from source, second file for the python
> bindings). Since GDAL works fine from the default prompt I assume it is
> installed correctly.
>
> Any ideas?

Install the Python(x,y) GDAL plugin?:

https://code.google.com/p/pythonxy/wiki/StandardPlugins



>
> On Thursday, October 16, 2014 11:25:00 PM UTC+2, Adrian Klaver wrote:
>
> On 10/16/2014 03:56 AM, Oliver wrote:
> > I am using 32-bit Python 2.7 with gdal binaries 1.11 on windows
> 7. The
> > "*import gda*l" command works well in the default python console
> but in
> > the spyder python shell the command gives an import error: DLL load
> > failed: procedure not found. I added all kind of paths to the
> gdal libs
> > with the PYTHONPATH manager without success.
> > Can anyone give me a hint?
>
> How did you install Spyder?
>
> Is it part of the same package that installed Python?
>
> What does sys.path show in the default console versus the Spyder
> console?
>
>
>
> --
> Adrian Klaver
> adrian...@aklaver.com <javascript:>
>
> --
> You received this message because you are subscribed to the Google
> Groups "spyder" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to spyderlib+...@googlegroups.com
> <mailto:spyderlib+...@googlegroups.com>.
> To post to this group, send email to spyd...@googlegroups.com
> <mailto:spyd...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/spyderlib.
> For more options, visit https://groups.google.com/d/optout.


--
Adrian Klaver
adrian...@aklaver.com
Reply all
Reply to author
Forward
0 new messages