tomalrussell / snkit

spatial networks toolkit (python)
MIT License
31 stars 10 forks source link

Consider building wheels #45

Closed tomalrussell closed 1 year ago

tomalrussell commented 2 years ago

snkit is currently a pure python package

So cibuildwheel will fail with something like this:

  + python -m pip wheel D:\a\snkit\snkit --wheel-dir=C:\Users\RUNNER~1\AppData\Local\Temp\cibuildwheelc_4qg399\built_wheel --no-deps
  Processing d:\a\snkit\snkit
    DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
     pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
  Building wheels for collected packages: snkit
    Building wheel for snkit (setup.py): started
    Building wheel for snkit (setup.py): finished with status 'done'
    Created wheel for snkit: filename=snkit-1.7.0-py3-none-any.whl size=11231 sha256=1421895037e21a418ddf9cc7a5db1f973176b49e199d5ce90fff341f436e41be
    Stored in directory: C:\Users\RUNNER~1\AppData\Local\Temp\pip-ephem-wheel-cache-hakryx70\wheels\e2\d2\f4\dcd923214b0cdd9db36e6aa46f747eeb86480df2be56ce7db9
  Successfully built snkit
  Traceback (most recent call last):
    File "C:\hostedtoolcache\windows\Python\3.9.10\x64\lib\runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "C:\hostedtoolcache\windows\Python\3.9.10\x64\lib\runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "C:\Program Files (x86)\pipx\.cache\709265f20f5c9cd\Scripts\cibuildwheel.exe\__main__.py", line 7, in <module>
    File "C:\Program Files (x86)\pipx\.cache\709265f20f5c9cd\lib\site-packages\cibuildwheel\__main__.py", line 195, in main
      cibuildwheel.windows.build(options)
    File "C:\Program Files (x86)\pipx\.cache\709265f20f5c9cd\lib\site-packages\cibuildwheel\windows.py", line 364, in build
      raise NonPlatformWheelError()
  cibuildwheel.util.NonPlatformWheelError: 
  cibuildwheel: Build failed because a pure Python wheel was generated.

  If you intend to build a pure-Python wheel, you don't need cibuildwheel - use
  `pip wheel -w DEST_DIR .` instead.

  If you expected a platform wheel, check your project configuration, or run
  cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs.

But the suggested pip wheel -w dist . fails due to missing GDAL_VERSION:

Processing ~\projects\snkit
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting geopandas>=0.10
  Downloading geopandas-0.10.2-py2.py3-none-any.whl (1.0 MB)
     ---------------------------------------- 1.0/1.0 MB 13.1 MB/s eta 0:00:00
Collecting pygeos>=0.12
  Downloading pygeos-0.12.0-cp39-cp39-win_amd64.whl (1.4 MB)
     ---------------------------------------- 1.4/1.4 MB 18.4 MB/s eta 0:00:00
Collecting pandas>=0.25.0
  Downloading pandas-1.4.1-cp39-cp39-win_amd64.whl (10.5 MB)
     --------------------------------------- 10.5/10.5 MB 25.2 MB/s eta 0:00:00
Collecting pyproj>=2.2.0
  Downloading pyproj-3.3.0-cp39-cp39-win_amd64.whl (6.3 MB)
     ---------------------------------------- 6.3/6.3 MB 29.0 MB/s eta 0:00:00
Collecting fiona>=1.8
  Downloading Fiona-1.8.21.tar.gz (1.0 MB)
     ---------------------------------------- 1.0/1.0 MB 33.2 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  python setup.py egg_info did not run successfully.
  exit code: 1

  [1 lines of output]
  A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

And if we ask for the local $ gdalinfo --version - GDAL 3.4.2, released 2022/03/08 then do GDAL_VERSION=3.4.2 pip wheel -w dist ., then we get a snkit wheel but fail to build a fiona wheel.

Processing ~\projects\snkit
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting geopandas>=0.10
  Using cached geopandas-0.10.2-py2.py3-none-any.whl (1.0 MB)
Collecting pygeos>=0.12
  Using cached pygeos-0.12.0-cp39-cp39-win_amd64.whl (1.4 MB)
Collecting shapely>=1.6
  Downloading Shapely-1.8.1.post1-cp39-cp39-win_amd64.whl (1.3 MB)
     ---------------------------------------- 1.3/1.3 MB 16.5 MB/s eta 0:00:00
Collecting pyproj>=2.2.0
  Using cached pyproj-3.3.0-cp39-cp39-win_amd64.whl (6.3 MB)
Collecting fiona>=1.8
  Using cached Fiona-1.8.21.tar.gz (1.0 MB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting pandas>=0.25.0
  Using cached pandas-1.4.1-cp39-cp39-win_amd64.whl (10.5 MB)
Collecting numpy>=1.13
  Downloading numpy-1.22.3-cp39-cp39-win_amd64.whl (14.7 MB)
     --------------------------------------- 14.7/14.7 MB 54.7 MB/s eta 0:00:00
Collecting attrs>=17
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting certifi
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting click>=4.0
  Downloading click-8.0.4-py3-none-any.whl (97 kB)
     ---------------------------------------- 97.5/97.5 KB 5.5 MB/s eta 0:00:00
Collecting cligj>=0.5
  Downloading cligj-0.7.2-py3-none-any.whl (7.1 kB)
Collecting click-plugins>=1.0
  Downloading click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)
Collecting six>=1.7
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting munch
  Downloading munch-2.5.0-py2.py3-none-any.whl (10 kB)
Collecting setuptools
  Using cached setuptools-60.10.0-py3-none-any.whl (1.1 MB)
Collecting pytz>=2020.1
  Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
     ------------------------------------- 503.5/503.5 KB 30.8 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.1
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ------------------------------------- 247.7/247.7 KB 14.8 MB/s eta 0:00:00
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Saved ~\projects\snkit\dist\geopandas-0.10.2-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\pygeos-0.12.0-cp39-cp39-win_amd64.whl
Saved ~\projects\snkit\dist\numpy-1.22.3-cp39-cp39-win_amd64.whl
Saved ~\projects\snkit\dist\pandas-1.4.1-cp39-cp39-win_amd64.whl
Saved ~\projects\snkit\dist\pyproj-3.3.0-cp39-cp39-win_amd64.whl
Saved ~\projects\snkit\dist\shapely-1.8.1.post1-cp39-cp39-win_amd64.whl
Saved ~\projects\snkit\dist\attrs-21.4.0-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\click-8.0.4-py3-none-any.whl
Saved ~\projects\snkit\dist\click_plugins-1.1.1-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\cligj-0.7.2-py3-none-any.whl
Saved ~\projects\snkit\dist\python_dateutil-2.8.2-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\pytz-2022.1-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\six-1.16.0-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\certifi-2021.10.8-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\munch-2.5.0-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\colorama-0.4.4-py2.py3-none-any.whl
Saved ~\projects\snkit\dist\setuptools-60.10.0-py3-none-any.whl
Building wheels for collected packages: snkit, fiona
  Building wheel for snkit (setup.py): started
  Building wheel for snkit (setup.py): finished with status 'done'
  Created wheel for snkit: filename=snkit-1.7.1.dev0+g53cb103.d20220323-py3-none-any.whl size=11292 sha256=354769442ed75352d50cbc705ac12635276df8e1ccbaa2209047600d6ad4d422
  Stored in directory: ~\AppData\Local\Temp\pip-ephem-wheel-cache-1bl5kykr\wheels\a0\71\3d\688f7e29cf35cf07e709581e9120226a68758b31ddce164484
  Building wheel for fiona (setup.py): started
  Building wheel for fiona (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  python setup.py bdist_wheel did not run successfully.
  exit code: 1

  [56 lines of output]
  ~\AppData\Local\Continuum\miniconda3\envs\snkit\lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'metadata_version'
    warnings.warn(msg)
  ~\AppData\Local\Continuum\miniconda3\envs\snkit\lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'requires_python'
    warnings.warn(msg)
  ~\AppData\Local\Continuum\miniconda3\envs\snkit\lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'requires_external'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\fiona
  copying .\fiona\collection.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\compat.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\crs.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\drvsupport.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\env.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\errors.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\inspector.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\io.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\logutils.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\path.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\rfc3339.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\session.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\transform.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\vfs.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\_loading.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\_show_versions.py -> build\lib.win-amd64-3.9\fiona
  copying .\fiona\__init__.py -> build\lib.win-amd64-3.9\fiona
  creating build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\bounds.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\calc.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\cat.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\collect.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\distrib.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\dump.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\env.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\filter.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\helpers.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\info.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\insp.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\load.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\ls.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\main.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\options.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\rm.py -> build\lib.win-amd64-3.9\fiona\fio
  copying .\fiona\fio\__init__.py -> build\lib.win-amd64-3.9\fiona\fio
  running build_ext
  building 'fiona.schema' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\fiona
  "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I~\AppData\Local\Continuum\miniconda3\envs\snkit\include -I~\AppData\Local\Continuum\miniconda3\envs\snkit\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcfiona/schema.c /Fobuild\temp.win-amd64-3.9\Release\fiona/schema.obj
  schema.c
  fiona/schema.c(642): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fiona
  Running setup.py clean for fiona
Successfully built snkit
Failed to build fiona
ERROR: Failed to build one or more wheels

Stopping this investigation here for now - may be something to test on Ubuntu/MacOS where the GDAL dependency is easier to manage? Otherwise leave it at source distribution.

tomalrussell commented 1 year ago

Closed by aa614e7b7