Closed carlesoctav closed 8 months ago
Please let me know if that's resolved the issue. Thanks.
@jellydn I'm getting same error when running: :updateremoteplugin
Encountered ImportError loading plugin at /Users/kirchik/.local/share/nvim/lazy/CopilotChat.nvim/rplugin/python3/copilot-agent.py: cannot import name 'LiteralString' from 'typing' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/typing.py)
Traceback (most recent call last):
File "/Users/kirchik/Library/Python/3.9/lib/python/site-packages/pynvim/plugin/host.py", line 193, in _load
module = _handle_import(directory, name)
File "/Users/kirchik/Library/Python/3.9/lib/python/site-packages/pynvim/plugin/host.py", line 40, in _handle_import
return importlib.import_module(name)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
ImportError: cannot import name 'LiteralString' from 'typing' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/typing.py)
remote/host: python3 host registered plugins ['copilot-plugin.py']
remote/host: generated rplugin manifest: /Users/kirchik/.local/share/nvim/rplugin.vim
Hi @k-martynov, based on your log, it's the old version. We only have python3/copilot-agent.py
on main
branch. Could you share your config? You also find my config on readme. Thanks.
@jellydn here is my config:
{
"jellydn/CopilotChat.nvim",
dependencies = { "zbirenbaum/copilot.lua" },
opts = {
mode = "split",
debug = false,
prompts = {
Explain = "Explain how it works.",
Review = "Review the following code and provide concise suggestions.",
Tests = "Briefly explain how the selected code works, then generate unit tests.",
Refactor = "Refactor the code to improve clarity and readability.",
Spelling = "Please correct any grammar and spelling errors in the following text.",
Wording = "Please improve the grammar and wording of the following text.",
},
},
build = function()
vim.defer_fn(function()
vim.cmd("UpdateRemotePlugins")
vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
end, 3000)
end,
event = "VeryLazy",
keys = {
{ "<leader>cce", "<cmd>CopilotChatExplain<CR>", desc = "CopilotChat - Explain code" },
{ "<leader>cct", "<cmd>CopilotChatTests<CR>", desc = "CopilotChat - Generate tests" },
{ "<leader>ccr", "<cmd>CopilotChatReview<CR>", desc = "CopilotChat - Review code" },
{ "<leader>ccR", "<cmd>CopilotChatRefactor<CR>", desc = "CopilotChat - Refactor code" },
{ "<leader>ccS", "<cmd>CopilotChatSpelling<CR>", desc = "CopilotChat - Correct spelling" },
{ "<leader>ccw", "<cmd>CopilotChatWording<CR>", desc = "CopilotChat - Improve wording" },
},
},
After I've moved to canary(I've added to config branch = "canary"
) version I'm started getting this error:
Encountered ImportError loading plugin at /Users/kirchik/.local/share/nvim/lazy/CopilotChat.nvim/rplugin/python3/copilot-plugin.py: cannot import name 'Unpack' from 'typing' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/typing.py)
Traceback (most recent call last):
File "/Users/kirchik/Library/Python/3.9/lib/python/site-packages/pynvim/plugin/host.py", line 193, in _load
module = _handle_import(directory, name)
File "/Users/kirchik/Library/Python/3.9/lib/python/site-packages/pynvim/plugin/host.py", line 40, in _handle_import
return importlib.import_module(name)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
ImportError: cannot import name 'Unpack' from 'typing' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/typing.py)
remote/host: python3 host registered plugins []
remote/host: generated rplugin manifest: /Users/kirchik/.local/share/nvim/rplugin.vim
Hello, there will be a tons of typing errors when using Python 3.10 (i try tweek the repo by my self). A more convenient solution is to install Python 3.12 using pyenv and set it as the global version, without compromising the pre-installed Python if you're using Ubuntu.
relevant link: https://webinstall.dev/pyenv/
@carlesoctav @jellydn thanks!
after updating to python 3.12 with pyenv and running again this line: pip install python-dotenv requests pynvim==0.5.0 prompt-toolkit
updateremoreplugins
went well
Describe the bug
Encountered ImportError loading plugin at /home/carlesoctav/.local/share/nvim/lazy/CopilotChat.nvim/rplugin/python3/copilot-plugin.py: cannot import name 'LiteralString' from 'typing' (/usr/lib/python3.10/typing.py) Traceback (most recent call last): File "/home/carlesoctav/.local/lib/python3.10/site-packages/pynvim/plugin/host.py", line 193, in _load module = _handle_import(directory, name) File "/home/carlesoctav/.local/lib/python3.10/site-packages/pynvim/plugin/host.py", line 40, in _handle_import return importlib.import_module(name) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
ImportError: cannot import name 'LiteralString' from 'typing' (/usr/lib/python3.10/typing.py)
remote/host: python3 host registered plugins [] remote/host: generated rplugin manifest: /home/carlesoctav/.local/share/nvim/rplugin.vim
Reproduction
Perform all the instructions outlined in the README document.
System Info
Used Package Manager
n/a
Validations