Giter Club home page Giter Club logo

Comments (25)

chemzqm avatar chemzqm commented on September 23, 2024 14

Run :CocCommand python.setInterpreter to get current python, it could be not your current python in $PATH.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024 6

Now I can get completion from jedi by putting "python.pythonPath": "python3", in my coc-setting. Not sure why because I am on archlinux the default python is already python3. Is coc.nvim doing something special with conda or python's path?

Strangely enough, the MSLS engine no longer works...

from coc-python.

krisezra87 avatar krisezra87 commented on September 23, 2024 2

I see this is old and I stumbled here before as a new python programmer, but I will mention that another reason you can get this error is if jedi is not installed at all. You will need to pip install jedi (or alternate) if nothing else in here is useful.

Yes it's a noob problem, but sometimes you need the noob answer!

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024 1

You can use "python.jediPath" to specify folder of jedi module.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024 1

There's memos that remembers your global choice, you can clean it by rm ~/.config/coc/memos.json in your shell.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024 1

Is it possible to change the behavior so that it would automatically choose the python based on current $PATH?

It was fixed, checkout version of your coc-python.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024 1

It should use python from your current $PATH unless you have "python.pythonPath" changed or you used :CocCommand python.setInterpreter to configure python interpreter for current workspace folder.

Could be issue of wrong workspaceFolder, checkout https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders.

I can't reproduce your problem, you can checkout the log of coc.nvim https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024

It looks like problem of jedi version.
Checkout log of coc.nvim to get the error https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim

from coc-python.

randrej avatar randrej commented on September 23, 2024

Please write your results here, I'm having trouble with some Jedi versions, too, especially when working on projects involving PyQt5.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

After upgrading the package, the error disappears. But I still cannot get the completion in python. I check the log and I think the key part is

2019-04-25T13:42:02.988 ERROR (pid:5929) [extension-coc-python] - Python Extension: stderr jediProxy, Error (stderr) Traceback (most recent call last):
  File "completion.py", line 647, in <module>

2019-04-25T13:42:02.988 ERROR (pid:5929) [extension-coc-python] - Python Extension: stderr jediProxy, Error (stderr)     import jedi
ModuleNotFoundError: No module named 'jedi'

The full log is at https://bpaste.net/show/897e03d8fe53.

I can successfully execute import jedi in system python and vim's python3 import jedi.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

What is the default behavior when python.jediPath is empty? I don't want to set it as I sync my configuration file across different machines.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024

It's resolved from packages of your current selected python intepreter, checkout :h coc-status for status line integration.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

I add coc-status to my airline. It is not documented yet:

call airline#parts#define_function('coc_status', 'coc#status')
let g:airline_section_y = airline#section#create_right(['coc_status','ffenc'])

But that seems does not help this. I still do not understand why "python.pythonPath": "python3" works for me while "python.pythonPath": "python" yields No module named jedi. On my computer, I have

$ ls -al `which python3`
lrwxrwxrwx 1 root root 9 Mar 26 14:43 /usr/bin/python3 -> python3.7
$ ls -al `which python`
lrwxrwxrwx 1 root root 7 Mar 26 14:43 /usr/bin/python -> python3

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024

@zhou13 Because they're different python and they have different site packages.
You can just try import in your command line python.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

But you can see that /usr/bin/python3 really links to /usr/bin/python...

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

tty

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

You can see that jedi imports correctly in python but it does not work in coc-python.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

It is /home/zyc/.miniconda3/envs/lcnn/bin/python. Not sure why. Is that because I install coc-python when I was in that miniconda's virtualenv and for some reason coc-python hardcodes it?

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

@randrej, your problem is probably due to davidhalter/jedi#1236.

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

That explains the problem. It seems that coc-python will always remember the python when it first initializes. After I delete ~/.config/coc/memos.json, it hardcodes /usr/bin/python. So if I am inside some virtualenv, it still uses /usr/bin/python by default. This is a little bit confusing and not convenient. Is it possible to change the behavior so that it would automatically choose the python based on current $PATH?

from coc-python.

zhou13 avatar zhou13 commented on September 23, 2024

:CocList extensions tells me that I am at coc-python 1.1.6. Is that the newest version of coc-python?

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024

It only select python interpreter when python inside your workspaceFolder, so if your python outside current workspaceFolder, you have to select the interpreter once for current workspaceFolder.

from coc-python.

randrej avatar randrej commented on September 23, 2024

@randrej, your problem is probably due to davidhalter/jedi#1236.

Yep, you can see that the last post is mine. It is a jedi problem, so I downgraded jedi (and posted PR #37 to allow using jedi 12.1 with coc-python), which solves my issue for now.

from coc-python.

chemzqm avatar chemzqm commented on September 23, 2024

Use python.jediPath setting to make sure coc-python load jedi module from that directory.

from coc-python.

z-huabao avatar z-huabao commented on September 23, 2024

It should use python from your current $PATH unless you have "python.pythonPath" changed or you used :CocCommand python.setInterpreter to configure python interpreter for current workspace folder.

Could be issue of wrong workspaceFolder, checkout https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders.

I can't reproduce your problem, you can checkout the log of coc.nvim https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim.

:CocCommand python.setInterpreter solve it

from coc-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.