docker.errors.DockerException: Error while fetching server API version
Are you sure docker is running on your system? You can get that error when compose is not able to connect to docker via docker socket (if any other way for connection is not defined).
If you are running on linux, usually you can run "systemctl status docker" to check if docker daemon is running and "systemctl start docker" to start it.
It would help to tell what OS and docker version are you using.
When used WSL (Windows Subsystem for Linux) need to enable 'WSL Integration' for required distro in Windows Docker Desktop (Settings -> Resources-> WSL Integration -> Enable integration with required distros).