pythoneclipsepydevpyenv

eclipse - pydev - pyenv: mixing up python versions in debug mode


I used to work with Python 3.8.10. Now I additionally installed Python 3.13.2 via pyenv. Both versions are working when I call them in a terminal.

In Eclipse I generated a pydev project. In it there are two folders, in which the different python versions should be used. The python version is locally set in a file called .python-version.

When I want to debug the file, I get an error.

picture of my problem: debugging does not work in Eclipse

What is the correct way to use this setting in Eclipse? Do I have some problems with my Python path?

Thank you in advance for your help.

Kind regards, Philipp


Addendum: Here is the error code from Eclipse.

Traceback (most recent call last):
  File "/home/philipp/.p2/pool/plugins/org.python.pydev.core_13.0.2.202503021229/pysrc/pydevd.py", line 23, in <module>
    from _pydevd_bundle import pydevd_constants
  File "/home/philipp/.p2/pool/plugins/org.python.pydev.core_13.0.2.202503021229/pysrc/_pydevd_bundle/pydevd_constants.py", line 6, in <module>
    import platform
  File "/usr/lib/python3.8/platform.py", line 117, in <module>
    import re
  File "/usr/lib/python3.8/re.py", line 125, in <module>
    import sre_compile
  File "/usr/lib/python3.8/sre_compile.py", line 17, in <module>
    assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch


Solution

  • I finally found a solution:
    In Eclipse I removed all PYTHONPATH entries, since pyenv is handling the paths. In the pydev project I added a .pyton-version file (see https://github.com/pyenv/pyenv), that defines the Python version (including all paths) for this project folder.

    Eclipse PYTHONPATH removed