sublimelsp / LSP-pylsp

Convenience package for the Python Language Server
MIT License
72 stars 5 forks source link

Doesn't work on linux #7

Closed predragnikolic closed 4 years ago

predragnikolic commented 4 years ago

I cloned this repo in the packages directory.

I expect the server to start the installation when I open ST, but that is not happening. (and there is no LSP-pyls folder in the cache folder)

When I open sublime, and open the console I can see that the LSP-pyls plugin loaded, and I expect to see LSP-pyls in this section, but I don't see it:

LSP: global configs ['LSP-dockerfile=True', 'LSP-elm=True', 'LSP-html=True', 'pyls=False', 'LSP-typescript=True', 'LSP-eslint=True', 'LSP-intelephense=True', 'LSP-json=True', 'LSP-css=True', 'lsp-lemminx=True', 'LSP-vue=True', 'ruby=False', 'clangd=True', 'jdtls=False', 'rust-analyzer=False', 'golsp=False', 'elixir-ls=False', 'erlang-ls=False', 'flow=False', 'gopls=False', 'dart=False', 'polymer-ide=False', 'rls=True', 'ocaml=False', 'reason=False', 'sorbet=False', 'sourcekit-lsp=False', 'vscode-css=False', 'haskell-ide-engine=False', 'rlang=False']
ST console output startup, version: 4079 linux x64 channel: dev executable: /opt/sublime_text/sublime_text working dir: /home/predrag packages path: /home/predrag/.config/sublime-text/Packages state path: /home/predrag/.config/sublime-text/Local zip path: /opt/sublime_text/Packages zip path: /home/predrag/.config/sublime-text/Installed Packages ignored_packages: ["ASP", "Batch File", "C#", "Clojure", "Color Scheme - Legacy", "D", "Erlang", "Git Formats", "Go", "Graphviz", "Groovy", "Haskell", "Java", "Language - English", "LaTeX", "Lisp", "Lua", "Makefile", "Matlab", "Objective-C", "OCaml", "Package Syncing", "Pascal", "Perl", "R", "RestructuredText", "ShellScript", "SIDE", "SQL", "TCL", "Textile", "Vintage"] Unable to decode Packages/Theme - Default/common/light/panels_button.png pre session restore time: 0.629832 font face "JetBrains Mono Lighter" could not be found, defaulting to "Monospace" startup time: 0.933405 git: tracking working dir /home/predrag/.config/sublime-text/Packages/LSP-pyls first paint time: 0.989454 reloading plugin Default.arithmetic reloading plugin Default.auto_indent_tag reloading plugin Default.block reloading plugin Default.colors reloading plugin Default.comment reloading plugin Default.convert_color_scheme reloading plugin Default.convert_syntax reloading plugin Default.copy_path reloading plugin Default.echo reloading plugin Default.exec reloading python 3.3 plugin 0_package_control_loader.00-package_control reloading python 3.3 plugin 0_package_control_loader.01-pygments reloading python 3.3 plugin 0_package_control_loader.01-ruamel-yaml reloading python 3.3 plugin 0_package_control_loader.01-sublime_lib reloading python 3.3 plugin 0_package_control_loader.10-lsp_utils reloading python 3.3 plugin 0_package_control_loader.15-coverage reloading python 3.3 plugin 0_package_control_loader.50-markupsafe reloading python 3.3 plugin 0_package_control_loader.50-pymdownx reloading python 3.3 plugin 0_package_control_loader.50-python-markdown reloading plugin Default.fold reloading python 3.3 plugin 0_package_control_loader.50-pyyaml reloading python 3.3 plugin 0_package_control_loader.50-yaml_macros_engine reloading python 3.3 plugin 0_package_control_loader.51-python-jinja2 reloading python 3.3 plugin 0_package_control_loader.55-mdpopups reloading python 3.3 plugin AdvancedNewFile.AdvancedNewFile reloading plugin Default.font reloading plugin Default.goto_line reloading plugin Default.history_list reloading plugin Default.indentation reloading plugin Default.install_package_control reloading python 3.3 plugin ColorHelper.color_helper reloading plugin Default.kill_ring reloading plugin Default.mark reloading plugin Default.new_templates reloading plugin Default.open_context_url reloading plugin Default.open_in_browser reloading plugin Default.pane reloading plugin Default.paragraph reloading plugin Default.paste_from_history reloading plugin Default.profile reloading plugin Default.quick_panel reloading plugin Default.rename reloading plugin Default.run_syntax_tests reloading plugin Default.save_on_focus_lost reloading plugin Default.scroll reloading plugin Default.set_unsaved_view_name reloading plugin Default.settings reloading plugin Default.show_scope_name reloading plugin Default.side_bar reloading plugin Default.sort reloading plugin Default.switch_file reloading plugin Default.symbol reloading plugin Default.transform reloading plugin Default.transpose reloading plugin Default.ui reloading plugin CSS.css_completions reloading plugin Diff.diff reloading plugin HTML.encode_html_entities reloading plugin HTML.html_completions reloading plugin Colored Comments.colored_comments reloading plugin Sass.sass_completions reloading plugin AutomaticPackageReloader.package_reloader reloading plugin UnitTesting.ut reloading python 3.3 plugin ColorHelper.color_helper_insert reloading python 3.3 plugin ColorHelper.color_helper_picker reloading python 3.3 plugin ColorHelper.color_helper_util reloading python 3.3 plugin ColorHelper.multiconf reloading python 3.3 plugin ColorHelper.support reloading python 3.3 plugin DoxyDoxygen (evolution).Doxy reloading python 3.3 plugin Git.git_commands reloading python 3.3 plugin GitDiffView.__init__ reloading python 3.3 plugin GitDiffView.GitDiffView reloading python 3.3 plugin Package Control.1_reloader reloading python 3.3 plugin Package Control.2_bootstrap reloading python 3.3 plugin Package Control.Package Control reloading python 3.3 plugin SnippetMaker.SnippetMaker reloading python 3.3 plugin AutomaticPackageReloader33.package_reloader reloading python 3.3 plugin ColorPicker.sublimecp reloading python 3.3 plugin GithubPR.GithubPR reloading python 3.3 plugin GithubPR.OpenPackage reloading python 3.3 plugin LSP.boot reloading python 3.3 plugin LSP-css.plugin reloading python 3.3 plugin LSP-dockerfile.plugin reloading python 3.3 plugin LSP-elm.plugin reloading python 3.3 plugin LSP-eslint.plugin reloading python 3.3 plugin LSP-html.plugin reloading python 3.3 plugin LSP-intelephense.plugin reloading python 3.3 plugin LSP-json.plugin reloading python 3.3 plugin LSP-lemminx.plugin reloading python 3.3 plugin LSP-pyls.plugin reloading python 3.3 plugin LSP-typescript.plugin reloading python 3.3 plugin LSP-vue.plugin reloading python 3.3 plugin OpenPackage.OpenPackage reloading python 3.3 plugin Terminal.Terminal reloading python 3.3 plugin UnitTesting33.ut plugins loaded LSP-eslint: Installing server LSP: "syntaxes" is deprecated, use "document_selector" instead. The document_selector for ['Packages/PackageDev/Package/Property List/Property List.sublime-syntax', 'Packages/PackageDev/Package/Sublime Text Snippet/Sublime Text Snippet.sublime-syntax', 'Packages/PackageDev/Package/TextMate Preferences/TextMate Preferences.sublime-syntax', 'Packages/XML/XML.sublime-syntax'] was deduced to "text.xml" LSP: "syntaxes" is deprecated, use "document_selector" instead. The document_selector for ['Packages/Python/Python.sublime-syntax'] was deduced to "source.python" LSP: global configs ['LSP-dockerfile=True', 'LSP-elm=True', 'LSP-html=True', 'pyls=False', 'LSP-typescript=True', 'LSP-eslint=True', 'LSP-intelephense=True', 'LSP-json=True', 'LSP-css=True', 'lsp-lemminx=True', 'LSP-vue=True', 'ruby=False', 'clangd=True', 'jdtls=False', 'rust-analyzer=False', 'golsp=False', 'elixir-ls=False', 'erlang-ls=False', 'flow=False', 'gopls=False', 'dart=False', 'polymer-ide=False', 'rls=True', 'ocaml=False', 'reason=False', 'sorbet=False', 'sourcekit-lsp=False', 'vscode-css=False', 'haskell-ide-engine=False', 'rlang=False'] reloading python 3.3 plugin AutomaticPackageReloader33.package_reloader reloading python 3.3 plugin UnitTesting33.ut Package Control: Skipping automatic upgrade, last run at 2020-08-04 19:29:18, next run at 2020-08-04 20:29:18 or after LSP-eslint: Server installed. Sublime Text restart might be required. Unable to find cancel_build command: side_run_task Unable to find cancel_build command: side_run_task
λ  python --version
Python 2.7.17
rwols commented 4 years ago

I expect the server to start the installation when I open ST, but that is not happening. (and there is no LSP-pyls folder in the cache folder)

Installation starts when you open a python file.

predragnikolic commented 4 years ago

Installation starts when you open a python file.

Strange, the installation doesn't start when I open a python file.

predragnikolic commented 4 years ago

Although I had pyls not enabled in clients lsp settings, I had to comment out pyls configuration. After I done that, LSP-pyls at least gave me some hints to what is wrong.

        //...
        "auto_show_diagnostics_panel": false,
    "clients": {
        // "pyls": {
        //  "enabled": false,
        //  "command": [
        //      "pyls"
        //  ],
        //  "languageId": "python",
        //  "scopes": [
        //      "source.python"
        //  ],
        //  "syntaxes": [
        //      "Packages/Python/Python.sublime-syntax",
        //  ],
        //  "settings": {
        //      "pyls": {
        //          "env": {
        //              // "PATH": "/opt/sublime_text/Lib",
        //              // Making Sublime's own libs available to the linters.
        //              "PYTHONPATH": "/home/predrag/.local/lib/python3.7/site-packages",
        //          },
        //          // // Configuration is computed first from user configuration (in home directory),
        //          // // overridden by configuration passed in by the language client,
        //          // // and then overridden by configuration discovered in the workspace.
        //          "configurationSources": [
        //              "pycodestyle", // discovered in ~/.config/pycodestyle, setup.cfg, tox.ini and pycodestyle.cfg
        //              // "flake8",  // discovered in ~/.config/flake8, setup.cfg, tox.ini and flake8.cfg
        //          ],
        //          "plugins": {
        //              "jedi": {
        //                  "extra_paths": [
        //                      "/home/predrag/.config/sublime-text/Packages",
        //                      "/home/predrag/.config/sublime-text/Packages/lsp_utils/st3"
        //                      // The directory where the pip installation package is located
        //                  ],
        //              },
        //              "jedi_completion": {
        //                  "fuzzy": false, // Enable fuzzy when requesting autocomplete
        //              },
        //              "pycodestyle": {
        //                  "enabled": true,
        //                  "exclude": [ // Exclude files or directories which match these patterns
        //                  ],
        //                  "ignore": [ // Ignore errors and warnings
        //                      // "E501",  // Line too long (82 > 79 characters)
        //                  ],
        //                  // "maxLineLength": 80,  // Set maximum allowed line length
        //              },
        //              "pydocstyle": {
        //                  "enabled": false,
        //              },
        //              "pyflakes": {
        //                  "enabled": true,
        //              },
        //              "pylint": {
        //                  "enabled": false,
        //              },
        //              "yapf": {
        //                  "enabled": true,
        //              },
        //              // pyls' 3rd Party Plugins, Mypy type checking for Python 3, Must be installed via pip before enabling
        //              "pyls_mypy": { // Install with: pip install pyls-mypy
        //                  "enabled": false,
        //                  "live_mode": true,
        //              },
        //          },
        //      },
        //  },
        // },
        "rls": {
            "command": [

I now get this error(I will look at ways on how to fix those issues): image

I also don't know if this line here will cause any problems,

    @classmethod
    def pip_exe(cls) -> str:
        return os.path.join(cls.bindir(), "pip")  # <---

I have pip3 on my system but I don't have pip in the $PATH.

rwols commented 4 years ago

That line is fine. It is the pip executable from a virtual environment. The virtual environment is created with python3 -m venv LSP-pyls. Looks like you don’t have the venv module installed? I thought that came standard with python 🤔

predragnikolic commented 4 years ago

Looks like you don’t have the venv module installed?

So you were right. I have installed virtualenv. and I changed this line:

- cls.run(cls.python_exe(), "-m", "venv", "LSP-pyls", cwd=sublime.cache_path())
+ cls.run("virtualenv", "-p", "python3", "LSP-pyls", cwd=sublime.cache_path())

And it worked.

rwols commented 4 years ago

If you're using Ubuntu or Debian, you might need to install the python3-venv package with apt.

rwols commented 4 years ago

I've updated the readme to include a remark to install python3-venv.