osm-export-tool-python icon indicating copy to clipboard operation
osm-export-tool-python copied to clipboard

Windows support

Open bdon opened this issue 6 years ago • 1 comments

Should work by making setup.py not depend on gdal_config, but more may be necessary. Best approach may still be to replace the gdal python library with Fiona instead

bdon avatar Oct 10 '19 00:10 bdon

Sharing what I've ran into here as well:

On Windows based machines with Python 3.6.7 and GDAL 3.0 installed through either Tomas Szerky's GDAL builds or Anaconda, I get the following error:

C:\Program Files\GDAL>gdalinfo --version
GDAL 3.0.0, released 2019/05/05

C:\Program Files\GDAL>python
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)] on win32

C:\Program Files\GDAL>pip install osm-export-tool
Collecting osm-export-tool
  Downloading https://files.pythonhosted.org/packages/7a/24/7076b34b872887d2a3a47e8736144148a3150ff52c2d98546df0796ee64e/osm-export-tool-0.0.7.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\<username>\appdata\local\programs\python\python36\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<username>\\AppData\\Local\\Temp\\pip-install-x4tky5a8\\osm-export-tool\\setup.py'"'"'; __file__='"'"'C:\\Users\\<username>\\AppData\\Local\\Temp\\pip-install-x4tky5a8\\osm-export-tool\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\<username>\AppData\Local\Temp\pip-install-x4tky5a8\osm-export-tool\
    Complete output (13 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\<username>\AppData\Local\Temp\pip-install-x4tky5a8\osm-export-tool\setup.py", line 20, in <module>
        gdal_version = subprocess.check_output([gdal_config,'--version'],encoding='UTF-8').strip()
      File "c:\users\<username>\appdata\local\programs\python\python36\lib\subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "c:\users\<username>\appdata\local\programs\python\python36\lib\subprocess.py", line 403, in run
        with Popen(*popenargs, **kwargs) as process:
      File "c:\users\<username>\appdata\local\programs\python\python36\lib\subprocess.py", line 709, in __init__
        restore_signals, start_new_session)
      File "c:\users\<username>\appdata\local\programs\python\python36\lib\subprocess.py", line 997, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified 
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

With the problem being in the following line of code:

gdal_version = subprocess.check_output([gdal_config,'--version'],encoding='UTF-8')

This OSGeo4W support ticket seems to suggest that the used package gdal-config is only available on Unix systems.

It should also be noted that gdal-config is not part of some regular gdal installs - when I installed it on Linux, I had to apt-get libgdal-dev in addition to gdal-bin and python3-gdal (from ubuntugis).

vdveen avatar Oct 10 '19 07:10 vdveen