swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

swift lldb: ModuleNotFoundError: No module named 'lldb.embedded_interpreter' #70676

Open felixf4xu opened 8 months ago

felixf4xu commented 8 months ago

Description

I just installed swift 5.9.2:

which swift

/home/cc/Downloads/swift-5.9.2/usr/bin/swift which lldb /home/cc/Downloads/swift-5.9.2/usr/bin/lldb

Reproduction

lldb -v

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'lldb.embedded_interpreter' lldb version 13.0.0git (https://github.com/apple/llvm-project.git revision 2b42c5ce063a374fb22676e27505a22fe411ea8c) Swift version 5.9.2 (swift-5.9.2-RELEASE)

lldb -P

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'lldb.embedded_interpreter' /home/cc/Downloads/swift-5.9.2/usr/local/lib/python3.10/dist-packages

the bug is this eror:

ModuleNotFoundError: No module named 'lldb.embedded_interpreter'

Expected behavior

I also tested in the docker:

root@0aab65764cdf:/home/cc# lldb -v
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/lldb/__init__.py", line 1399, in <module>
    eTraceInstructionControlFlowTypeInstruction = _lldb.eTraceInstructionControlFlowTypeInstruction
AttributeError: module '_lldb' has no attribute 'eTraceInstructionControlFlowTypeInstruction'
lldb version 13.0.0git (https://github.com/apple/llvm-project.git revision 2b42c5ce063a374fb22676e27505a22fe411ea8c)
Swift version 5.9.2 (swift-5.9.2-RELEASE)
root@0aab65764cdf:/home/cc# lldb -P
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/lldb/__init__.py", line 1399, in <module>
    eTraceInstructionControlFlowTypeInstruction = _lldb.eTraceInstructionControlFlowTypeInstruction
AttributeError: module '_lldb' has no attribute 'eTraceInstructionControlFlowTypeInstruction'
/usr/local/lib/python3.10/dist-packages

the error of ModuleNotFoundError: No module named 'lldb.embedded_interpreter' does not exist

Environment

swiftc --version

Swift version 5.9.2 (swift-5.9.2-RELEASE) Target: x86_64-unknown-linux-gnu

Additional information

I'm not sure if it's my python evironment issue, my python version is default on Ubuntu 22:

python3 --version Python 3.10.12

but I also installed libpython3.8 according to the document https://www.swift.org/install/linux/#installation-via-tarball

MahdiBM commented 1 month ago

I think this issue should be resolved in the latest toolchains (I think It's related to addition of installation of python3-lldb-13 or another python lib into the toolchains and Dockerfiles and all).