thinkingmachines / geomancer

Automated feature engineering for geospatial data
MIT License
214 stars 16 forks source link

[Bug] "NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery" when calling the `cast` method from `DistanceToNearest` #84

Open enzoampil opened 4 years ago

enzoampil commented 4 years ago

After running the code below on Google Colab:

dist_spell = DistanceToNearest(
    "hospital",
    source_table="phcovid.gis_osm_pois_free_1",
    feature_name="dist_hospital",
    dburl="bigquery://ml-prototypes",
).cast(df)

The following error occurs:

2020-03-29 03:15:18.390 | ERROR | main::6 - An error has been caught in function '', process 'MainProcess' (119), thread 'MainThread' (140460848953216): Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) └ ModuleSpec(name='ipykernel_launcher', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fbf94d60cf8>, origin='... File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) │ └ {'name': 'main', 'doc': 'Entry point for launching an IPython kernel.\n\nThis is separate from the ipykernel pack... └ <code object at 0x7fbf94db0660, file "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 5>

File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in app.launch_new_instance() │ └ <bound method Application.launch_instance of <class 'ipykernel.kernelapp.IPKernelApp'>> └ <module 'ipykernel.kernelapp' from '/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py'>

File "/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py", line 664, in launch_instance app.start() │ └ <function IPKernelApp.start at 0x7fbf8f501ea0> └ <ipykernel.kernelapp.IPKernelApp object at 0x7fbf94f0ac50>

File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start ioloop.IOLoop.instance().start() │ │ └ <staticmethod object at 0x7fbf90622a20> │ └ <class 'tornado.ioloop.IOLoop'> └ <module 'tornado.ioloop' from '/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py'>

File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 888, in start handler_func(fd_obj, events) │ │ └ 1 │ └ <zmq.sugar.socket.Socket object at 0x7fbf7f3f1660> └ <function wrap..null_wrapper at 0x7fbf7f3f4730>

File "/usr/local/lib/python3.6/dist-packages/tornado/stack_context.py", line 277, in null_wrapper return fn(*args, **kwargs) │ │ └ {} │ └ (<zmq.sugar.socket.Socket object at 0x7fbf7f3f1660>, 1) └ <bound method ZMQStream._handle_events of <zmq.eventloop.zmqstream.ZMQStream object at 0x7fbf7f3deef0>>

File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events self._handle_recv() │ └ <function ZMQStream._handle_recv at 0x7fbf8fa210d0> └ <zmq.eventloop.zmqstream.ZMQStream object at 0x7fbf7f3deef0>

File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv self._run_callback(callback, msg) │ │ │ └ [<zmq.sugar.frame.Frame object at 0x7fbf6d6886c0>, <zmq.sugar.frame.Frame object at 0x7fbf6d688778>, <zmq.sugar.frame.Frame o... │ │ └ <function wrap..null_wrapper at 0x7fbf72c45730> │ └ <function ZMQStream._run_callback at 0x7fbf8fa1bf28> └ <zmq.eventloop.zmqstream.ZMQStream object at 0x7fbf7f3deef0>

File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback callback(*args, **kwargs) │ │ └ {} │ └ ([<zmq.sugar.frame.Frame object at 0x7fbf6d6886c0>, <zmq.sugar.frame.Frame object at 0x7fbf6d688778>, <zmq.sugar.frame.Frame ... └ <function wrap..null_wrapper at 0x7fbf72c45730>

File "/usr/local/lib/python3.6/dist-packages/tornado/stack_context.py", line 277, in null_wrapper return fn(*args, **kwargs) │ │ └ {} │ └ ([<zmq.sugar.frame.Frame object at 0x7fbf6d6886c0>, <zmq.sugar.frame.Frame object at 0x7fbf6d688778>, <zmq.sugar.frame.Frame ... └ <function Kernel.start..make_dispatcher..dispatcher at 0x7fbf72c456a8>

File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher return self.dispatch_shell(stream, msg) │ │ │ └ [<zmq.sugar.frame.Frame object at 0x7fbf6d6886c0>, <zmq.sugar.frame.Frame object at 0x7fbf6d688778>, <zmq.sugar.frame.Frame o... │ │ └ <zmq.eventloop.zmqstream.ZMQStream object at 0x7fbf7f3deef0> │ └ <function Kernel.dispatch_shell at 0x7fbf8f56b1e0> └ <google.colab._kernel.Kernel object at 0x7fbf7f183320>

File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell handler(stream, idents, msg) │ │ │ └ {'header': {'username': 'username', 'msg_type': 'execute_request', 'msg_id': 'cf57ce7b1af942c3e5e49e6c3d24d01a', 'version': '... │ │ └ [b'436ca7d2de314043e8098971c7ce30c9'] │ └ <zmq.eventloop.zmqstream.ZMQStream object at 0x7fbf7f3deef0> └ <bound method Kernel.execute_request of <google.colab._kernel.Kernel object at 0x7fbf7f183320>>

File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request user_expressions, allow_stdin) │ └ True └ {}

File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) │ │ │ │ └ False │ │ │ └ True │ │ └ 'dist_spell = DistanceToNearest(\n "hospital",\n source_table="phcovid.gis_osm_pois_free_1",\n feature_name="dist_ho... │ └ <function ZMQInteractiveShell.run_cell at 0x7fbf8f4fe158> └ <google.colab._shell.Shell object at 0x7fbf7f183240>

File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) │ │ │ └ {'store_history': True, 'silent': False} │ │ └ ('dist_spell = DistanceToNearest(\n "hospital",\n source_table="phcovid.gis_osm_pois_free_1",\n feature_name="dist_h... │ └ <google.colab._shell.Shell object at 0x7fbf7f183240> └ <class 'ipykernel.zmqshell.ZMQInteractiveShell'>

File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2718, in run_cell interactivity=interactivity, compiler=compiler, result=result) │ │ └ <ExecutionResult object at 7fbf6f4772e8, execution_count=58 error_before_exec=None error_in_exec=None result=None> │ └ <IPython.core.compilerop.CachingCompiler object at 0x7fbf7f3ded68> └ 'last_expr'

File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2822, in run_ast_nodes if self.run_code(code, result): │ │ │ └ <ExecutionResult object at 7fbf6f4772e8, execution_count=58 error_before_exec=None error_in_exec=None result=None> │ │ └ <code object at 0x7fbf6e50f540, file "", line 1> │ └ <function InteractiveShell.run_code at 0x7fbf929eb400> └ <google.colab._shell.Shell object at 0x7fbf7f183240>

File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code exec(code_obj, self.user_global_ns, self.user_ns) │ │ │ │ └ {'name': 'main', 'doc': 'Automatically created module for IPython interactive environment', 'package': None, ... │ │ │ └ <google.colab._shell.Shell object at 0x7fbf7f183240> │ │ └ <property object at 0x7fbf92f7a9a8> │ └ <google.colab._shell.Shell object at 0x7fbf7f183240> └ <code object at 0x7fbf6e50f540, file "", line 1>

File "", line 6, in ).cast(df) └ WKT ... name 0 POINT (120.6202008 14.3854827) ...

File "/usr/local/lib/python3.6/dist-packages/geomancer/spells/base.py", line 184, in cast engine = core.get_engine() │ └ <function DBCore.get_engine at 0x7fbf6d68c0d0> └ <geomancer.backend.cores.bq.BigQueryCore object at 0x7fbf6d3e1e48>

File "/usr/local/lib/python3.6/dist-packages/geomancer/backend/cores/base.py", line 108, in get_engine return create_engine(self.dburl) │ │ └ bigquery://ml-prototypes │ └ <geomancer.backend.cores.bq.BigQueryCore object at 0x7fbf6d3e1e48> └ <function create_engine at 0x7fbf6dc226a8>

File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/init.py", line 423, in create_engine return strategy.create(*args, **kwargs) │ │ │ └ {} │ │ └ (bigquery://ml-prototypes,) │ └ <function DefaultEngineStrategy.create at 0x7fbf6d8fb620> └ <sqlalchemy.engine.strategies.PlainEngineStrategy object at 0x7fbf6dc33cf8>

File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/strategies.py", line 61, in create entrypoint = u._get_entrypoint() │ └ <function URL._get_entrypoint at 0x7fbf6db5a598> └ bigquery://ml-prototypes

File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/url.py", line 172, in _get_entrypoint cls = registry.load(name) │ │ └ 'bigquery' │ └ <function PluginLoader.load at 0x7fbf6dfeda60> └ <sqlalchemy.util.langhelpers.PluginLoader object at 0x7fbf6db59240>

File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/langhelpers.py", line 240, in load "Can't load plugin: %s:%s" % (self.group, name) │ │ └ 'bigquery' │ └ 'sqlalchemy.dialects' └ <sqlalchemy.util.langhelpers.PluginLoader object at 0x7fbf6db59240>

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery

NoSuchModuleError Traceback (most recent call last)

in () 4 feature_name="dist_hospital", 5 dburl="bigquery://ml-prototypes", ----> 6 ).cast(df) 6 frames /usr/local/lib/python3.6/dist-packages/sqlalchemy/util/langhelpers.py in load(self, name) 238 239 raise exc.NoSuchModuleError( --> 240 "Can't load plugin: %s:%s" % (self.group, name) 241 ) 242 NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:bigquery