packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

Hererocks installation silently hangs if the default python command doesn't exist

Open babelfish opened this issue 2 years ago • 4 comments

  • nvim --version: 0.7.0
  • git --version: 2.25.1
  • Operating system/version: Pengwin/Debian 10
  • Terminal name/version: Windows Terminal 1.12.10983.0

Steps to reproduce

In an installation that does not already have hererocks installed, attempt to install any rocks package without the python command available. I have both python 2 and 3 installed, but only available as python2 and python3.

Actual behaviour

Packer hangs indefinitely on "installing hererocks" with no log messages. I was only able to figure out what was going on by reading the packer source and manually trying to run the hererocks command it was trying to run.

Expected behaviour

The installation should fail and provide an error message.

packer files

Plugin specification file(s)

Simplified version with only the relevant info:

local packer = require('packer')
local use, use_rocks = packer.use, packer.use_rocks

packer.reset()
packer.init{
  log = { level = 'trace' },
  --luarocks = { python_cmd = 'python3' }
}


-- Lua packages
use_rocks 'luafilesystem'
packer log file
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963620372526e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:528: packer.sync: requiring modules
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963620561182e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:324: Processing plugin specs
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.496362106793e+14] ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:176: Updating FS state
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637904433e+14] ...nvim/pack/packer/start/packer.nvim/lua/packer/update.lua:56: Fixing plugin types
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637911972e+14] ...nvim/pack/packer/start/packer.nvim/lua/packer/update.lua:67: Done fixing plugin types
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637915653e+14] .../nvim/pack/packer/start/packer.nvim/lua/packer/clean.lua:22: Starting clean
[INFO  Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637936673e+14] .../nvim/pack/packer/start/packer.nvim/lua/packer/clean.lua:82: Already clean!
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637957855e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:558: Gathering install tasks
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963637962773e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:561: Gathering update tasks
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963641781606e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:565: Gathering luarocks tasks
[DEBUG Sun 24 Apr 2022 07:04:22 PM EDT 4.4963641787976e+14] ...config/nvim/pack/packer/start/packer.nvim/lua/packer.lua:578: Running tasks
packer compiled file
-- Automatically generated packer.nvim plugin loader code

if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
  vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
  return
end

vim.api.nvim_command('packadd packer.nvim')

local no_errors, error_msg = pcall(function()

  local time
  local profile_info
  local should_profile = false
  if should_profile then
    local hrtime = vim.loop.hrtime
    profile_info = {}
    time = function(chunk, start)
      if start then
        profile_info[chunk] = hrtime()
      else
        profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
      end
    end
  else
    time = function(chunk, start) end
  end
  
local function save_profiles(threshold)
  local sorted_times = {}
  for chunk_name, time_taken in pairs(profile_info) do
    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
  end
  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
  local results = {}
  for i, elem in ipairs(sorted_times) do
    if not threshold or threshold and elem[2] > threshold then
      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
    end
  end

  _G._packer = _G._packer or {}
  _G._packer.profile_output = results
end

time([[Luarocks path setup]], true)
local package_path_str = "/home/bsmith/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/bsmith/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/bsmith/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/bsmith/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/bsmith/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
  package.path = package.path .. ';' .. package_path_str
end

if not string.find(package.cpath, install_cpath_pattern, 1, true) then
  package.cpath = package.cpath .. ';' .. install_cpath_pattern
end

time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
  local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
  if not success then
    vim.schedule(function()
      vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
    end)
  end
  return result
end

time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
  DidYouMean = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/DidYouMean",
    url = "https://github.com/EinfachToll/DidYouMean"
  },
  MatchTagAlways = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/MatchTagAlways",
    url = "https://github.com/Valloric/MatchTagAlways"
  },
  ale = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ale",
    url = "https://github.com/w0rp/ale"
  },
  ["auto-pairs"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/auto-pairs",
    url = "https://github.com/jiangmiao/auto-pairs"
  },
  ["base16-vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/base16-vim",
    url = "https://github.com/chriskempson/base16-vim"
  },
  ["bash-support.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/bash-support.vim",
    url = "https://github.com/vim-scripts/bash-support.vim"
  },
  ["caw.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/caw.vim",
    url = "https://github.com/tyru/caw.vim"
  },
  ["context_filetype.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/context_filetype.vim",
    url = "https://github.com/Shougo/context_filetype.vim"
  },
  csapprox = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/csapprox",
    url = "https://github.com/godlygeek/csapprox"
  },
  fzf = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/fzf",
    url = "https://github.com/junegunn/fzf"
  },
  ["fzf.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/fzf.vim",
    url = "https://github.com/junegunn/fzf.vim"
  },
  ["html5.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/html5.vim",
    url = "https://github.com/othree/html5.vim"
  },
  indentLine = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/indentLine",
    url = "https://github.com/Yggdroot/indentLine"
  },
  ncm2 = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2",
    url = "https://github.com/ncm2/ncm2"
  },
  ["ncm2-bufword"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2-bufword",
    url = "https://github.com/ncm2/ncm2-bufword"
  },
  ["ncm2-path"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2-path",
    url = "https://github.com/ncm2/ncm2-path"
  },
  ["ncm2-racer"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2-racer",
    url = "https://github.com/ncm2/ncm2-racer"
  },
  ["ncm2-syntax"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2-syntax",
    url = "https://github.com/ncm2/ncm2-syntax"
  },
  ["ncm2-ultisnips"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ncm2-ultisnips",
    url = "https://github.com/ncm2/ncm2-ultisnips"
  },
  ["neco-syntax"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/neco-syntax",
    url = "https://github.com/Shougo/neco-syntax"
  },
  nerdtree = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/nerdtree",
    url = "https://github.com/scrooloose/nerdtree"
  },
  ["nerdtree-git-plugin"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/nerdtree-git-plugin",
    url = "https://github.com/Xuyuanp/nerdtree-git-plugin"
  },
  ["nvim-yarp"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/nvim-yarp",
    url = "https://github.com/roxma/nvim-yarp"
  },
  ["packer.nvim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/packer.nvim",
    url = "https://github.com/wbthomason/packer.nvim"
  },
  ["rainbow_parentheses.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/rainbow_parentheses.vim",
    url = "https://github.com/kien/rainbow_parentheses.vim"
  },
  ["rust.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/rust.vim",
    url = "https://github.com/rust-lang/rust.vim"
  },
  ["scss-syntax.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/scss-syntax.vim",
    url = "https://github.com/cakebaker/scss-syntax.vim"
  },
  supertab = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/supertab",
    url = "https://github.com/ervandew/supertab"
  },
  ["tabline.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/tabline.vim",
    url = "https://github.com/mkitt/tabline.vim"
  },
  tabular = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/tabular",
    url = "https://github.com/godlygeek/tabular"
  },
  ["targets.vim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/targets.vim",
    url = "https://github.com/wellle/targets.vim"
  },
  ultisnips = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/ultisnips",
    url = "https://github.com/SirVer/ultisnips"
  },
  undotree = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/undotree",
    url = "https://github.com/mbbill/undotree"
  },
  ["vim-airline"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-airline",
    url = "https://github.com/vim-airline/vim-airline"
  },
  ["vim-airline-themes"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-airline-themes",
    url = "https://github.com/vim-airline/vim-airline-themes"
  },
  ["vim-colorschemes"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-colorschemes",
    url = "https://github.com/flazz/vim-colorschemes"
  },
  ["vim-css3-syntax"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-css3-syntax",
    url = "https://github.com/hail2u/vim-css3-syntax"
  },
  ["vim-dispatch"] = {
    commands = { "Dispatch", "Make", "Focus", "Start" },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/opt/vim-dispatch",
    url = "https://github.com/tpope/vim-dispatch"
  },
  ["vim-endwise"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-endwise",
    url = "https://github.com/tpope/vim-endwise"
  },
  ["vim-fugitive"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-fugitive",
    url = "https://github.com/tpope/vim-fugitive"
  },
  ["vim-gitgutter"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-gitgutter",
    url = "https://github.com/airblade/vim-gitgutter"
  },
  ["vim-go"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-go",
    url = "https://github.com/fatih/vim-go"
  },
  ["vim-html-template-literals"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-html-template-literals",
    url = "https://github.com/jonsmithers/vim-html-template-literals"
  },
  ["vim-indent-guides"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-indent-guides",
    url = "https://github.com/nathanaelkane/vim-indent-guides"
  },
  ["vim-indent-object"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-indent-object",
    url = "https://github.com/michaeljsmith/vim-indent-object"
  },
  ["vim-indexed-search"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-indexed-search",
    url = "https://github.com/henrik/vim-indexed-search"
  },
  ["vim-javascript"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-javascript",
    url = "https://github.com/pangloss/vim-javascript"
  },
  ["vim-openapi"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-openapi",
    url = "https://github.com/hsanson/vim-openapi"
  },
  ["vim-pug"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-pug",
    url = "https://github.com/digitaltoad/vim-pug"
  },
  ["vim-racer"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-racer",
    url = "https://github.com/racer-rust/vim-racer"
  },
  ["vim-ragtag"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-ragtag",
    url = "https://github.com/tpope/vim-ragtag"
  },
  ["vim-rails"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-rails",
    url = "https://github.com/tpope/vim-rails"
  },
  ["vim-ruby"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-ruby",
    url = "https://github.com/vim-ruby/vim-ruby"
  },
  ["vim-slim"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-slim",
    url = "https://github.com/slim-template/vim-slim"
  },
  ["vim-surround"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-surround",
    url = "https://github.com/tpope/vim-surround"
  },
  ["vim-textobj-user"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-textobj-user",
    url = "https://github.com/kana/vim-textobj-user"
  },
  ["vim-toml"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-toml",
    url = "https://github.com/cespare/vim-toml"
  },
  ["vim-vue"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-vue",
    url = "https://github.com/posva/vim-vue"
  },
  ["vim-wordmotion"] = {
    loaded = true,
    path = "/home/bsmith/.local/share/nvim/site/pack/packer/start/vim-wordmotion",
    url = "https://github.com/chaoren/vim-wordmotion"
  }
}

time([[Defining packer_plugins]], false)

-- Command lazy-loads
time([[Defining lazy-load commands]], true)
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Start lua require("packer.load")({'vim-dispatch'}, { cmd = "Start", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Dispatch lua require("packer.load")({'vim-dispatch'}, { cmd = "Dispatch", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Make lua require("packer.load")({'vim-dispatch'}, { cmd = "Make", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Focus lua require("packer.load")({'vim-dispatch'}, { cmd = "Focus", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
time([[Defining lazy-load commands]], false)

if should_profile then save_profiles() end

end)

if not no_errors then
  error_msg = error_msg:gsub('"', '\\"')
  vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

babelfish avatar Apr 24 '22 23:04 babelfish

Fish shell user. Got the same issue. Tried creating a Fish function to forward arguments to python to python3 but didn't work. Checked the directory created under .cache/nvim and saw that the hererocks.py was being downloaded. Executed python3 against the arguments normally passed to python within the source script luarocks.lua and successfully compiled and installed LuaJit. Restarted nvim and ran PackerSync, everything now worked and I was able to install the moonscript rock as a dependency for nvim-moonmaker

bnwa avatar Jun 01 '22 19:06 bnwa

Also, setting the python_cmd to python3 doesn't solve, but cd'ing to the hererocks dir Packer creates and calling python3 hererocks_file.py does work

bnwa avatar Jun 01 '22 21:06 bnwa

On MacOS, I had to do:

ln -s /usr/local/bin/python3 /usr/local/bin/python

YodaEmbedding avatar Jul 03 '22 00:07 YodaEmbedding

Thank you for posting this! I was going crazy trying to figure out why this was hanging on my machine

dnsbty avatar Dec 12 '22 22:12 dnsbty

ln -s /usr/local/bin/python3 /usr/local/bin/python

If installed via homebrew

sudo ln -s /opt/homebrew/bin/python3 /usr/local/bin/python

Edit: This is for Apple Silicon macs.

Better do, which python3, note where it is installed and symlink to any directory in path.

aasutossh avatar Jan 09 '23 03:01 aasutossh