@ryuuta199641

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

vscodeでpythonのコンパイルをすると失敗する。

vscodeでpythonのコンパイルをすると以下のようなエラーがでる
おはようございます。私は今vscodeでpythonのコンパイルをしています。
vscodeでコンパイルしたら以下のようなエラーが出てコンパイル出来ません。
原因は分かる方いますか?こまっています助けてください。

/usr/bin/env /usr/bin/python3 /home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 49849 -- extension-output-prasadbobby.auto-rename-tag-#1-Auto\ Rename\ Tag
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 69, in
from debugpy.server import cli
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/init.py", line 7, in
import debugpy._vendored.force_pydevd # noqa
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/force_pydevd.py", line 44, in
preimport('pydevd', [
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/init.py", line 126, in preimport
import_module(name)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 39, in
import pydevd_file_utils
File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_file_utils.py", line 45, in
from _pydevd_bundle.pydevd_constants import DebugInfoHolder, IS_WINDOWS, IS_JYTHON, DISABLE_FILE_VALIDATION, is_true_in_env, IS_MAC
ImportError: cannot import name 'DebugInfoHolder' from '_pydevd_bundle.pydevd_constants' (/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py)

0 likes

3Answer

実際のコードを載せてください。

わかっているエラーは一番最後のImportErrorだけで、/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_file_utils.pyファイルの45行目のimport文で、_pydevd_bundle.pydevd_constantsからDebugInfoHolderをインポートできないと言っています。

0Like

Comments

  1. @ryuuta199641

    Questioner

    import sys
    from PyQt5.QtWidgets import (QApplication, QWidget,
    QPushButton, QCheckBox,
    QSlider, QLineEdit,
    QCalendarWidget, QProgressBar)
    from PyQt5.QtCore import Qt
    from PyQt5.QtGui import QIcon

    class MainWindow(QWidget):
    def init(self, parent=None):
    super(MainWindow, self).init(parent)
    self.initUI()
    def initUI(self):
    self.setGeometry(400, 400, 600, 600) #self.move(400, 300), self.resize(400, 500)と一緒
    self.setWindowTitle('PyQt5 sample GUI 2')
    self.setWindowIcon(QIcon('simulog.gif'))

        # カレンダー
        cal = QCalendarWidget(self)
        cal.move(100, 300)
    

    if name == 'main':
    app = QApplication(sys.argv) #PyQtで必ず呼び出す必要のあるオブジェクト
    main_window = MainWindow() #ウィンドウクラスのオブジェクト生成
    main_window.show() #ウィンドウの表示
    sys.exit(app.exec_()) #プログラム終了

  2. @ryuuta199641

    Questioner

    これを実行すると

    /usr/bin/env /bin/python3 /home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56025 -- /home/ryuuta/programing/Python/PyQt/sample2.py
    Traceback (most recent call last):
    File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 69, in
    from debugpy.server import cli
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/init.py", line 7, in
    import debugpy._vendored.force_pydevd # noqa
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/force_pydevd.py", line 44, in
    preimport('pydevd', [
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/init.py", line 126, in preimport
    import_module(name)
    File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 39, in
    import pydevd_file_utils
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_file_utils.py", line 45, in
    from _pydevd_bundle.pydevd_constants import DebugInfoHolder, IS_WINDOWS, IS_JYTHON, DISABLE_FILE_VALIDATION, is_true_in_env, IS_MAC
    ImportError: cannot import name 'DebugInfoHolder' from '_pydevd_bundle.pydevd_constants' (/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py)

    と表示されます、原因が全く分かりません

  3. @ryuuta199641

    Questioner

    因みにpythonでhelloworldを実行すると

    d /home/ryuuta/programing/Python/PyQt ; /usr/bin/env /bin/python3 /home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 52959 -- /home/ryuuta/programing/Python/sample.py
    Traceback (most recent call last):
    File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 69, in
    from debugpy.server import cli
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/init.py", line 7, in
    import debugpy._vendored.force_pydevd # noqa
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/force_pydevd.py", line 44, in
    preimport('pydevd', [
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/init.py", line 126, in preimport
    import_module(name)
    File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py", line 39, in
    import pydevd_file_utils
    File "/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_file_utils.py", line 45, in
    from _pydevd_bundle.pydevd_constants import DebugInfoHolder, IS_WINDOWS, IS_JYTHON, DISABLE_FILE_VALIDATION, is_true_in_env, IS_MAC
    ImportError: cannot import name 'DebugInfoHolder' from '_pydevd_bundle.pydevd_constants' (/home/ryuuta/.vscode/extensions/ms-python.debugpy-2025.6.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py)

    となります。

ログを見た感じ、VS CodeのPython開発構築が正しく構築されていない気がします。

VS Codeの拡張機能として恐らく下記のようなものがインストールされていると思います。

  • Python
  • Python Debugger

もしインストールされてなければインストール、既にインストールされているようでしたら一度アンインストールして再度インストール
インストール後にVS Codeの再起動をしてみてください。

0Like

Debuggerを起動すると(デバッグ実行は)エラーになりますが、Runすれば問題なく起動できませんか?(自分はできました)

↓ こちらのコードですね

0Like

Comments

  1. @ryuuta199641

    Questioner

    どこ方法を試してもだめだったので
    OSのバッグアップを取った奴をコピペして使う事にしました
    ありがとうございます

Your answer might help someone💌