kart icon indicating copy to clipboard operation
kart copied to clipboard

Difficulties setting up Kart on MacOS

Open nyrareddy opened this issue 3 years ago • 7 comments

Describe the bug I have GDAL and QGIS installed and running.

Running kart --version gives this error:

Traceback (most recent call last):
  File "osgeo/__init__.py", line 21, in swig_import_helper
  File "importlib/__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'osgeo._gdal'

Setting up locally using the CONTRIBUTING guide gives a different error.

Traceback (most recent call last):
  File "./kart", line 33, in <module>
    sys.exit(load_entry_point('kart', 'console_scripts', 'kart')())
  File "./kart", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/Users/nyra/kart/build/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 203, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/[email protected]/3.7.13/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/nyra/kart/kart/__init__.py", line 115, in <module>
    import pygit2
  File "/Users/nyra/kart/build/venv/lib/python3.7/site-packages/pygit2/__init__.py", line 30, in <module>
    from ._pygit2 import *
ImportError: dlopen(/Users/nyra/kart/build/venv/lib/python3.7/site-packages/pygit2/_pygit2.cpython-37m-darwin.so, 2): Symbol not found: _git_odb_get_lookup_flags
  Referenced from: /Users/nyra/kart/build/venv/lib/python3.7/site-packages/pygit2/_pygit2.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/nyra/kart/build/venv/lib/python3.7/site-packages/pygit2/_pygit2.cpython-37m-darwin.so

To Reproduce Steps to reproduce the behaviour:

  1. Install using the standard steps for macos using the README or build locally using the CONTRIBUTING guide.
  2. Run kart --version if installing from pkg or brew, or if building from source, run./build/kart --version.
  3. See respective errors.

Version Info

  • OS: MacOS Catalina
  • Version: 0.11.2dev0

nyrareddy avatar Mar 24 '22 12:03 nyrareddy

I just tried building a fresh dev build and it seemed to work - of course, this doesn't mean that there is no issue, it just means I haven't reproduced it on my machine yet.

From the error you get, it makes me think your libgit2 is out of sync with your pygit2 - which could happen if something went wrong in this step:

# do this outside your Kart checkout/directory
$ git clone --branch=kx-latest https://github.com/koordinates/libgit2.git
$ cd libgit2
$ cmake -B build -S . -DBUILD_CLAR=OFF -Wno-dev
$ cmake --build build
$ cmake --install build

Not sure what would have gone wrong, but you can try it again and see if it works any better...

To troubleshoot a bit further: In build/CMakeCache.txt you can find a line like this: LibGit2_LIBRARY:FILEPATH=/usr/local/lib/libgit2.dylib That should point to a libgit2.dylib that a) exists and b) the modification timestamp should show that it was modified when you installed libgit2, as per the snippet above

olsen232 avatar Mar 28 '22 01:03 olsen232

Also from CONTRIBUTING.md:

If you're having issues with the above, you can download a recent master-branch vendor CI artifact for your platform (vendor-Darwin for macOS, or vendor-Linux for Linux. Then:

$ cmake -B build -S . -DVENDOR_ARCHIVE=/path/to/downloaded/vendor-Darwin.zip
$ cd build
$ make
$ ./kart --version

olsen232 avatar Mar 28 '22 01:03 olsen232

Hi @nyrareddy, were you able to do any more troubleshooting of this issue?

craigds avatar Apr 13 '22 22:04 craigds

$ cmake -B build -S . -DVENDOR_ARCHIVE=/path/to/downloaded/vendor-Darwin.zip $ cd build $ make $ ./kart --version

On running above commands I get this error -

[ 20%] Creating Kart virtualenv...
[ 40%] Installing vendor dependencies...
-- Extracting vendor archive...
ERROR: GDAL-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl is not a supported wheel on this platform.
CMake Error at /Users/nyra/kart/cmake/extract_vendor_archive.cmake:31 (execute_process):
  execute_process failed command indexes:

    1: "Child return code: 1"



make[2]: *** [vendor.stamp] Error 1
make[1]: *** [CMakeFiles/cli.dir/all] Error 2
make: *** [all] Error 2

Here cmake built correctly but make errored out.

I tried building using make. It built correctly, but running kart --version in the environment produces this error.

Traceback (most recent call last):
  File " /Users/nyra /kart/venv/lib/python3.7/site-packages/osgeo/__init__.py", line 21, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: dlopen( /Users/nyra/kart/venv/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so, 2): Symbol not found: ____chkstk_darwin
  Referenced from:  /Users/nyra/kart/venv/lib/libjson-c.5.dylib (which was built for Mac OS X 11.0)
  Expected in: /usr/lib/libSystem.B.dylib
 in  /Users/nyra/kart/venv/lib/libjson-c.5.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/bin/kart", line 33, in <module>
    sys.exit(load_entry_point('kart', 'console_scripts', 'kart')())
  File "venv/bin/kart", line 25, in importlib_load_entry_point
    return next(matches).load()
  File " /Users/nyra /kart/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 203, in load
    module = import_module(match.group('module'))
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File " /Users/nyra/kart/kart/__init__.py", line 108, in <module>
    from osgeo import gdal, ogr, osr
  File " /Users/nyra/kart/venv/lib/python3.7/site-packages/osgeo/__init__.py", line 37, in <module>
    _gdal = swig_import_helper()
  File " /Users/nyra/kart/venv/lib/python3.7/site-packages/osgeo/__init__.py", line 34, in swig_import_helper
    return importlib.import_module('_gdal')
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gdal'

nyrareddy avatar Apr 15 '22 14:04 nyrareddy

Thanks, that's interesting. Is this an M1 Mac?

craigds avatar Apr 17 '22 03:04 craigds

Thanks, that's interesting. Is this an M1 Mac?

No, Intel.

nyrareddy avatar Apr 17 '22 06:04 nyrareddy

@nyrareddy Can you try this again with the most recent Kart version at https://github.com/koordinates/kart/releases/tag/v0.11.5

pfw avatar Nov 08 '22 03:11 pfw