alexpasmantier / pymple.nvim

Refactor Python imports on file move/rename in Neovim
Apache License 2.0
68 stars 2 forks source link

PympleBuild keeps trying to install sed even though it's already installed #54

Open PyDataBlog opened 2 weeks ago

PyDataBlog commented 2 weeks ago

When running PympleBuild I encountered these errors with sed even though it's installed:

Here's the logs:

[INFO  Mon Oct  7 09:10:24 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:33: --------------------------------------------------------------
[INFO  Mon Oct  7 09:10:24 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:34: ---                   NEW PYMPLE SESSION                   ---
[INFO  Mon Oct  7 09:10:24 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:35: --------------------------------------------------------------
[INFO  Mon Oct  7 09:10:24 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:86: Found nvim-tree installation, hooking up events
[INFO  Mon Oct  7 09:10:24 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:92: Found oil installation, hooking up events
[INFO  Mon Oct  7 09:10:24 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:104: Found mini.files installation, hooking up events
[INFO  Mon Oct  7 09:10:24 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:61: Pymple setup complete
[INFO  Mon Oct  7 09:10:32 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing gg...
[INFO  Mon Oct  7 09:10:33 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: gg installed successfully
[INFO  Mon Oct  7 09:10:33 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing sed/gsed...
[ERROR Mon Oct  7 09:10:33 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:320: Failed to install sed. Try installing it manually.
[INFO  Mon Oct  7 09:11:14 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:33: --------------------------------------------------------------
[INFO  Mon Oct  7 09:11:14 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:34: ---                   NEW PYMPLE SESSION                   ---
[INFO  Mon Oct  7 09:11:14 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:35: --------------------------------------------------------------
[INFO  Mon Oct  7 09:11:14 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:86: Found nvim-tree installation, hooking up events
[INFO  Mon Oct  7 09:11:14 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:92: Found oil installation, hooking up events
[INFO  Mon Oct  7 09:11:14 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:104: Found mini.files installation, hooking up events
[INFO  Mon Oct  7 09:11:14 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:61: Pymple setup complete
[INFO  Mon Oct  7 09:11:21 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing gg...
[INFO  Mon Oct  7 09:11:21 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: gg installed successfully
[INFO  Mon Oct  7 09:11:21 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing sed/gsed...
[ERROR Mon Oct  7 09:11:21 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:320: Failed to install sed. Try installing it manually.
[INFO  Mon Oct  7 09:12:28 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:33: --------------------------------------------------------------
[INFO  Mon Oct  7 09:12:28 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:34: ---                   NEW PYMPLE SESSION                   ---
[INFO  Mon Oct  7 09:12:28 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:35: --------------------------------------------------------------
[INFO  Mon Oct  7 09:12:28 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:86: Found nvim-tree installation, hooking up events
[INFO  Mon Oct  7 09:12:28 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:92: Found oil installation, hooking up events
[INFO  Mon Oct  7 09:12:28 2024] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:104: Found mini.files installation, hooking up events
[INFO  Mon Oct  7 09:12:28 2024] ...r/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:61: Pymple setup complete

and the checkhealth report:


==============================================================================
pymple: require("pymple.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nui.object installed.
- OK nvim-web-devicons installed.
- OK dressing installed.
- OK telescope installed.

Checking external dependencies ~
- OK gg: found 0.5.4
- OK fd: found 10.2.0
- OK sed: found 4.8

It seems to have installed the hooks now. Any idea what is going on? BTW Thanks for this amazing idea. Exactly what was missing with python nvim integration

alexpasmantier commented 2 weeks ago

Hi, thanks for the feedback. Could you try setting the log level to debug, running that again and pasting the logs here? Will try looking into this asap.

PyDataBlog commented 2 weeks ago

Hi, thanks for the feedback. Could you try setting the log level to debug, running that again and pasting the logs here? Will try looking into this asap.

Unfortunately, any attempt to add anything to the setup option leads to this error:

   Error  10:00:57 notify.error lazy.nvim Failed to run `config` for pymple.nvim

...br/.local/share/nvim/lazy/pymple.nvim/lua/pymple/log.lua:140: attempt to index local 'fp' (a nil value)

# stacktrace:
  - /pymple.nvim/lua/pymple/log.lua:140 _in_ **info**
  - /pymple.nvim/lua/pymple/init.lua:33 _in_ **setup**
  - /pymple.nvim/lua/pymple/init.lua:60 _in_ **setup**
  - lua/custom/plugins/python/pymple-nvim.lua:13 _in_ **config**

I only get to the sed error if I disable setup options:

return {
    "alexpasmantier/pymple.nvim",
    ft = { "python", "markdown" },
    dependencies = {
        "nvim-lua/plenary.nvim",
        "MunifTanjim/nui.nvim",
        -- optional (nicer ui)
        "stevearc/dressing.nvim",
        "nvim-tree/nvim-web-devicons",
    },
    build = ":PympleBuild",
    config = function()
        require("pymple").setup({
            -- keymaps = {
            --  -- Resolves import for symbol under cursor.
            --  -- This will automatically find and add the corresponding import to
            --  -- the top of the file (below any existing doctsring)
            --  resolve_import_under_cursor = {
            --      desc = "Resolve import under cursor",
            --      keys = "<leader>li", -- feel free to change this to whatever you like
            --  },
            -- },
            -- update_imports = {
            --  -- the filetypes on which to run the update imports command
            --  -- NOTE: this should at least include "python" for the plugin to
            --  -- actually do anything useful
            --  filetypes = { "python", "markdown" },
            -- },
            -- -- options for the add import for symbol under cursor feature
            -- add_import_to_buf = {
            --  -- whether to autosave the buffer after adding the import (which will
            --  -- automatically format/sort the imports if you have on-save autocommands)
            --  autosave = true,
            -- },
            -- -- python options
            -- python = {
            --  -- the names of root markers to look out for when discovering a project
            --  root_markers = { "pyproject.toml", "setup.py", ".git", "manage.py" },
            --  -- the names of virtual environment folders to look out for when
            --  -- discovering a project
            --  virtual_env_names = { ".venv" },
            -- },
            -- -- logging options
            -- logging = {
            --  -- whether to log to the neovim console (only use this for debugging
            --  -- as it might quickly ruin your neovim experience)
            --  console = {
            --      enabled = false,
            --  },
            --  -- whether or not to log to a file (default location is nvim's
            --  -- stdpath("data")/pymple.vlog which will typically be at
            --  -- `~/.local/share/nvim/pymple.vlog` on unix systems)
            --  file = {
            --      enabled = true,
            --      -- the maximum number of lines to keep in the log file (pymple will
            --      -- automatically manage this for you so you don't have to worry about
            --      -- the log file getting too big)
            --      max_lines = 1000,
            --      path = "~/.local/share/nvim/pymple.vlog",
            --  },
            --  -- the log level to use
            --  -- (one of "trace", "debug", "info", "warn", "error", "fatal")
            --  level = "debug",
            -- },
        })
    end,
}
alexpasmantier commented 2 weeks ago

I'm guessing you're on a windows machine, and pymple currently only supports MacOS and Linux.

You can check https://github.com/alexpasmantier/pymple.nvim/issues/48 if you want to give it a try. Otherwise I might take the subject in the following week if I find the time to do so.

PyDataBlog commented 2 weeks ago

I'm guessing you're on a windows machine, and pymple currently only supports MacOS and Linux.

You can check #48 if you want to give it a try. Otherwise I might take the subject in the following week if I find the time to do so.

I am using WSL on Windows so it's running on Ubuntu 22.04. So shouldn't be an issue. sed is even installed already

mickalpine commented 2 weeks ago

edit: I uninstalled the plugin and reinstalled, closed neovim multiple times and the problem seemed to fix itself.

Then I had an issue with it not being able to find the fd binary. fix: ln -s $(which fdfind) ~/.local/bin/fd


I'm running Debian Sid and have the same issue.

[INFO  Mon 07 Oct 2024 08:56:29 AM EDT] ...n/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:34: ---                   NEW PYMPLE SESSION                   ---
[INFO  Mon 07 Oct 2024 08:56:29 AM EDT] ...n/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:35: --------------------------------------------------------------
[INFO  Mon 07 Oct 2024 08:56:29 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/hooks.lua:80: Found neo-tree installation, hooking up events
[INFO  Mon 07 Oct 2024 08:56:29 AM EDT] ...n/.local/share/nvim/lazy/pymple.nvim/lua/pymple/init.lua:61: Pymple setup complete
[INFO  Mon 07 Oct 2024 08:56:37 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing gg...
[INFO  Mon 07 Oct 2024 08:56:37 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: gg installed successfully
[INFO  Mon 07 Oct 2024 08:56:37 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing sed/gsed...
[ERROR Mon 07 Oct 2024 08:56:37 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:320: Failed to install sed. Try installing it manually.
[INFO  Mon 07 Oct 2024 08:57:09 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing gg...
[INFO  Mon 07 Oct 2024 08:57:09 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: gg installed successfully
[INFO  Mon 07 Oct 2024 08:57:09 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:328: Installing sed/gsed...
[ERROR Mon 07 Oct 2024 08:57:09 AM EDT] .../.local/share/nvim/lazy/pymple.nvim/lua/pymple/utils.lua:320: Failed to install sed. Try installing it manually.

config

return {
  {
    "alexpasmantier/pymple.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      -- optional (nicer ui)
      "stevearc/dressing.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    build = ":PympleBuild",
    opts = {
      keymaps = {
        resolve_import_under_cursor = {
          desc = "Resolve import under cursor",
          keys = "<leader>ci",
        },
      },
      logging = {
        level = "debug",
      },
    },
  },
}
alexpasmantier commented 2 weeks ago

I believe the problem comes from here which obviously needs to change in order to take into account various distributions and corresponding package managers.

In the meantime, I believe installing sed manually should work?

PyDataBlog commented 2 weeks ago

I believe the problem comes from here which obviously needs to change in order to take into account various distributions and corresponding package managers.

In the meantime, I believe installing sed manually should work?

Package works fine with the sed installed already so just the build error inconvenience.