wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.72k stars 263 forks source link

Failed to install hererocks #1266

Open myste1tainn opened 4 months ago

myste1tainn commented 4 months ago

Run :checkhealth for more info

- `git --version`:

git version 2.39.3 (Apple Git-145)

- Operating system/version:

macOS Sonoma 14.2.1

- Terminal name/version:

kitty 0.26.5 created by Kovid Goyal


### Steps to reproduce
1. Setup plugins.lua file like
```lua
local packer = require('packer')
local packer_luarocks = require('packer.luarocks')

packer.init({
  luarocks = {
    python_cmd = 'python3'
  },
  profile = {
    enable = false,
    theshold = 1,
  },
  log = { level = 'warn' },
})

packer_luarocks.install_commands()
packer_luarocks.install_hererocks()()
packer_luarocks.setup_paths()

local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
  --vim.cmd [[packadd packer.nvim]]
  packer_bootstrap = fn.system({ 'git',
    'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
end

local use_rocks = packer.use_rocks

return packer.startup(function(use)
  use_rocks { 'rxlua' }
end)
  1. Run :PackerSync

Actual behaviour

Found error `Failed to install hererocks'

Expected behaviour

Able to install hererocks and the luarocks dependencies

packer files

-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
--

local packer = require('packer')
local packer_luarocks = require('packer.luarocks')

packer.init({
  luarocks = {
    python_cmd = 'python3'
  },
  profile = {
    enable = false,
    theshold = 1,
  },
  log = { level = 'warn' },
})

packer_luarocks.install_commands()
packer_luarocks.install_hererocks()()
packer_luarocks.setup_paths()

local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
  --vim.cmd [[packadd packer.nvim]]
  packer_bootstrap = fn.system({ 'git',
    'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
end

local use_rocks = packer.use_rocks

return packer.startup(function(use)
  use_rocks { 'rxlua' }
  use { '~/Sources/neovim-plugins/ui.nvim' }
  use { 'ElPiloto/significant.nvim' }
  use { 'wbthomason/packer.nvim' }
  use { 'shougo/deoplete.nvim' }

  -- LSP setup for flutter
  use { 'akinsho/flutter-tools.nvim', requires = 'nvim-lua/plenary.nvim' }

  -- LspSasga, using the one from tami5 cuz it's maintain and has more functions
  --use { 'glepnir/lspsaga.nvim' }
  use { 'tami5/lspsaga.nvim' }

  use { 'nvim-lua/plenary.nvim' }
  use { 'nvim-lua/popup.nvim' }

  -- Files navigation
  use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
  use {
    'nvim-telescope/telescope.nvim',
    requires = {
      { "nvim-telescope/telescope-live-grep-args.nvim" },
      { "nvim-telescope/telescope-dap.nvim" }
    }
  }

  -- Specifically for Dart formatting
  use {
    "dart-lang/dart-vim-plugin"
  }

  -- Mason for LSP & DAP mgt.
  use {
    "williamboman/mason.nvim",
    "williamboman/mason-lspconfig.nvim",
    "williamboman/nvim-lsp-installer",
    {
      "neovim/nvim-lspconfig",
      after = "nvim-lsp-installer",
      config = function()
        require("nvim-lsp-installer").setup {}
        -- mason and the mason-lspconfig setup order (strict order, don't swap)
        require("mason").setup()
        require("mason-lspconfig").setup {
          -- NOTE: sourcekit server is not available in mason
          --  ensure_installed = {
          "lua_ls",
          "dartls",
          "angularls",
          "bashls",
          -- "shfmt",
          "cssls",
          "cssmodules_ls",
          "dockerls",
          "dotls",
          "eslint",
          "gopls",
          "groovyls",
          "html",
          "jdtls",
          "jsonls",
          "lemminx",
          "tsserver",
          "vimls",
          "yamlls"
        }
        require("user.lsp.lsp")
        require("user.lsp.lsp-servers-autoconfig") -- This is where i've stored most of the `require("lspconfig").{lang_ls_name}.setup{}`
      end
    },
    run = ":MasonUpdate" -- :MasonUpdate updates registry contents
  }

  -- Formatter
  use {
    'mhartington/formatter.nvim',
    'jose-elias-alvarez/null-ls.nvim'
  }

  -- Formerly used this for completion
  -- use { 'hrsh7th/nvim-compe' }

  -- main
  use { 'neoclide/coc.nvim', branch = 'release' }
  -- snippets packages for coc.nvim, alongside usage, not dependencies
  use { 'SirVer/ultisnips' }
  use { 'honza/vim-snippets' }
  use { 'neoclide/coc-snippets' }

  -- main
  --use { 'ms-jpq/coq_nvim', branch = 'coq' }
  -- 9000+ snippets
  --use { 'ms-jpq/coq.artifacts', branch = 'artifacts' }
  -- Utils
  -- - shell repl
  -- - nvim lua api
  -- - scientific calculator
  -- - comment banner
  -- - etc
  --use { 'ms-jpq/coq.thirdparty', branch = '3p' }

  use { 'nvim-treesitter/nvim-treesitter', run = ":TSUpdate" }
  use { 'nvim-treesitter/nvim-treesitter-textobjects' }
  use { 'kyazdani42/nvim-web-devicons' }

  use { 'norcalli/nvim-terminal.lua' }

  -- DAP for deebugging
  use 'jbyuki/one-small-step-for-vimkind'
  use 'mfussenegger/nvim-dap'
  use 'rcarriga/nvim-dap-ui'
  use 'theHamsta/nvim-dap-virtual-text'

  -- Go IDE
  use 'ray-x/go.nvim'
  use 'ray-x/guihua.lua'

  -- Java IDE
  use 'mfussenegger/nvim-jdtls'
  -- Status line
  use {
    'glepnir/galaxyline.nvim',
    branch = 'main',
    -- your statusline
    -- some optional icons
    requires = { 'kyazdani42/nvim-web-devicons', opt = true }
  }

  -- Util
  use 'famiu/nvim-reload'

  -- UI for nvim
  use 'mjlbach/neovim-ui'
  use 'mfussenegger/nvim-lua-debugger'

  -- Auto tagging for HTML & TSX
  use 'windwp/nvim-ts-autotag'
  -- Auto pairings for multiple char e.g. Single Quote
  use 'windwp/nvim-autopairs'

  -- inlay hints
  use 'lvimuser/lsp-inlayhints.nvim'

  if packer_bootstrap then
    require('packer').sync()
  end
end)

Since the installation failed, I've dug into the luarocks.lua a bit and found the line which composed the `hererocks' installation command like so

python3 /Users/arnon.keereena/.cache/nvim/packer_hererocks/hererocks.py --verbose -j 2.1.1696795921 -r latest /Users/arnon.keereena/.cache/nvim/packer_hererocks/2.1.1696795921

which returns the results like

Error: bad LuaJIT version 2.1.1696795921

But then after some googling certain user is using the Neovim of 0.5 and Luajit of the 2.3.0-beta3, so I tried changing the command like so

python3 /Users/arnon.keereena/.cache/nvim/packer_hererocks/hererocks.py --verbose -j 2.1.0-beta3 -r latest /Users/arnon.keereena/.cache/nvim/packer_hererocks/2.1.1696795921

Now the installation pass (manually)

After that I went into the Neovim again, now I am able to install the luarocks package as normal. Not sure if there a compatibility problem with the Luajit and what not. But this is what I've found and circumvent so far.

sanchayanghosh commented 4 months ago

The issue happens here because Starting from 2.1.x LuaJIT is a rolling release. So those numbers we see are not release numbers, but just incremental rolling counters. It just means LuaJIT gets updated as soon as the master branch updates. But the hererocks python file still hasn't been updated to support rolling releases.

We would need to fix this on both ends, in the hererocks.py file that luarocks uses (that is a fork since the original project by mpeterv is no longer maintained), and in packer.nvim (just for passing the argument)

sanchayanghosh commented 1 month ago

Fix is already present in hererocks. They are using the rolling21 switch when installing through hererocks. Appliying the command here.

Fix is:

If we detect numbers corresponding to a rolling release. We will provide the rolling21 switch in the command line.