question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import not possible when running in docker container

See original GitHub issue

Hey! I’m trying to set up a docker container and use 8 bit Adam. When I’m trying to import bitsandbytes, I’m getting

2022-10-26T11:20:58.819996206Z     import bitsandbytes as bnb
2022-10-26T11:20:58.820003169Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/__init__.py", line 6, in <module>
2022-10-26T11:20:58.820019600Z     from .autograd._functions import (
2022-10-26T11:20:58.820023698Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/autograd/_functions.py", line 5, in <module>
2022-10-26T11:20:58.820060948Z     import bitsandbytes.functional as F
2022-10-26T11:20:58.820067420Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/functional.py", line 13, in <module>
2022-10-26T11:20:58.820089783Z     from .cextension import COMPILED_WITH_CUDA, lib
2022-10-26T11:20:58.820094021Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/cextension.py", line 113, in <module>
2022-10-26T11:20:58.820140619Z     lib = CUDASetup.get_instance().lib
2022-10-26T11:20:58.820148213Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/cextension.py", line 109, in get_instance
2022-10-26T11:20:58.820191876Z     cls._instance.initialize()
2022-10-26T11:20:58.820198208Z   File "/root/miniconda3/lib/python3.9/site-packages/bitsandbytes/cextension.py", line 59, in initialize
2022-10-26T11:20:58.820229417Z     binary_name, cudart_path, cuda, cc, cuda_version_string = evaluate_cuda_setup()
2022-10-26T11:20:58.820236040Z ValueError: too many values to unpack (expected 5)

This happens only when I’m starting my script directly in the Dockerfile, if I instead just start the container without any CMD or ENTRYPOINT, ssh into the container and then manually start the script, it does work, but for some reason, Docker doesn’t seem to be having access to CUDA properly when starting from the Dockerfile?

I’ve traced the error down to https://github.com/TimDettmers/bitsandbytes/blob/a371be302ddbdf3f36acef1a6fe365672099c9d9/bitsandbytes/cuda_setup/main.py#L137 since the function returns here with only one value instead of the expected 5, but I haven’t had any other issues with CUDA before that, e.g. transferring models to the GPU by using .to('cuda')

I’m at a loss since I’m not too experienced with Docker and it does work when I’m starting the script manually via ssh.

Thanks in advance!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
samiedecommented, Dec 8, 2022

using the devel did work for me. Also manually installing cudatoolkit with conda!

0reactions
jeanmichaeldieicommented, Dec 8, 2022

Any updates? I am facing this exact issue on WSL2 with a 3090 and cuda 11.6 installed on the docker.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging ImportError and ModuleNotFoundErrors in your ...
Your code runs fine on your computer, but when you try to package it with Docker you keep getting ImportError s or ModuleNotFoundError...
Read more >
Unable to import modules when running in server in docker. #39
I'm getting that error, i.e., ImportError: can not import module from /dalle/dalle-flow/executors/dalle/dm_helper.py despite that file existing ...
Read more >
ModuleNotFoundError and import errors in Docker container
If I change how I import in api.py, to import settings , I get errors locally, but the docker container works perfectly.
Read more >
docker import - Docker Documentation
Import the contents from a tarball to create a filesystem image ... Refer to the options section for an overview of available OPTIONS...
Read more >
Import any Linux distribution to use with WSL - Microsoft Learn
This article shows how to import the Linux distribution, CentOS, for use with WSL by obtaining ... Run the CentOS container inside Docker:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found