simonw / datasette-jq

Datasette plugin that adds a custom SQL function for executing jq expressions against JSON values
Apache License 2.0
16 stars 0 forks source link

Installing this plugin causes an error when running Datasette #2

Open jamesking opened 3 years ago

jamesking commented 3 years ago

I tried installing datasette-jq on the command-line version of Datasette (version 0.58.1).

The installation was successful:

Successfully installed datasette-jq-0.2.1 pyjq-2.5.2

But afterwards starting Datasette gives this error when running on the command line:

Traceback (most recent call last):
  File "/usr/local/bin/datasette", line 33, in <module>
    sys.exit(load_entry_point('datasette==0.58.1', 'console_scripts', 'datasette')())
  File "/usr/local/bin/datasette", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/datasette/cli.py", line 15, in <module>
    from .app import Datasette, DEFAULT_SETTINGS, SETTINGS, SQLITE_LIMIT_ATTACHED, pm
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/datasette/app.py", line 30, in <module>
    from .views.database import DatabaseDownload, DatabaseView
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/datasette/views/database.py", line 21, in <module>
    from datasette.plugins import pm
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/datasette/plugins.py", line 24, in <module>
    pm.load_setuptools_entrypoints("datasette")
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/datasette_jq/__init__.py", line 2, in <module>
    import pyjq
  File "/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/pyjq.py", line 5, in <module>
    import _pyjq
ImportError: dlopen(/usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/_pyjq.cpython-39-darwin.so, 2): Library not loaded: /usr/local/opt/jq/lib/libjq.1.dylib
  Referenced from: /usr/local/Cellar/datasette/0.58.1/libexec/lib/python3.9/site-packages/_pyjq.cpython-39-darwin.so
  Reason: image not found
jamesking commented 3 years ago

Seems to also cause an issue for Datasette Desktop.

dbaynard commented 2 years ago

I've been working on integrating datasette tools with the nixpkgs ecosystem, and this worked for me (on an arm64 mac, with python 3.10.7) as soon as I got pyjq to build.

You're seeing what should be a build error with pyjq, I believe. Looking at the error message, the shared library isn't being loaded. It's plausible that this has now been fixed, though there are still open issues · doloopwhile/pyjq concerning build failures.

I'm happy to help debug a non-nixpkgs build, if needed.

gabriel-r commented 1 year ago

Seeing a similar issue with the Mac Desktop app. I've installed manually pyjq after installing all its dependencies, i.e. brew install autoconf automake libtool

The error I'm seeing is (at the end of an avalanche of other messages) is error: [Errno 2] No such file or directory: 'autoreconf'

It like Datasette (Desktop) is running on its own environment and not seeing the preinstalled tools?