google-deepmind / alphafold

Open source code for AlphaFold.
Apache License 2.0
12.3k stars 2.2k forks source link

docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked' #867

Open C10H opened 9 months ago

C10H commented 9 months ago

The traceback is as follows:


> I1130 17:22:33.347284 140275321640768 run_docker.py:116] Mounting /home/a22/alphafold/project/6y4f -> /mnt/fasta_path_0
> I1130 17:22:33.365633 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/uniref90 -> /mnt/uniref90_database_path
> I1130 17:22:33.369917 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/mgnify -> /mnt/mgnify_database_path
> I1130 17:22:33.370005 140275321640768 run_docker.py:116] Mounting /home/a22/afdata -> /mnt/data_dir
> I1130 17:22:33.383804 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/pdb_mmcif/mmcif_files -> /mnt/template_mmcif_dir
> I1130 17:22:33.394144 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/pdb_mmcif -> /mnt/obsolete_pdbs_path
> I1130 17:22:33.408813 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/pdb70 -> /mnt/pdb70_database_path
> I1130 17:22:33.415395 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/uniref30 -> /mnt/uniref30_database_path
> I1130 17:22:33.424955 140275321640768 run_docker.py:116] Mounting /home/a22/afdata/bfd -> /mnt/bfd_database_path
> Traceback (most recent call last):
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
>     return self.version(api_version=False)["ApiVersion"]
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/api/daemon.py", line 181, in version
>     return self._result(self._get(url), json=True)
>                         ^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/utils/decorators.py", line 46, in inner
>     return f(self, *args, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/api/client.py", line 237, in _get    return self.get(url, **self._set_request_timeout(kwargs))
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
>     return self.request("GET", url, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
>     resp = self.send(prep, **send_kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/requests/sessions.py", line 703, in send    r = adapter.send(request, **kwargs)
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/requests/adapters.py", line 486, in send    resp = conn.urlopen(
>            ^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
>     response = self._make_request(
>                ^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, 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 "/home/a22/alphafold/docker/run_docker.py", line 267, in <module>
>     app.run(main)
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/absl/app.py", line 312, in run
>     _run_main(main, args)
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/absl/app.py", line 258, in _run_main
>     sys.exit(main(argv))
>              ^^^^^^^^^^
>   File "/home/a22/alphafold/docker/run_docker.py", line 232, in main
>     client = docker.from_env()
>              ^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/client.py", line 96, in from_env
>     return cls(
>            ^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/client.py", line 45, in __init__
>     self.api = APIClient(*args, **kwargs)
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/api/client.py", line 197, in __init__
>     self._version = self._retrieve_server_version()
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/a22/anaconda3/envs/alphafold2-docker/lib/python3.11/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
>     raise DockerException(
> docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

my environment is as follows: windows11-WSL2-ubuntu22.04,anaconda 23.7.4, docker-for wsl 4.25.0,NVIDIA 4090,cuda12.2 conda list:


# packages in environment at /home/a22/anaconda3/envs/alphafold2-docker:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             5.1                       1_gnu    defaults
absl-py                   1.0.0                    pypi_0    pypi
bzip2                     1.0.8                h7b6447c_0    defaults
ca-certificates           2023.08.22           h06a4308_0    defaults
certifi                   2023.11.17               pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
docker                    5.0.0                    pypi_0    pypi
idna                      3.6                      pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1    defaults
libffi                    3.4.4                h6a678d5_0    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libgomp                   11.2.0               h1234567_1    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
libuuid                   1.41.5               h5eee18b_0    defaults
ncurses                   6.4                  h6a678d5_0    defaults
openssl                   3.0.12               h7f8727e_0    defaults
pip                       23.3.1          py311h06a4308_0    defaults
python                    3.11.5               h955ad1f_0    defaults
readline                  8.2                  h5eee18b_0    defaults
requests                  2.31.0                   pypi_0    pypi
setuptools                68.0.0          py311h06a4308_0    defaults
six                       1.16.0                   pypi_0    pypi
sqlite                    3.41.2               h5eee18b_0    defaults
tk                        8.6.12               h1ccaba5_0    defaults
tzdata                    2023c                h04d1e81_0    defaults
urllib3                   2.1.0                    pypi_0    pypi
websocket-client          1.6.4                    pypi_0    pypi
wheel                     0.41.2          py311h06a4308_0    defaults
xz                        5.4.2                h5eee18b_0    defaults
zlib                      1.2.13               h5eee18b_0    defaults
(alphafold2-docker) a22@C10H15N:~/alphafold$ docker-compose version
Docker Compose version v2.23.0-desktop.1
alexholehouse commented 9 months ago

See issue https://github.com/google-deepmind/alphafold/issues/812 which may offer a resolution that works for you

navieraintegral commented 6 months ago

Well again, I don't have idea if the issue was fixed it, however share solution I've found:

pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'

Running above line command worked for me ...

eighthcolor22 commented 5 months ago

Well again, I don't have idea if the issue was fixed it, however share solution I've found:

pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'

Running above line command worked for me ...

Thanks a lot!

mungaben commented 5 months ago

Well again, I don't have idea if the issue was fixed it, however share solution I've found:

pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'

Running above line command worked for me ...

liujunchangqq commented 5 months ago

Well again, I don't have idea if the issue was fixed it, however share solution I've found:

pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'

Running above line command worked for me ...

thanks, this works for me, I think this method could be the issue's solution

ismaina commented 5 months ago

Thanks, This worked

dodancs commented 4 months ago

Hey, does anyone know how to fix this on ubuntu when you have:

root@ubuntu:~# pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

PS: It's Ubuntu server 24.04 LTS

PPS:

root@ubuntu:~# apt list --installed | grep python3-requests
python3-requests/noble,now 2.31.0+dfsg-1ubuntu1 all [installed,automatic]
root@ubuntu:~# apt list --installed | grep python3-urllib3
python3-urllib3/noble,now 2.0.7-1 all [installed,automatic]
Target9 commented 4 months ago

I have the exact same problem as @dodancs Im running Ubuntu desktop 24.04 LTS and when i run pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0' it gives me this: error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.

And just to clarify the docker error "chunked" occurs whenever i do something like docker-compose up, down and build. Also on my windows 10 I can do all the stuff of the above and it works Does anyone have a good fix for this?

development-cidtca commented 4 months ago

if you use docker-compose that is the error, use docker compose, with space not with line, that works for me

NicholaxKAmIL commented 4 months ago

if you use docker-compose that is the error, use docker compose, with space not with line, that works for me

That works for Ubuntu 24.04 LTS. Super pretty dope solution

lucasvaudey commented 4 months ago

I get it working by re-installing the correct version of docker on Ubuntu 24.04 LTS : https://docs.docker.com/engine/install/ubuntu/ and using the docker compose command instead of docker-compose

Asim-Shah-2004 commented 4 months ago

where do we have to write docker compose

cjsio commented 3 months ago

where do we have to write docker compose

Just inside your terminal. Use docker compose up -d with a space instead of docker-compose up -d with the hyphen.

Confirmed worked for me as well on Ubuntu 24.04 - no need to mess with the pip3 install --force-reinstall ... command.

JersonPQ commented 3 months ago

I get it working by re-installing the correct version of docker on Ubuntu 24.04 LTS : https://docs.docker.com/engine/install/ubuntu/ and using the docker compose command instead of docker-compose

I really thank you, I was trying to do it all the time with docker-compose and it didn't work at all, but with the space it worked!

LeaoSomogyi commented 3 months ago

Same where working on Ubuntu 24.04 LTS. Running the commando without - works, docker compose.

BlackRNG commented 3 months ago

To people still having problems (like me) on Ubuntu 24.04 LTS you have to apt install docker-compose-v2

mfthomps commented 2 months ago

This remains a fatal problem for those of us on Ubuntu 24 using the docker python module. Cannot downgrade the python requests module because the environment is "externally managed" and I don't use docker compose. Dead in the water.

Edit: See the suggestion from storm-legacy below. I'm convinced that moving to use of virtual python environments is the way to go given Ubuntu's lockdown of python installations and the inevitable package conflicts.

storm-legacy commented 2 months ago

I stumbled upon this post while searching for a fix to Ansible Docker deployment on Ubuntu 24.04. While it might not help everyone, I found out that it's possible to just create a .venv and install the required packages. Then, as the interpreter, choose the Python executable in the .venv directory. There is a chance that this is applicable to this problem as well.

python3 -m venv ~/.venv
~/.venv/bin/python -m pip install 'requests<2.29.0' 'urllib3<2.0'
; hosts 
[servers]
127.0.0.1

[all:vars]
ansible_ssh_user=user
ansible_ssh_port=22
ansible_ssh_private_key_file=~/.ssh/id_ed25519
ansible_python_interpreter=/home/user/.venv/bin/python

I hope this helps somebody.

roolebo commented 2 months ago

@storm-legacy or this workaround works as well:

curl -LO http://mirrors.kernel.org/ubuntu/pool/universe/p/python-docker/python3-docker_7.1.0-1_all.deb
sudo dpkg -i python3-docker_7.1.0-1_all.deb

python3-docker package is broken in 24.04 LTS anyway as of today. No harm to install the one from upcoming Ubuntu 24.10, it has no binary dependencies.

jpirovano commented 1 month ago

Same here Ubuntu 24.04 LT , fails with "docker-compose" and works with: "docker compose"

DarioPMM commented 1 month ago

where do we have to write docker compose

from the folder where is your docker-compose.yml file. :)

jpsecher commented 1 month ago

I only got Ansible working with python3-docker by using an Ubuntu 22.04 machine (AMI on AWS).

tianlichunhong commented 2 weeks ago

I get it working by re-installing the correct version of docker on Ubuntu 24.04 LTS : https://docs.docker.com/engine/install/ubuntu/ and using the docker compose command instead of docker-compose

this work for me on Ubuntu 24.04 LTS. Need to install docker-compose-plugin, then have the command "docker compose". Is a bug of docker-compose? On Ubuntu 22, docker-compose work fine.

4nozen commented 3 days ago

apt install docker-compose-v2 docker compose up -d