jorgenschaefer / elpy

Emacs Python Development Environment
GNU General Public License v3.0
1.9k stars 260 forks source link

The Python interpreter could not find the elpy module. #2006

Open parvizfarnia opened 1 year ago

parvizfarnia commented 1 year ago

Hi,

My environment:

OS: Linux Ubuntu 22.04.01 (64 bits)
Kernel version: 5.15.0-56-generic
Emacs version: 28.2
Python version: 3.11.1 (64 bits)
GCC version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

When I run M-elpy-config in Emacs, here is what I see:

Elpy Configuration

Emacs.............: 28.2
Elpy..............: Not found (Python), 1.35.0 (Emacs Lisp)
Virtualenv........: 3.11_ve_01 (/home/training/Documents/python_venvs/3.11_ve_01)
Interactive Python: python 3.11.1 (/home/training/Documents/python_venvs/3.11_ve_01/bin/python)
RPC virtualenv....: 3.11_ve_01 (/home/training/Documents/python_venvs/3.11_ve_01)
 Python...........: python nil (/home/training/Documents/python_venvs/3.11_ve_01/bin/python)
 Jedi.............: Not found
 Autopep8.........: Not found
 Yapf.............: Not found
 Black............: Not found
Syntax checker....: flake8 (/home/training/Documents/python_venvs/3.11_ve_01/bin/flake8)

Warnings

The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables
in that directory, so Emacs won't find them. If you are missing some
commands, do add this directory to your PATH -- and then do
`elpy-rpc-restart'.

The Python interpreter could not find the elpy module. Please report
to: https://github.com/jorgenschaefer/elpy/issues/new.

There was an unexpected problem starting the RPC process. Please check
the following output to see if this makes sense to you. To me, it
doesn't.

Objects/typeobject.c:6064: type_ready_pre_checks: Assertion "type->tp_call != ((void *)0)" failed
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x5645b86087e0
object refcount : 1
object type     : 0x7fafaca71aa0
object type name: type
object repr     : 

Elpy could not connect to Pypi (or at least not quickly enough) and
check if the python packages were up-to-date. You can still try to
update all of them:

[Update python packages]

The Jedi package is not currently installed. This package is needed
for code completion, code navigation and access to documentation.

[Install jedi]

No autoformatting package is currently installed. At least one is
needed (Autopep8, Yapf or Black) to perform autoformatting (`C-c C-r
f` in a python buffer).

[Install autopep8]
[Install yapf]
[Install black]

Options

`Raised' text indicates buttons; type RET or click mouse-1 on a button
to invoke its action.  Invoke [+] to expand a group, and [-] to
collapse an expanded group.  Invoke the [Group], [Face], and [Option]
buttons below to edit that item in another window.

[+]-- Group Elpy
[+]-- Group Python
[+]-- Group Virtual Environments (Pyvenv)
[+]-- Group Completion (Company)
[+]-- Group Call Signatures (ElDoc)
[+]-- Group Inline Errors (Flymake)
[+]-- Group Code folding (hideshow)
[+]-- Group Snippets (YASnippet)
[+]-- Group Directory Grep (rgrep)
[+]-- Group Search as You Type (ido)
[+]-- Group Django extension
[+]-- Group Autodoc extension

I always start my python virtual environment in a terminal and then within the same terminal I run emacs &. Therefore when I run M-elpy-config, there is already a running Python virtual environment in which I have already installed (via pip install): Jedi, Autopep8, Yapf, Black. So I don't really understand why it says that these tools have not been installed. Moreover the following portion of the above error/warning messages is completely new to me:

Objects/typeobject.c:6064: type_ready_pre_checks: Assertion "type->tp_call != ((void *)0)" failed
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x5645b86087e0
object refcount : 1
object type     : 0x7fafaca71aa0
object type name: type
object repr     : 

Am I missing something?

parvizfarnia commented 1 year ago

Anyone has encountered the same problem?

cmouzaoui commented 1 year ago

Hello! This looks like a duplicate of https://github.com/jorgenschaefer/elpy/issues/1987