magma-nvim icon indicating copy to clipboard operation
magma-nvim copied to clipboard

[Bug] AttributeError: module 'importlib' has no attribute 'util'

Open buck-ross opened this issue 4 months ago • 3 comments

Describe the bug I just tried to install this plugin via lazy-nvim. After much troubleshooting, I reached the point of getting an error I can't seem to get past. Here's the output of :checkhealth magma:

magma: health#magma#check

- ERROR Failed to run healthcheck for "magma" plugin. Exception:
  function health#check[25]..health#magma#check[21]..<SNR>36_python_module_check[1]..<SNR>36_python_has_module[2]..provider#python3#Call, line 18
  Vim(return):Error invoking 'python_eval' on channel 3 (python3-script-host):
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  AttributeError: module 'importlib' has no attribute 'util'

At this point, none of the :Magma* commands provided by the plugin appear to be available within my environment, although I'm not 100% sure that this is the result of the above error.

I've traced back the error to line 2 of autoload/health/magma.vim. It looks like in all versions of python 3.10 and over, the importlib module no longer exports util by default - this line should be python3 import importlib.util instead.

To Reproduce Steps to reproduce the behavior:

  1. Install the plugin on a system configured with a python installation more recent than 3.9
  2. Attempt to open a python file
  3. Run :checkhealth magma and see the errors which are preventing the plugin from functioning.

Expected behavior The plugin should load without error and function as it is intended to.

Desktop (please complete the following information):

  • OS: Linux
  • Browser N/A
  • Version main

Additional context Looking through the documentation, it isn't clear if support for python >3.8 is even a goal of this plugin. If this is not desirable, please feel free to amend the documentation to indicate this version requirement, and close this issue.

Thank you for your time! Please let me know if there is any way I can help with this.

buck-ross avatar Mar 03 '24 02:03 buck-ross

Same issue here, with a clean installation of the newest neovim (v0.9.5) with Python 3.10.12. Would be interested in the support for the newer versions :)

knyazer avatar Mar 05 '24 16:03 knyazer

@buck-ross @knyazer could you both try this with molten-nvim, I'm not having any issues with it. Molten is a maintained fork of this plugin btw, it's not exactly compatible, there are breaking changes, but there are quite a few improvements and new features.

benlubas avatar Mar 20 '24 13:03 benlubas

@benlubas, hey!

Everything works with Molten, I just forgot to mention that here :)

knyazer avatar Mar 20 '24 13:03 knyazer