Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems installing according to instructions. #42

Open
scaddenp opened this issue Feb 2, 2025 · 11 comments
Open

Problems installing according to instructions. #42

scaddenp opened this issue Feb 2, 2025 · 11 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@scaddenp
Copy link

scaddenp commented Feb 2, 2025

Checking out branch and trying to install with poetry, I get:
fgdb_to_gpkg-main>poetry install

The Poetry configuration is invalid:

  • project.dependencies must be array

Same error with pipx install --editable .


Just trying to install with pipx
pipx install fgdb-to-gpkg

Gets:

pip failed to build package:
gdal

Some possibly relevant errors from pip install:
error: subprocess-exited-with-error
extensions/gdalconst_wrap.c(2703): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/gnm_wrap.cpp(2820): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/ogr_wrap.cpp(2845): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/gdal_wrap.cpp(2884): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
extensions/osr_wrap.cpp(2879): fatal error C1083: Cannot open include file: 'cpl_string.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe' failed with exit code 2
ERROR: Failed to build installable wheels for some pyproject.toml based projects (gdal)

Error installing fgdb-to-gpkg.

@philiporlando
Copy link
Owner

philiporlando commented Feb 3, 2025

Thanks for opening this. I'm seeing similar errors related to GDAL when running poetry install on a new machine:

> poetry install
...
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/lib/python3/dist-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
      self.run_setup()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 522, in run_setup
      super().run_setup(setup_script=setup_script)
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
      exec(code, locals())
    File "<string>", line 350, in <module>
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 186, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
      dist.run_commands()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 983, in run_commands
      self.run_command(cmd)
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 999, in run_command
      super().run_command(command)
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_command
      cmd_obj.run()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 312, in run
      self.find_sources()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 320, in find_sources
      mm.run()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 543, in run
      self.add_defaults()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 581, in add_defaults
      sdist.add_defaults(self)
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/command/sdist.py", line 109, in add_defaults
      super().add_defaults()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 239, in add_defaults
      self._add_defaults_ext()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 323, in _add_defaults_ext
      build_ext = self.get_finalized_command('build_ext')
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in get_finalized_command
      cmd_obj.ensure_finalized()
    File "/tmp/tmp1gpcbehm/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 124, in ensure_finalized
      self.finalize_options()
    File "<string>", line 255, in finalize_options
    File "<string>", line 194, in get_gdal_config
  gdal_config_error: Traceback (most recent call last):
    File "<string>", line 87, in fetch_config
    File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 188, in get_gdal_config
    File "<string>", line 90, in fetch_config
  gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
  
  Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
  

  at /usr/lib/python3/dist-packages/poetry/installation/chef.py:164 in _prepare
      160161error = ChefBuildError("\n\n".join(message_parts))
      162163if error is not None:
    → 164raise error from None
      165166return path
      167168def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with gdal (3.6.3) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "gdal (==3.6.3)"'.

GDAL is a system dependency that is not being installed by Python. I'll need to look into this more.

@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

Interesting that you dont get the "project.dependencies must be array" error. Maybe that is a new version of poetry that I have installed.

I will try installing gdal independently via a downloaded wheel

@philiporlando
Copy link
Owner

philiporlando commented Feb 3, 2025

I installed GDAL on the new test machine:

> sudo apt update && sudo apt install -y gdal-bin libgdal-dev

From here, I'm able to install the development version of this package without any issues:

> poetry install
Installing dependencies from lock file

Package operations: 2 installs, 0 updates, 0 removals

  - Installing fiona (1.10b2)
  - Installing gdal (3.6.3)

Installing the current project: fgdb-to-gpkg (0.3.2)

At a minimum, GDAL system dependency details and installation instructions should be added to the README. I'll also need to research best practices for managing system dependencies in Python packages.

@scaddenp could you please ensure that GDAL is installed on your machine and then try running poetry install again?

@philiporlando philiporlando added bug Something isn't working documentation Improvements or additions to documentation labels Feb 3, 2025
@philiporlando philiporlando self-assigned this Feb 3, 2025
@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

Working on it, but I dont think it will deal with the poetry error

@philiporlando
Copy link
Owner

philiporlando commented Feb 3, 2025

Thank you for looking into the GDAL dependency.

I agree about the poetry error. I was successful when testing with poetry 1.8.2, however, I'm seeing a similar error now after upgrading to poetry 2.0.1:

> poetry install

The Poetry configuration is invalid:
  - project.dependencies must be array

I suspect the major version bump introduced breaking changes. Can you please confirm your poetry version?

@philiporlando
Copy link
Owner

philiporlando commented Feb 3, 2025

@scaddenp, after reviewing the poetry docs and 2.0 changelog, I've identified several API changes that will require refactoring. It may take me a couple of weeks to fully adapt this project to poetry 2.0. I've also been considering migrating to uv, so I may end up going that route instead.

That said, I was able to install this package from PyPI after ensuring that GDAL was installed:

> gdalinfo --version
GDAL 3.8.4, released 2024/02/08

> pipx install fgdb-to-gpkg
  installed package fgdb-to-gpkg 0.3.2, installed using Python 3.12.3
  These apps are now globally available
    - fgdb-to-gpkg
done! ✨ 🌟 ✨

> fgdb-to-gpkg --help
usage: fgdb-to-gpkg [-h] [--overwrite] fgdb_path gpkg_path

Convert an Esri File GeoDatabase to a GeoPackage

If you're not actively developing on this project, then I recommend installing from PyPI via pipx.

However, if you'd prefer to install the development version, please downgrade poetry to <=1.8.5, try running poetry install, and let me know how it goes!

@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

Probably something to do with trying to do it on windows:
gdalinfo --version
GDAL 3.6.2, released 2023/01/02

pipx install fgdb-to-gpkg
Fatal error from pip prevented installation. Full pip output in file:
C:\Users\scaddenp\pipx\logs\cmd_2025-02-03_15.14.55_pip_errors.log

pip failed to build package:
gdal

Some possibly relevant errors from pip install:
error: subprocess-exited-with-error
extensions/gdalconst_wrap.c(2703): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/ogr_wrap.cpp(2845): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/gdal_wrap.cpp(2884): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
extensions/gnm_wrap.cpp(2820): fatal error C1083: Cannot open include file: 'gdal.h': No such file or directory
extensions/osr_wrap.cpp(2879): fatal error C1083: Cannot open include file: 'cpl_string.h': No such file or directory

In short, looks like trying to compile a gdal wheel. I will try an alternative approach to installing gdal, natively and into the python environment. It will have to be tomorrow though as other stuff screaming.

@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

I also tried downgrade to poetry and running the install. Errors:

Could not find geos-config executable. Either append the path to geos-config to PATH or manually provide the include_dirs, library_dirs, libraries and other link args for compiling against a GEOS version >=3.5.

This came up repeatedly as it tried to compile various components.

Finally died while invoking c compiler:
fatal error C1083: Cannot open include file: 'geos_c.h': No such file or directory

All this while building shapely. The c compiler comes unstuck trying to build a wheel.

@philiporlando
Copy link
Owner

Thanks for providing these details.

When installing from PyPI, it seems like pipx is still struggling to recognize your GDAL installation. I'm not sure why this is happening. Can you share the steps that you took to install GDAL on Windows so I can try to recreate the issue on my end?

When installing the development version, it seems like poetry is now complaining about a missing GEOS installation, which is a separate system dependency. I didn't explicitly install GEOS when testing on my fresh Ubuntu machine, so I'm not sure why you're seeing this. Happy to try and troubleshoot this further over the next few days though.

@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

gdal is potentially a complex mess because I already have a osgeow gdal version installed. But I just tried pip install gdal with fingers crossed and it worked. (ie looking for the shortcut). Hence 3.6.2 not 3.6.3 - so it is trying to build rather than use binary. I am playing about a versions here to see what happens. I can always uninstall GDAL completely off machine and do fresh GDAL install at 3.6.3 but was trying to sidestep that.

@scaddenp
Copy link
Author

scaddenp commented Feb 3, 2025

Decided that I didn't have time to clean up my mess on Windows and switched to linux. Binaries are available (cgohike) for 3.6.2 and 3.6.4 but not 3.6.3. Want it for a linux container ultimately anyway. On windows, I can get by with just scripting and OGR2OGR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants