Sublime Forum

Plugin: ImportError: No module named 'yaml'

#1

Hello,

I am using the plugin SublimeLinter-contrib-phpstan, it was working fine till something like 1 month ago, but it stopped working recently. I checked the console and I found this log:

reloading python 3.3 plugin SublimeLinter-contrib-phpstan.linter
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1697, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/xxx/Library/Application Support/Sublime Text/Installed Packages/SublimeLinter-contrib-phpstan.sublime-package/linter.py", line 5, in <module>
ImportError: No module named 'yaml'

Although I installed yaml for both Python and Python 3, I read on this forum that Sublime Text is shipped with its own version of Python 3.3 and Python 3.8. So, I suppose it needs also to have that yaml extension.

Thanks!

0 Likes

#2

The plugin imports yaml but doesn’t seem to specify it as a dependency. Thus if not requested by any other package, the library is not installed or even removed by Package Control.

The package should contain a dependencies.json with following content.

{
    "*": {
        "*": [
            "pyyaml"
        ]
    }
}
2 Likes

#3

I confirm that it works, thanks a lot! :grinning:

0 Likes