<@ULVA73B9P> i keep getting this error when trying...
# ask-marvin
d
@Marvin i keep getting this error when trying to deploy a flow:
Copy code
Traceback (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.9
m
thought for 103.6 seconds
Thanks for the traceback — this is a known incompatibility between the Docker SDK for Python and requests 2.32.x that surfaces as “Not supported URL scheme http+docker”. Docker is running fine; the issue is in the client library stack used during image build. What’s happening - requests 2.32.0 changed an internal code path; older versions of docker-py (Docker SDK for Python) didn’t override the new method, so the custom http+docker adapter isn’t used and you see
URLSchemeUnknown: 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
Copy code
pip install -U "docker>=7.1.0" "requests>=2.32.2"
2) Quick workaround: Pin requests back to 2.31.x
Copy code
pip install "requests<2.32"
Double-check your versions
Copy code
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
.
Copy code
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:
Copy code
pip show docker requests urllib3
echo $DOCKER_HOST
and I’ll confirm the exact action for your environment.
d
@Marvin (ds_env) dansimons@Daniels-MacBook-Pro-5 hal-project % pip show docker requests urllib3 Name: docker Version: 6.1.3 Summary: A Python library for the Docker Engine API. Home-page: https://github.com/docker/docker-py Author: Author-email: License: Apache License 2.0 Location: /Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages Requires: packaging, requests, urllib3, websocket-client Required-by: prefect, prefect-docker --- Name: requests Version: 2.31.0 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz Author-email: me@kennethreitz.org License: Apache 2.0 Location: /Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages Requires: certifi, charset-normalizer, idna, urllib3 Required-by: apprise, docker, google-api-core, google-cloud-storage, kubernetes, requests-oauthlib, streamlit, ydata-profiling --- Name: urllib3 Version: 2.5.0 Summary: HTTP library with thread-safe connection pooling, file post, and more. Home-page: Author: Author-email: Andrey Petrov <andrey.petrov@shazow.net> License: Location: /Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages Requires: Required-by: docker, kubernetes, requests (ds_env) dansimons@Daniels-MacBook-Pro-5 hal-project % echo $DOCKER_HOST now im getting a different error when i downgraded pip to 2.3.1: raceback (most recent call last): File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/api/client.py”, line 214, in _retrieve_server_version return self.version(api_version=False)[“ApiVersion”] File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/api/daemon.py”, line 181, in version return self._result(self._get(url), json=True) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/utils/decorators.py”, line 46, in inner return f(self, *args, **kwargs) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/docker/api/client.py”, line 237, in _get return self.get(url, **self._set_request_timeout(kwargs)) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/requests/sessions.py”, line 602, in get return self.request(“GET”, url, **kwargs) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/requests/sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/requests/sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “/Users/dansimons/amygda/hal-project/ds_env/lib/python3.10/site-packages/requests/adapters.py”, line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))
m
thought for 34.2 seconds
Thanks for the details. Your current versions show: - docker (SDK): 6.1.3 - requests: 2.31.0 - urllib3: 2.5.0 - DOCKER_HOST: not set So you’re past the “http+docker”/requests-2.32 issue. The new error requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) means the Docker SDK cannot find the Docker socket it’s trying to use. On macOS, the Docker SDK defaults to
unix:///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
Copy code
docker info
If this fails, start Docker Desktop. 2) Check which socket exists
Copy code
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:
Copy code
export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock
- If you’re using Colima, it’s usually:
Copy code
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)
Copy code
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):
Copy code
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.
d
@Marvin issue resolved by downgrading pip to <2.3.2 !
m
thought for 8.4 seconds
Great to hear it’s resolved! Quick sanity check: did you mean you downgraded requests to <2.32.0? pip doesn’t have versions like 2.3.x, so I suspect that was a typo. Pinning requests<2.32 is the known workaround for the “http+docker” issue. For a long-term fix (so you don’t need to pin requests), update the Docker SDK and unpin requests:
Copy code
pip 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.
d
@Marvin sorry yes I meant downgrading requests to <2.32.0 !!
m
thought for 7.3 seconds
No worries — and glad it worked! Short-term workaround: - Keeping
requests<2.32.0
is fine. Long-term fix (so you can unpin requests):
Copy code
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.