packer.nvim
packer.nvim copied to clipboard
Luarocks fails to install on macOS BigSur
Just tried out my config (which I recently added a rock to) on my work mac (running BigSur not sure if that matters) and found that although the same install process seems to happen to setup luarocks via packer, the install process appears to finish but I don't think luarocks is correctly installed since further calls to install try to install luarocks again. The rock I also specified (penlight
) is also not installed.
Yeah, that's https://github.com/nvim-lua/plenary.nvim/issues/4 (and the same fix - setting env var MACOSX_DEPLOYMENT_TARGET to 10.15 - works to fix it). I'm considering setting that env var by default in packer
, but I want to know how that value was found first, so I can have confidence I won't cause more problems by setting it.
Note that you only need to set that variable once when you install the first rock (because that's when hererocks
builds luajit
, which requires the flag to build correctly). Once luajit
is installed (locally), using rocks (and adding further rocks if they don't need a complicated build) works fine without it.
So doing this manually with MACOSX_DEPLOYMENT_TARGET=10.15 nvim
and then calling PackerSync
once should suffice (until you wipe the cache directory).
@wbthomason that resolved the issue for me, I'm happy to close this or otherwise leave it here so you can track against doing something automagically for users or maybe to track against documenting the fix if not, whatever you prefer.
Might be good to leave open (and pin?) for now, at least until the Readme is finalized with such instructions?
Hi, I am having trouble running PackerSync I think it is related to this issue since it fails to spawn a plenary.nvim process and I am running macOS BigSur with the m1 chip.
Any ideas on how to solve this issue?
Error executing vim.schedule lua callback: .../site/pack/packer/start/plenary.nv
im/lua/plenary/job.lua:374: Failed to spawn process...
stack traceback:
.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:374: in func
tion '_execute'
.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:417: in func
tion 'start'
...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:77: in funct
ion 'run_job'
...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:204: in func
tion 'ret'
...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:59: in funct
ion 'step'
...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:62: in funct
ion <...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:49>
...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:70: in funct
ion 'cb'
vim.lua:243: in function <vim.lua:243>
NVIM v0.5.0-dev+nightly-17-gcc1851c9f
Build type: Release
LuaJIT 2.1.0-beta3
@mherna: this error occurs when you run PackerSync
? I'm a bit confused, as packer
doesn't use plenary
at all, and your stack trace seems to point to an issue in plenary
.
@wbthomason, thanks for the reply. I reinstalled neovim, and the issue got solved. Weirdly it was happening just when I ran PackerSync
, which led me to believed it had something to with packer
, but good to know that packer
doesn't use plenary
for future reference.
@mherna Did you only reinstall neovim or did you also clean any packer packages in $HOME/.local/share/nvim/site/pack/start
$HOME/.local/share/nvim/site/pack/opt
?
@matu3ba I cleaned$HOME/.local/share/nvim/site/pack/start
and $HOME/.local/share/nvim/site/pack/opt
@wbthomason I feel like "clean $HOME/.local/share/nvim/site/pack/start and $HOME/.local/share/nvim/site/pack/opt" belongs to the FAQ. The alternative is to have logging+instructions, if you want to investigate further.
Notes from discussion with @clason on Gitter/Matrix:
- The default for
python_cmd
is wrong on macOS; should bepython3
- We should set the env var that fixes this problem by default (at least on macOS)
-
packer
may think that thehererocks
install job succeeds even when it fails. Need to figure out why
I think I'm getting something related to this:
Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:10: attempt to index local 'plugin' (a nil value)
Please check your config for correctness
As far as I can tell, the hererocks
installation craps out at some point but without an error. (I'm guessing, since I don't have a packer_hererocks
directory in ~/.cache/nvim)
The PackerSync
trick with MACOSX_DEPLOYMENT_TARGET
doesn't seem to work for me, though 😞 Is there a way to manually install hererocks in that directory to at least have a temporary fix?
@garymh Your error message doesn't seem obviously related to luarocks
. What makes you think the problem lies there rather than with a config or compiled file issue?
@wbthomason I guess it could be something different- I'm just using a very slimmed down packer setup and still getting it. The only thing I could pick out that looked off from my packer compiled file was the luarocks path.
Here is my packer loading code:
local packer = nil
local function init()
if packer == nil then
packer = require('packer')
util = require("packer/util")
packer.init({
compile_path = util.join_paths(vim.fn.stdpath("config"),
"vimscript", "packer_compiled.vim"),
max_jobs = 10
})
end
local use = packer.use
packer.reset()
use {"wbthomason/packer.nvim", opt = true}
use {
"AndrewRadev/switch.vim",
cmd = {"Switch", "SwitchReverse"},
config = function()
vim.g.switch_custom_definitions =
{
{"assert", "refute"}, {"if", "unless"}, {"[ ]", "[x]"},
{"yes", "no"}, {"let g:", "vim.g."}
}
end
}
end
local plugins = setmetatable({}, {
__index = function(_, key)
init()
return packer[key]
end
})
return plugins
The error message comes up when I use the :Switch
command. It seems to work fine when not lazy-loaded... maybe it's a problem with that?
Yeah - it seems to be something with lazy loading? 🤷 I removed all the keys
and cmd
triggers from my packer loading code and everything seems to be working... 🤔
I had this issue on linux. For me, the issue was that the python_cmd
default is python
, whereas my python executable is named python3
. Switching it to python3
allows things to install correctly.
There was no error on my end though, even though things weren't working. The hererocks install just went infinitely.
@jacksonludwig: Thanks for the report. Could you please start a new issue with the contents of ~/.cache/nvim/packer.nvim.log
? I suspect that we're missing an early return in the hererocks install function.
I just set my python_cmd
back to the default to try to make the error happen again but it did not. Is there some sort of cache or something? I don't know why it would suddenly not hang with the wrong python_cmd
If you already have Luarocks installed via hererocks
, packer
won't try to reinstall it. Using hererocks
should be the only place that we use python_cmd
.
You can add vim.fn.setenv("MACOSX_DEPLOYMENT_TARGET", "10.15")
on top of your plugins.lua
Which is proper solution here? Setting up python3
in config.luarocks.python_cmd
or MACOSX_DEPLOYMENT_TARGET
?
The environment variable is the easiest fix. Note that it is only needed to be set the very first time you install something for the luarocks
installation itself; adding more rocks after it will work fine without it.
Thanks @clason, will add what Folke posted above. I do understand importance of it on initial install only, want to have it in my dots for fresh installations anyway. Thanks guys!
🤔 still facing the same issue ✗ Failed to install package
tried to a number of stuff but no luck, I tired both MACOSX_DEPLOYMENT_TARGET
and setting python command.
You can add
vim.fn.setenv("MACOSX_DEPLOYMENT_TARGET", "10.15")
on top of yourplugins.lua
This works for me. Cheers!
NOTE: Use your own Mac version. I had MACOSX_DEPLOYMENT_TARGET=12.3.1
!
# Possibly optional.
ln -s /usr/local/bin/python3 /usr/local/bin/python
# Start from scratch.
rm -rf ~/.cache/nvim
nvim
:lua vim.fn.setenv("MACOSX_DEPLOYMENT_TARGET", "10.15")
:PackerSync
:qa!
# If the above fails, install manually:
export MACOSX_DEPLOYMENT_TARGET=10.15
cd ~/.cache/nvim/packer_hererocks
rm -rf 2.1.0-beta3
python3 hererocks.py -j "2.1.0-beta3" "2.1.0-beta3"
# Reattempt:
nvim
:PackerSync
:qa!
EDIT: The :PackerSync
indicates that a rock fzy
was installed, but importing it still fails... So I had to do some unholy hackery to force lua 5.1 which somehow was then using lua 5.4, and so I sinned and symlinked them:
# Pretend that Lua 5.1 is LuaJIT 2.1.0-beta3:
export MACOSX_DEPLOYMENT_TARGET=10.15
cd ~/.cache/nvim/packer_hererocks
rm -rf 2.1.0-beta3
python3 hererocks.py -l "5.1" "2.1.0-beta3"
# Install rock (e.g. fzy):
nvim
:PackerSync
:qa!
# Pretend 5.4 is 5.1 is 2.1.0-beta3:
ln -s ~/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.4 \
~/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1
# Repent:
echo "Father, I repent."