Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name 'vira' not defined #85

Open
sham332 opened this issue Mar 15, 2024 · 6 comments
Open

Name 'vira' not defined #85

sham332 opened this issue Mar 15, 2024 · 6 comments

Comments

@sham332
Copy link

sham332 commented Mar 15, 2024

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
Copy link
Owner

n0v1c3 commented Mar 15, 2024

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
Copy link
Author

sham332 commented Mar 15, 2024

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
Copy link
Collaborator

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
Copy link
Author

sham332 commented Mar 17, 2024

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
Copy link
Collaborator

@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
Copy link
Author

sham332 commented Mar 17, 2024

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

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants