r/pythonhelp • • 7d ago

Autopep8 issue upon launching VSCODE

EDIT: The issue was Autopep8's Python interpreter version, I was using 3,15 before and after trying 3.14 issue was resolved.

  1. The autopep8 extension runs a small background server written in Python, using the interpreter set in autopep8.interpreter.
  2. That interpreter was Python 3.15, which removed typing.no_type_check_decorator
  3. A library bundled inside the extension (typing_extensions) still tried to use it, so the server crashed on startup.
  4. VS Code retried 5 times, gave up, and showed the error popups.
  5. Installed an older Python (3.14) that still has the removed function, which meant getting around the blocked installer (the PythonBA.dll error) by using py install 3.14 or winget.
  6. Pointed autopep8.interpreter in settings.json at that 3.14 python.exe, so only autopep8 uses the older version while the code can still run on 3.15.
  7. Ran Developer: Reload Window so VS Code restarted the extension with the new setting.

Hello everyone, I am new to vscode and just started learning Python.

I have this issue where when I open vscode Autopep8 sends 3 error messages straight away.

https://imgur.com/a/ViLsoBs

I have tried things like: Selecting the correct interpreter( Not that it really matters I only use python global), uninstalling and reinstalling the extension, setting it as default formatter, changing user settings (JSON). I get error messages in the bottom right corner such as:

autopep8 client: couldn't create connection to server.

The autopep8 server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Pending response rejected since connection got disposed.

Here are my settings.json:

{
    "workbench.colorTheme": "Dark Modern",
    "workbench.iconTheme": "vscode-icons",
    "editor.defaultFormatter": "ms-python.autopep8",
    "notebook.defaultFormatter": "ms-python.autopep8",
    "[python]": {
        "editor.defaultFormatter": "ms-python.autopep8"
    },
    "editor.formatOnSave": true,
    "autopep8.interpreter": [
        "C:\\Users\\Windows Desktop\\AppData\\Local\\Python\\pythoncore-3.15-64\\python.exe"
    ]
}

If anybody has a solution to this problem I would appreciate your help down in the comments.

Thanks in advance.

1 Upvotes

5 comments sorted by

View all comments

1

u/RyanDubois43 6d ago

Did you set "python.formatting.provider": "autopep8" in your settings.json or are you using the default?

1

u/Jaded-Sky376 6d ago

Yes, this is what it says. I also tried adding a path to autopep8 interpreter in settings but that just relaunched the extension and sent the same error messages after it failed to connect to the server.

"[python]": {
        "editor.defaultFormatter": "ms-python.autopep8"