python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

ModuleNotFoundError: No module named 'jedi' while Jedi is installed

Open treymerkley opened this issue 5 years ago • 8 comments

I'm having this problem where the system can't find Jedi, even though it's already installed. The import statement looks right, so it might be a problem with my python setup.

Here's the traceback, lemme know if you need more. Thanks!

[trey@Henry .emacs.d]$ pyls
Traceback (most recent call last):
  File "/usr/bin/pyls", line 11, in <module>
    load_entry_point('python-language-server==0.26.1', 'console_scripts', 'pyls')()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.7/site-packages/pyls/__main__.py", line 7, in <module>
    from .python_ls import start_io_lang_server, start_tcp_lang_server, PythonLanguageServer
  File "/usr/lib/python3.7/site-packages/pyls/python_ls.py", line 12, in <module>
    from .workspace import Workspace
  File "/usr/lib/python3.7/site-packages/pyls/workspace.py", line 7, in <module>
    import jedi
ModuleNotFoundError: No module named 'jedi'
[trey@Henry .emacs.d]$ sudo pip install jedi
[sudo] password for trey: 
Requirement already satisfied: jedi in /usr/lib/python3.7/site-packages (0.13.2)
Requirement already satisfied: parso>=0.3.0 in /usr/lib/python3.7/site-packages (from jedi) (0.3.1)
[trey@Henry .emacs.d]$ pip install jedi
Requirement already satisfied: jedi in /usr/lib/python3.7/site-packages (0.13.2)
Requirement already satisfied: parso>=0.3.0 in /usr/lib/python3.7/site-packages (from jedi) (0.3.1)

treymerkley avatar Apr 22 '19 15:04 treymerkley

python -m pip install jedi

CengSin avatar Aug 03 '19 13:08 CengSin

I'm having this problem, too. Not sure how to get around it either. I have Jedi installed, and I can require jedi from a normal python program, but there seem to be problems importing it when I use it with CoC in vim.

I can also run pyls normally from the command line without any errors coming up.

beelzebielsk avatar Sep 09 '19 14:09 beelzebielsk

@CengSin I just ran it, and here's what I got:

[trey@Henry ~]$ sudo python -m pip install jedi
[sudo] password for trey: 
Requirement already satisfied: jedi in /usr/lib/python3.7/site-packages (0.13.2)
Requirement already satisfied: parso>=0.3.0 in /usr/lib/python3.7/site-packages (from jedi) (0.3.1)

treymerkley avatar Sep 09 '19 15:09 treymerkley

Same here

Bertus-W avatar Dec 19 '19 12:12 Bertus-W

I'm experiencing the same error with Python 3.8. Any solutions so far?

rollschild avatar Jan 08 '20 16:01 rollschild

I'm experiencing the same error with Python 3.8. Any solutions so far?

Do you have two python version on your machine? Its possible that you installed jedi through python2, try python3 -m pip install jedi

RonanMacF avatar Feb 20 '20 11:02 RonanMacF

I got a similar issue, and I solved it as follows:

  1. Read the README of coc-python.
  2. Open the coc configuration: :CocConfig
  3. As it says on it, add "python.jediEnabled": false in the config file, save it and close it.
  4. Open a file in your Python project (with nvim or vim) and automatically, will be downloaded and installed Python Language Server. After that, the auto-completion in a Python file works for me.

Mikhael1729 avatar May 05 '20 18:05 Mikhael1729

I got a similar issue, and I solved it as follows:

  1. Read the README of coc-python.
  2. Open the coc configuration: :CocConfig
  3. As it says on it, add "python.jediEnabled": false in the config file, save it and close it.
  4. Open a file in your Python project (with nvim or vim) and automatically, will be downloaded and installed Python Language Server. After that, the auto-completion in a Python file works for me.

Thanks alot

ihechiwilliams avatar Jul 05 '20 15:07 ihechiwilliams