-
Notifications
You must be signed in to change notification settings - Fork 355
Closed
Description
Describe the bug
I use ollma containers for my test suite with pytest, I keep getting an exception with this function :
def _check_and_add_gpu_capabilities(self):
info = self.get_docker_client().client.info()
if "nvidia" in info["Runtimes"]:
self._kwargs = {**self._kwargs, "device_requests": DeviceRequest(count=-1, capabilities=[["gpu"]])}The error is TypeError: Invalid type for device_requests param: expected list but found <class 'docker.types.containers.DeviceRequest'>.
Here is my pytest fixture :
@pytest.fixture(scope="session")
def llms() -> Generator[OllamaContainer]:
llms = OllamaContainer(
"ollama/ollama:0.6.2",
Path.cwd().parent / "deployment" / "volumes" / "llms",
)
with llms:
yield llms
@pytest.fixture(scope="session")
def embeddings() -> Generator[OllamaContainer]:
embeddings = OllamaContainer(
"ollama/ollama:0.6.2",
Path.cwd().parent / "deployment" / "volumes" / "embeddings",
)
with embeddings:
yield embeddingsI managed to fix the issue by setting the device request to a list in my venv, but I don't like this solution 😬
To Reproduce
See above.
Runtime environment
# Get the operating system information (on a unix os).
$ uname -a
Linux LAPTOP-8AD7GLSA 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# Get the python version.
$ python --version
Python 3.13.2
# Get the docker version and other docker information.
$ docker info
Client:
Version: 28.0.1
Context: default
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v0.9.8
Path: /home/tygourm/.docker/cli-plugins/docker-ai
buildx: Docker Buildx (Docker Inc.)
Version: v0.21.1-desktop.2
Path: /usr/local/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.33.1-desktop.1
Path: /usr/local/lib/docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.38
Path: /usr/local/lib/docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Beta) (Docker Inc.)
Version: v0.1.5
Path: /usr/local/lib/docker/cli-plugins/docker-desktop
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /usr/local/lib/docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.27
Path: /usr/local/lib/docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: /usr/local/lib/docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: /usr/local/lib/docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /usr/local/lib/docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.17.0
Path: /home/tygourm/.docker/cli-plugins/docker-scout
Server:
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 9
Server Version: 28.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: runc io.containerd.runc.v2 nvidia
Default Runtime: runc
Init Binary: docker-init
containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
runc version: v1.2.4-0-g6c52b3f
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.146.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 24
Total Memory: 7.367GiB
Name: docker-desktop
ID: 8343ad8c-3f14-479c-922e-dd1b3ba3ddf9
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///var/run/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
::1/128
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
# Get all python packages.
$ pip freeze
aiofiles==24.1.0
annotated-types==0.7.0
anyio==4.9.0
asyncer==0.0.7
asyncpg==0.30.0
bidict==0.23.1
certifi==2025.1.31
chainlit==2.4.1
charset-normalizer==3.4.1
chevron==0.14.0
click==8.1.8
coverage==7.7.1
dataclasses-json==0.6.7
deprecated==1.2.18
distro==1.9.0
docker==7.1.0
fastapi==0.115.12
filetype==1.2.0
googleapis-common-protos==1.69.2
greenlet==3.1.1
grpcio==1.71.0
h11==0.14.0
httpcore==1.0.7
httpx==0.28.1
httpx-sse==0.4.0
idna==3.10
importlib-metadata==8.6.1
iniconfig==2.1.0
jiter==0.9.0
lazify==0.4.0
literalai==0.1.103
marshmallow==3.26.1
mcp==1.6.0
mypy-extensions==1.0.0
nest-asyncio==1.6.0
openai==1.69.0
opentelemetry-api==1.31.1
opentelemetry-exporter-otlp==1.31.1
opentelemetry-exporter-otlp-proto-common==1.31.1
opentelemetry-exporter-otlp-proto-grpc==1.31.1
opentelemetry-exporter-otlp-proto-http==1.31.1
opentelemetry-instrumentation==0.52b1
opentelemetry-proto==1.31.1
opentelemetry-sdk==1.31.1
opentelemetry-semantic-conventions==0.52b1
packaging==24.2
playwright==1.51.0
pluggy==1.5.0
protobuf==5.29.4
pydantic==2.11.1
pydantic-core==2.33.0
pydantic-settings==2.8.1
pyee==12.1.1
pyjwt==2.10.1
pytest==8.3.5
pytest-base-url==2.1.0
pytest-cov==6.0.0
pytest-playwright==0.7.0
python-dotenv==1.1.0
python-engineio==4.11.2
python-multipart==0.0.18
python-slugify==8.0.4
python-socketio==5.12.1
pyyaml==6.0.2
requests==2.32.3
ruff==0.11.2
simple-websocket==1.1.0
sniffio==1.3.1
sse-starlette==2.2.1
starlette==0.41.3
syncer==2.0.3
testcontainers==4.9.2
text-unidecode==1.3
tomli==2.2.1
tqdm==4.67.1
typing-extensions==4.13.0
typing-inspect==0.9.0
typing-inspection==0.4.0
uptrace==1.31.0
urllib3==2.3.0
uvicorn==0.34.0
watchfiles==0.20.0
wrapt==1.17.2
wsproto==1.2.0
zipp==3.21.0Metadata
Metadata
Assignees
Labels
No labels