Opened 5 years ago
Closed 5 years ago
#231 closed defect (fixed)
Cannot import osgeo, gdal , ogr libraries in Python Console
Reported by: | venka | Owned by: | Jeff McKenna |
---|---|---|---|
Priority: | major | Milestone: | 4.0.2 release |
Component: | MS4W - Python | Version: | 4.0.1 |
Keywords: | Python Console, OSGeo, gdal, ogr | Cc: | |
Blocked By: | Blocking: |
Description
Opened command window and ran setenv.bat, changed to C:\ms4w\Python
and ran python.exe.
Cannot import osgeo, gdal etc in Python Shell.
(See attached image).
Venka
Attachments (1)
Change History (7)
by , 5 years ago
Attachment: | python_console.PNG added |
---|
comment:1 by , 5 years ago
Copying the C:\ms4w\gdalbindings\python\gdal\osgeo directory to
C:\ms4w\Python\Lib\site-packages resolves this issue.
The above step also makes copying C:\ms4w\gdalbindings\python\gdal\osgeo
to C:\ms4w\Apache\cgi-bin (see https://ms4w.com/trac/ticket/223) redundant.
I think the gdal Python bindings (as well as other Python bindings)
could better be stored in the C:\ms4w\Python\Lib\site-packages directory
comment:2 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This issue was fixed through ticket #223 and included in MS4W 4.0.1 release
What version of MS4W are you running? (mapserv -v)
Indeed, your steps in this ticket are indeed redundant, as this was fixed in the recent MS4W 4.0.1 release
Marking ticket as "won't fix". If you can test with MS4W 4.0.1 from now on that would be great.
comment:3 by , 5 years ago
Other notes:
- After you setenv.bat you don't need to change directory, you can execute "python -v" (or any MS4W tool) in that same directory, or any directory (because setenv.bat changes your PATH)
- if you find a problem with a fixed ticket (example issue # 223) you should re-open the ticket and add your comment. (instead of opening a new ticket, and providing feedback on an older version). Sorry.
comment:4 by , 5 years ago
Hello there,
I would like to inform you that I have the same situation as described in #231 ticket.
Even we run the setenv.bat we cannot import gdal from python CMD.
Also I have edited the setenv.bat and tried, what has done is;
added the following line;
C:\ms4w\gdalbindings\python\gdal\osgeo
it also did not work.
So finally osgeo folder has been copied to the site-packages directory from C:\ms4w\gdalbindings\python\gdal\osgeo.
After that we can import gdal from both python cmd and apache cgi-bin.
We don't need a osgeo folder inside cgi-bin ( MS4W 4.0.1 version) when you have a osgeo directory
in site-packages. It solved the both issues.
As per the above report it seems it need to be fixed, otherwise we cannot use python inside the ms4w. Also we have many osgeo directories in several locations.
Best
Niro
comment:5 by , 5 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:6 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks for the feedback. MS4W 4.0.2 is now available (- included in MS4W 4.0.2 release https://ms4w.com/download.html), and the GDAL Python module is moved into /Python/Lib/site-packages/
To test, here are the steps:
open Command window cd C:/ms4w setenv.bat python -c "from osgeo import gdal"
No error message should be displayed.
failed import from osgeo gdal