문제 : wsl2 에서 pybullet 사용 시 아래와 같은 에러 발생 시

libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)                                                                             
libGL error: failed to load driver: swrast  

해결법 : 아래 코드 실행

ln -s -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 $CONDA_PREFIX/lib/libstdc++.so.6

문제 : WSL2에서 CPU memory 초과 에러 발생

2024-11-11 17:13:04.770221: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 235929600 exceeds 10% of free system memory.                         
2024-11-11 17:13:04.890095: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 235929600 exceeds 10% of free system memory.                         
2024-11-11 17:13:05.145305: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 235929600 exceeds 10% of free system memory.                         
2024-11-11 17:13:05.250578: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 235929600 exceeds 10% of free system memory.                         
2024-11-11 17:13:08.342868: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 2595840000 exceeds 10% of free system memory.

해결법 :

  1. WSL2 메모리 제한 확인
  1. WSL2 스왑 메모리 설정

스왑 메모리를 설정하여 메모리 부족을 완화할 수 있다. 아래 명령어를 통해 추가 스왑 메모리를 생성하.

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile