Colima, PyCharm, and AWS SAM - cannot find pydevd.py

652 Views Asked by At

Running a Mac M1 trying to start AWS SAM inside a Docker container through PyCharm fails with

START RequestId: 35db17a5-d684-4ffa-b3ad-d50e253561b7 Version: $LATEST
/var/lang/bin/python3.9: can't open file '/tmp/lambci_debug_files/pydevd.py': [Errno 2] No such file or directory
22 Dec 2022 21:06:55,372 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 2 InvokeID=
/var/lang/bin/python3.9: can't open file '/tmp/lambci_debug_files/pydevd.py': [Errno 2] No such file or directory
END RequestId: 45c424e4-0012-40a3-a049-928c3c838518
REPORT RequestId: 45c424e4-0012-40a3-a049-928c3c838518  Init Duration: 2.56 ms  Duration: 358.87 ms Billed Duration: 359 ms Memory Size: 128 MB Max Memory Used: 128 MB 

I have colima running succesfully and I breifly see the container start up there so PyCharm is doing the right thing, but how do I solve the error its complaning about?

I can only assume its a permission issue but my understanding with Colima is by default its mounting my local directory as read/write

The output of colima status

INFO[0000] colima is running using QEMU                 
INFO[0000] arch: x86_64                                 
INFO[0000] runtime: docker                              
INFO[0000] mountType: 9p                                
INFO[0000] socket: unix:///Users/chritu07/.colima/default/docker.sock

I've tried a different number of solutions that I've seen around, the most common one is to do

colima start -c 4 -m 12 -a x86_64 --mount-type 9p --mount /Applications:w

Passing the mount endpoint to the /Applications directory which mimics the Docker Shared Files settings in the desktop client. This doesn't seem to have any effect though.

2

There are 2 best solutions below

0
On

I've tried on a similar situation(lima on M1 Mac, can't open ...), and finally I'm using docker desktop instead. By the way, I think FileSharing is the problem. In my case, even if with DockerDesktop, this sort of problem had occurred and then solved it.

Originally, automated shared files are like below

/Users
/Volumes
/private
/tmp
/var/folders

So I needed to add /Applications/PyCharm CE.app to FileSharing. And it's working well. (I'm sorry, I don't check with colima again) If you didn't check the sharing files, please check them.

0
On

Adding /Applications/PyCharm CE.app to the lima config used by Rancher Desktop fixes the issue on M1 Mac. override.yaml does not exist by default.

~/Library/Application Support/rancher-desktop/lima/_config/override.yaml:

mounts:
- location: /Applications/PyCharm CE.app
  writable: true