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

No Python Module Detected #36

Open
jacobseiler opened this issue Dec 17, 2019 · 8 comments
Open

No Python Module Detected #36

jacobseiler opened this issue Dec 17, 2019 · 8 comments

Comments

@jacobseiler
Copy link

Hi there,

I am getting the error No isort python module detected, you should install it. More info at https://github.com/fisadev/vim-isort when trying to execute isort within Vim. Isort has correctly been pip installed:

$ which isort
/Library/Frameworks/Python.framework/Versions/3.8/bin/isort

and isort example.py indeed does sort the imports.

Vim version is 8.1.

(Searched previous issues and none of the solutions worked. I have pip installed isort through both python3.8 and 2.7).

@ajslater
Copy link

Also occurs with NVIM v0.4.3

@Integralist
Copy link

Yup I'm getting this.

I had installed isort with pipx (which uses the same python3 interpreter that vim was built with) but I also tried setting up a virtual environment using python3 -m venv foo and activating it and installing isort using normal pip command but the plugin still thinks it can't find isort.

In the end I uninstalled the plugin and just added the following to my vim file:

autocmd BufWritePost *.py :!isort %

@ajslater
Copy link

ajslater commented Jan 27, 2020

For a homebrew install, remove roxma/python-support module and it will work again.

The issue appears to be the roxma/python-support module b0rking up the sys.path and removing the

/usr/local/lib/python3.7/site-packages

More sophisticated plugins, like black get around this by the plugin itself installing their dependancies in venvs and appending their special install path to sys.path on plugin load.

@fx-kirin
Copy link

I think this is related to using pyenv. Isort plugin seems to use system python on startup.

kdeldycke added a commit to kdeldycke/dotfiles that referenced this issue Apr 5, 2020
@zsoobhan
Copy link

zsoobhan commented May 26, 2020

I had a similar issue which vim-sort could not find isort even though it was installed globally and in the virtualenv.

I had to find the actual python binary vim was using and install it in there.

  1. in vim
    :py3 import sys; print(sys.path)

  2. navigate to that location and find the python binary, in my case:
    cd /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/bin

  3. install isort using this binary
    ./python3.8 -m pip install isort

I am using pyenv and virtualenv which may have messed up my paths and for some reason vim-isort could not find the "correct" python version when using :py3 on the following line

let s:available_short_python = ':py3'

@johangp
Copy link

johangp commented Jul 12, 2021

I had the same issue that @zsoobhan described above but that solution didn't work for me because even the command :py3 was not working.

I manage it installing the neovim package into the virtualenv

pip install neovim

@adraper2
Copy link

On Mac M1, I was also getting this issue. This was my solution.

Check to see if under:

vim --version

python & python3 have + instead of -.
If they have the -, just run:

brew install vim

@aarchiba
Copy link

I am running into this - I have neovim using its own virtualenv, which has isort installed. I can do :py3 import isort but if I run :Isort I get No isort python module detected, you should install it. More info at https://github.com/fisadev/vim-isort. I have done the same thing with black and can confirm that neovim is picking up the black I installed in the virtualenv.

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

8 participants