$ ~/.swiftenv/versions/5.7-RELEASE/usr/bin/swift repl
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'
error: failed to launch REPL process: 'A' packet returned an error: 8
i understand the REPL has never worked on the nightlies, but i at least expected it to work out of the box in the 5.7 release toolchain…
Swift compiler hasn't shipped with LLDB Python binding since 5.6.x. I just checked 5.7 package, no LLDB Python binding neither. You have to compile yourself. However, repl doesn't require Python LLDB binding before, so I am unsure why it becomes an issue and why @Kila2 's workaround would work.
I am not sure if it is REPL doesn't work out of box (as I said, Python LLDB binding is not required for 5.6's REPL I tested) or there are some setups in your .lldbinit somehow requires Python LLDB binding though. Thus, I am not in authority to say it is a broken playground by default.
However, without Python LLDB binding I believe that does make VSCode debugger integration stranger on Linux (I don't use that though). It also makes my Jupyter notebook usage harder, but I guess I am on my own there anyway.
I can confirm that installing python3-lldb-13 helps, but it's only available for Ubuntu 22.04 by default, apt-get install -y python3-lldb-13 will fail on Focal and earlier Ubuntu LTS releases.
I'm getting this error in Swift 5.8 (on Ubuntu 18.04), but the repl still launches:
$ swift repl
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'
Welcome to Swift version 5.8 (swift-5.8-RELEASE).
Type :help for assistance.
1> ["Hello", "World!"].joined(separator: ", ")
$R0: String = "Hello, World!"
Other swift commands (swift package init, swift build, etc) still work fine.
I just installed Swift 5.9 on Raspberry Pi OS (Debian 12), and I get this error as well. There are several python3-lldb I can choose from. Which should I use?
$ apt search python3-lldb
Sorting... Done
Full Text Search... Done
python3-lldb/stable 1:14.0-55.7~deb12u1 arm64
Next generation, high-performance debugger, python lib
python3-lldb-13/stable 1:13.0.1-11+b2 arm64
Next generation, high-performance debugger, python3 lib
python3-lldb-14/stable 1:14.0.6-12 arm64
Next generation, high-performance debugger, python3 lib
python3-lldb-15/stable 1:15.0.6-4+b1 arm64
Next generation, high-performance debugger, python3 lib