n0v1c3 / vira

Create and update your Jira issues while inside Vim!
MIT License
94 stars 12 forks source link

Name 'vira' not defined #85

Open sham332 opened 5 months ago

sham332 commented 5 months ago

I am trying to setup this plugin with vim on macbook. It is throwing below error. Any idea how to fix this?

Error detected while processing function vira#_menu: line 35: Traceback (most recent call last): File "", line 1, in NameError: name 'Vira' is not defined

My Vimrc settings is as below

call plug#begin() Plug 'preservim/NERDTree' Plug 'n0v1c3/vira', { 'do': './install.sh' } call plug#end() let g:vira_config_file_servers = $HOME . '~/.config/vira/vira_servers.json'

Python on terminal is using

➜ ~ which python /Users//.pyenv/shims/python ➜ ~ python --version Python 3.9.1

Vim is from brew install

which vim /usr/local/bin/vim

n0v1c3 commented 5 months ago

Hello @sham332 two quick questions; is this quite a new setup of vim with a clean install of python or/and do you have $HOME~?

For the second one try removing one of the variables $HOME or ~. The path you have should be the default and not required for you to set.

The first question may lead to some new python updates that I have just really noticed and it doesn't let you install plugins unless in a virtual python environment. I have done a test with this including in the code but it would need to be made clean to push. Try to manually install the jira plugin for your python outside of vim and this will show you if it is allowed.

sham332 commented 5 months ago

Tried the suggestion to remove $HOME and it gives same error. Also I had installed Jira plugin manually and it is present ➜ ~ pip list | grep jira jira 3.6.0

I suspect the python that is running in Vim is not somehow finding this library

mikeboiko commented 5 months ago

I had this issue on a mac before. You can see which version of python is being used in within vim by running py print(sys.executable). I'm on Linux now and my output is /usr/bin/python.

Then you can install the vira requirements using the absolute python path:

/usr/bin/python -m pip install -r ~/.vim/plugged/vira/requirements.txt
sham332 commented 5 months ago

Thanks @mikeboiko . I tired what you suggested. Got the python version inside vim by running this command !python -c "exec(\"import sys\nprint(sys.executable)\")"

And then did installation of the vira requirements and it still fails with same error /Users/test/.pyenv/versions/3.9.1/bin/python -m pip install -r ~/.vim/plugged/vira/requirements.txt

The vim from Mac isn't built using python and I had to install vim via brew.

mikeboiko commented 5 months ago

@sham332, ok just to confirm, now that you've installed the homebrew version of vim, you're seeing +python3 in the compilation flags?

This is what mine looks like:

╭─mike@asus ~
╰─➤  vim --version | grep python3
+cmdline_info      +libcall           +python3/dyn       +virtualedit

Secondly, you should run this command inside vim to check the python version: :py print(sys.executable). I'm pretty sure the command you ran, starting with !, is using your shell's python.

sham332 commented 5 months ago

I tried the aboved command before as well. It gives error saying command not avaliable

:py print(sys.executable)

error is `

E319: Sorry, the command is not available in this version

`