Daniel
10/03/2025, 12:43 PMTraceback (most recent call last):
File "/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/prefect/utilities/dockerutils.py", line 110, in docker_client
client = docker.DockerClient.from_env()
File "/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/client.py", line 96, in from_env
return cls(
File "/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
File "/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/api/client.py", line 197, in __init__
self._version = self._retrieve_server_version()
File "/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
Docker is running, i am using prefect version 2.19.9Marvin
10/03/2025, 12:44 PMMarvin
10/03/2025, 12:45 PMURLSchemeUnknown: Not supported URL scheme http+docker.
- This was fixed in the Docker SDK. Upgrading the Docker SDK (or pinning requests back) resolves it.
Fix options (pick one)
1) Preferred: Upgrade Docker SDK (and requests) in your env
pip install -U "docker>=7.1.0" "requests>=2.32.2"
2) Quick workaround: Pin requests back to 2.31.x
pip install "requests<2.32"
Double-check your versions
pip show docker requests urllib3
Optional sanity check: DOCKER_HOST
- Make sure DOCKER_HOST is not set to something odd. On macOS/Linux it’s typically unset or unix:///var/run/docker.sock.
echo $DOCKER_HOST
# If it shows http+docker://... try unsetting
unset DOCKER_HOST
References
- Prefect issue showing the same stack trace: PrefectHQ/prefect#13478
- Docker SDK issue: docker/docker-py#3256
- Fix PR in Docker SDK: PR #3257
If you’d like, share the output of:
pip show docker requests urllib3
echo $DOCKER_HOST
and I’ll confirm the exact action for your environment.Daniel
10/03/2025, 12:49 PMMarvin
10/03/2025, 12:49 PMMarvin
10/03/2025, 12:49 PMunix:///var/run/docker.sock. If that file doesn’t exist, you’ll get exactly this error. Docker Desktop often exposes the socket at ~/.docker/run/docker.sock and may or may not create a symlink at /var/run/docker.sock.
Try this:
1) Verify Docker is reachable from the CLI
docker info
If this fails, start Docker Desktop.
2) Check which socket exists
ls -l /var/run/docker.sock
ls -l ~/.docker/run/docker.sock
3) Point the SDK at the correct socket (replace path if yours differs)
- If ~/.docker/run/docker.sock exists:
export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock
- If you’re using Colima, it’s usually:
export DOCKER_HOST=unix://$HOME/.colima/default/docker.sock
Then retry your Prefect deployment.
Optional: create a symlink instead (if you prefer not to set env vars)
sudo ln -sf "$HOME/.docker/run/docker.sock" /var/run/docker.sock
If you want to upgrade the Docker SDK anyway (works fine with requests>=2.32.x):
pip install -U "docker>=7.1.0" "requests>=2.32.2"
Could you share:
- The output of docker info
- The results of the two ls -l commands above
That’ll confirm the right socket path. For context, a related Prefect issue with similar stack traces is here: PrefectHQ/prefect#13478. The underlying requests/Docker SDK issue we mentioned earlier is here: docker/docker-py#3256 and fixed in PR #3257.Daniel
10/03/2025, 12:51 PMMarvin
10/03/2025, 12:51 PMMarvin
10/03/2025, 12:51 PMpip install -U "docker>=7.1.0" "requests>=2.32.2"
References for why this happens:
- Docker SDK issue: docker/docker-py#3256
- Fix PR: docker/docker-py PR #3257
- Related Prefect report: PrefectHQ/prefect#13478
If you want, share exactly what you pinned so we can note it for future you/teammates.Daniel
10/03/2025, 12:52 PMMarvin
10/03/2025, 12:52 PMMarvin
10/03/2025, 12:52 PMrequests<2.32.0 is fine.
Long-term fix (so you can unpin requests):
pip install -U "docker>=7.1.0" "requests>=2.32.2"
Then remove the pin on requests.
Refs:
- docker/docker-py#3256
- Fix PR
- Related Prefect issue
If you want, I can suggest exact requirements.txt pins for your project.