Using EmotioNet in colab: docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword a

I want to use Nvidia TAO EmotionNet on colab environments.
EmotionNet is an NVIDIA developed emotion detection model which is included in the TAO Toolkit as one of the tasks supported.
Since from TAO 5.0.0, Emotion Classification has been deprecated. In order to use emotion classification, we try to use TAO 4.0.0.
Modify
python3.8 -m pip install nvidia-tao==4.0.0 # org python3.8 -m pip install nvidia-tao====5.0.0
in setup_env, which is provided in github repository: nvidia-tao GitHub - NVIDIA-AI-IOT/nvidia-tao
Modify from the “lprnet” example

I ran
!tao emotionnet dataset_convert --help
It returns error

Traceback (most recent call last):
  File "/usr/local/bin/tao", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/tlt/entrypoint/tao.py", line 114, in main
    instance.launch_command(
  File "/usr/local/lib/python3.8/dist-packages/tlt/components/instance_handler/local_instance.py", line 296, in launch_command
    docker_logged_in(required_registry=self.task_map[task].docker_registry)
  File "/usr/local/lib/python3.8/dist-packages/tlt/components/instance_handler/utils.py", line 137, in docker_logged_in
    data = load_config_file(docker_config)
  File "/usr/local/lib/python3.8/dist-packages/tlt/components/instance_handler/utils.py", line 72, in load_config_file
    assert os.path.exists(config_path), (
AssertionError: Config path must be a valid unix path. No file found at: /root/.docker/config.json. Did you run docker login?

I tried to install docker in colab and successfully login into it and docker nvcr.io, then the error becomes:
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked' #867
I have no idea how to fix it.

2024-05-30 07:53:00,112 [INFO] root: Registry: ['nvcr.io']
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/docker/api/client.py", line 205, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/usr/local/lib/python3.10/dist-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/usr/local/lib/python3.10/dist-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/docker/api/client.py", line 228, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 497, in _make_request
    conn.request(
TypeError: HTTPConnection.request() got an unexpected keyword argument 'chunked'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/tao", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/tlt/entrypoint/tao.py", line 114, in main
    instance.launch_command(
  File "/usr/local/lib/python3.10/dist-packages/tlt/components/instance_handler/local_instance.py", line 297, in launch_command
    docker_handler = self.handler_map[
  File "/usr/local/lib/python3.10/dist-packages/tlt/components/instance_handler/local_instance.py", line 147, in handler_map
    handler_map[handler_key] = DockerHandler(
  File "/usr/local/lib/python3.10/dist-packages/tlt/components/docker_handler/docker_handler.py", line 62, in __init__
    self._docker_client = docker.from_env()
  File "/usr/local/lib/python3.10/dist-packages/docker/client.py", line 84, in from_env
    return cls(
  File "/usr/local/lib/python3.10/dist-packages/docker/client.py", line 40, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/docker/api/client.py", line 188, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/local/lib/python3.10/dist-packages/docker/api/client.py", line 212, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

Please refer to TAO GPU Issue - #2 by Morganh.

I am not sure where -v /var/run/docker.sock:/var/run/docker.sock should be added.

!tao emotionnet dataset_convert -c $DATASET_SPECS_DIR/dataio_config_ckplus.json -v /var/run/docker.sock:/var/run/docker.sock

But still encounter same error :(

and here are an other question, my docker seem are not runing:
!docker ps
and it return:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Here’s how I installed docker in colab:

!pip install nvidia-tao==4.0.0
!pip install tabulate==0.9.0

my env var:

env: KEY=nvidia_tlt
env: NUM_GPUS=1
env: USER_EXPERIMENT_DIR=/workspace/tao-experiments/emotionnet
env: DATA_DOWNLOAD_DIR=/workspace/tao-experiments/emotionnet/orgData
env: TAO_DOCKER_DISABLE=0
env: LOCAL_PROJECT_DIR=FIXME
env: SAMPLES_DIR=FIXME
env: SPECS_DIR=/workspace/tao-experiments/emotionnet/specs
env: DATASET_SPECS_DIR=/workspace/tao-experiments/emotionnet/dataset_specs

my tao_mounts.json:

{
    "Mounts": [
        {
            "source": "FIXME",
            "destination": "/workspace/tao-experiments"
        },
        {
            "source": "/content/specs",
            "destination": "/workspace/tao-experiments/emotionnet/specs"
        },
        {
            "source": "/content/dataset_specs",
            "destination": "/workspace/tao-experiments/emotionnet/dataset_specs"
        }
    ]
}
%%shell
sudo apt update -qq
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update -qq
sudo apt install docker-ce
sudo apt-get update
sudo apt-get install -y nvidia-docker2
!docker login
!docker login nvcr.io

Actually for colab, it is not expected to run docker in it.
Suggest you to run with a local dgpu machine.

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.