alphafold icon indicating copy to clipboard operation
alphafold copied to clipboard

python3 docker/run_docker.py error: requests.exceptions.HTTPError: 400 Client Error

Open mglgc opened this issue 5 years ago • 12 comments

Hi all, After a successful setup and dependencies installation, the running python3 docker/run_docker.py command shows several error lines (see below) heading for requests.exceptions.HTTPError: 400 Client Error. Anyone has dealed this situation? Some reply from maintaniers would be pretty apreciated by everyone. Thanks a lot!

I0805 10:33:03.081809 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold -> /mnt/fasta_path_0 I0805 10:33:03.081928 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/uniref90 -> /mnt/uniref90_database_path I0805 10:33:03.081984 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/mgnify -> /mnt/mgnify_database_path I0805 10:33:03.082030 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/pdb70 -> /mnt/pdb70_database_path I0805 10:33:03.082076 139852172699456 run_docker.py:119] Mounting /home/mario -> /mnt/data_dir I0805 10:33:03.082118 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/pdb_mmcif -> /mnt/template_mmcif_dir I0805 10:33:03.082163 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/pdb_mmcif -> /mnt/obsolete_pdbs_path I0805 10:33:03.082205 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/uniclust30/uniclust30_2018_08 -> /mnt/uniclust30_database_path I0805 10:33:03.082247 139852172699456 run_docker.py:119] Mounting /home/mario/alphafold_databases/bfd -> /mnt/bfd_database_path Traceback (most recent call last): File "/home/mario/.local/lib/python3.8/site-packages/docker/api/client.py", line 268, in _raise_for_status response.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/containers/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "docker/run_docker.py", line 201, in app.run(main) File "/home/mario/.local/lib/python3.8/site-packages/absl/app.py", line 312, in run _run_main(main, args) File "/home/mario/.local/lib/python3.8/site-packages/absl/app.py", line 258, in _run_main sys.exit(main(argv)) File "docker/run_docker.py", line 173, in main container = client.containers.run( File "/home/mario/.local/lib/python3.8/site-packages/docker/models/containers.py", line 811, in run container = self.create(image=image, command=command, File "/home/mario/.local/lib/python3.8/site-packages/docker/models/containers.py", line 870, in create resp = self.client.api.create_container(**create_kwargs) File "/home/mario/.local/lib/python3.8/site-packages/docker/api/container.py", line 430, in create_container return self.create_container_from_config(config, name) File "/home/mario/.local/lib/python3.8/site-packages/docker/api/container.py", line 441, in create_container_from_config return self._result(res, True) File "/home/mario/.local/lib/python3.8/site-packages/docker/api/client.py", line 274, in _result self._raise_for_status(response) File "/home/mario/.local/lib/python3.8/site-packages/docker/api/client.py", line 270, in _raise_for_status raise create_api_error_from_http_exception(e) File "/home/mario/.local/lib/python3.8/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/containers/create: Bad Request ("invalid mount config for type "bind": bind source path does not exist: /tmp/alphafold")

mglgc avatar Aug 05 '21 12:08 mglgc

Manually create the /tmp/alphafold folder by yourself and run it again

wttat avatar Aug 05 '21 14:08 wttat

Dear wttat, Your fix works perfectly! Thanks so much. Please alphafold maintainers, add this issue to the setup and installation documentation.

mglgc avatar Aug 06 '21 10:08 mglgc

Hi, I had a similar problem when running python3 docker/run_docker.py

docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.40/containers/create: Bad Request ("Unknown runtime specified nvidia")

AI-bio avatar Aug 08 '21 05:08 AI-bio

I had the same code "HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/containers/create" and understand that the fix is to create the tmp/alphafold. As I'm somewhat of a novice, what I don't understand is how and where. Can you please be more specific. Thanks!

stefanoliver avatar Aug 09 '21 06:08 stefanoliver

I had the same code "HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/containers/create" and understand that the fix is to create the tmp/alphafold. As I'm somewhat of a novice, what I don't understand is how and where. Can you please be more specific. Thanks!

Just type the command 'mkdir /tmp/alphafold'

mglgc avatar Aug 09 '21 10:08 mglgc

Hi, I had a similar problem when running python3 docker/run_docker.py

docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.40/containers/create: Bad Request ("Unknown runtime specified nvidia")

I had a same problem,have you solved it now?

xumamba avatar Aug 19 '21 08:08 xumamba

Hi!

I had the same error but it still appears even though I manually created the /tmp/alphafold. Any ideas on how to solve this?

ldcnop avatar Aug 23 '21 07:08 ldcnop

Hi!

I had the same error but it still appears even though I manually created the /tmp/alphafold. Any ideas on how to solve this?

Hi ldcnop, please check you /etc/docker/daemon.json file and compare it with Nvidia guide For some reason I had "nvidia-container-runtime" in path instead of "/usr/bin/nvidia-container-runtime". It works after changes.

TimurGimadiev avatar Sep 15 '21 13:09 TimurGimadiev

I have the same issue as @Dstspe: docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/containers/create: Bad Request ("Unknown runtime specified nvidia") /tmp/alphafold was already present. Changed /etc/docker/daemon.json as @TimurGimadiev suggested but it didn't work out for me.

Installed on Windows Subsystem for Linux 2, I have access on CUDA and docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi works as well as other CUDA functions. I am using Docker Desktop, which may be also a reason.

@wttat do you have other suggestions?

Edit: Solved this issue by following this thread (translate to english): http://www.suikou.fs.a.u-tokyo.ac.jp/blog/2021/08/12/%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E7%89%88alphafold%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%A6docker%E5%91%A8%E3%82%8A%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E5%87%BA%E3%81%9F%E3%82%89/

Basically, I have commented out runtime='nvidia' if FLAGS.use_gpu else None, and inserted: runtime=None, device_requests=[docker.types.DeviceRequest(count=-1, capabilities=[['gpu']]) ], in docker/run_docker.py

However, I get a new issue RuntimeError: Resource exhausted: Out of memory while trying to allocate 12582912 bytes. Is it correlated with the above mentioned edit in run_docker.py?

Ozcifci avatar Oct 01 '21 12:10 Ozcifci

Hi there, is there anyone know about this?

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/docker/api/client.py", line 268, in _raise_for_status response.raise_for_status() File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.41/containers/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/docker/models/containers.py", line 812, in run detach=detach, **kwargs) File "/usr/local/lib/python3.6/site-packages/docker/models/containers.py", line 870, in create resp = self.client.api.create_container(**create_kwargs) File "/usr/local/lib/python3.6/site-packages/docker/api/container.py", line 430, in create_container return self.create_container_from_config(config, name) File "/usr/local/lib/python3.6/site-packages/docker/api/container.py", line 441, in create_container_from_config return self._result(res, True) File "/usr/local/lib/python3.6/site-packages/docker/api/client.py", line 274, in _result self._raise_for_status(response) File "/usr/local/lib/python3.6/site-packages/docker/api/client.py", line 270, in _raise_for_status raise create_api_error_from_http_exception(e) File "/usr/local/lib/python3.6/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) docker.errors.ImageNotFound: 404 Client Error for http+docker://localhost/v1.41/containers/create: Not Found ("No such image: alphafold:latest")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/docker/api/client.py", line 268, in _raise_for_status response.raise_for_status() File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.41/images/create?tag=latest&fromImage=alphafold

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "docker/run_docker.py", line 231, in app.run(main) File "/usr/local/lib/python3.6/site-packages/absl/app.py", line 312, in run _run_main(main, args) File "/usr/local/lib/python3.6/site-packages/absl/app.py", line 258, in _run_main sys.exit(main(argv)) File "docker/run_docker.py", line 214, in main 'XLA_PYTHON_CLIENT_MEM_FRACTION': '4.0', File "/usr/local/lib/python3.6/site-packages/docker/models/containers.py", line 814, in run self.client.images.pull(image, platform=platform) File "/usr/local/lib/python3.6/site-packages/docker/models/images.py", line 447, in pull repository, tag=tag, stream=True, all_tags=all_tags, **kwargs File "/usr/local/lib/python3.6/site-packages/docker/api/image.py", line 430, in pull self._raise_for_status(response) File "/usr/local/lib/python3.6/site-packages/docker/api/client.py", line 270, in _raise_for_status raise create_api_error_from_http_exception(e) File "/usr/local/lib/python3.6/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) docker.errors.ImageNotFound: 404 Client Error for http+docker://localhost/v1.41/images/create?tag=latest&fromImage=alphafold: Not Found ("pull access dd for alphafold, repository does not exist or may require 'docker login': denied: requested access to the resource is denied")

WJluluxiu avatar Dec 04 '21 08:12 WJluluxiu

Thanks for reporting the issue! We've added a more explicit check in https://github.com/deepmind/alphafold/commit/57a2455e5fab752d8df430ae1d0334e1a21b548c to ensure that a source directory exists before starting the Docker container.

Augustin-Zidek avatar Jan 28 '22 10:01 Augustin-Zidek

I have the same issue as @Dstspe: docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/containers/create: Bad Request ("Unknown runtime specified nvidia") /tmp/alphafold was already present. Changed /etc/docker/daemon.json as @TimurGimadiev suggested but it didn't work out for me.

Installed on Windows Subsystem for Linux 2, I have access on CUDA and docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi works as well as other CUDA functions. I am using Docker Desktop, which may be also a reason.

@wttat do you have other suggestions?

Edit: Solved this issue by following this thread (translate to english): http://www.suikou.fs.a.u-tokyo.ac.jp/blog/2021/08/12/%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E7%89%88alphafold%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%A6docker%E5%91%A8%E3%82%8A%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E5%87%BA%E3%81%9F%E3%82%89/

Basically, I have commented out runtime='nvidia' if FLAGS.use_gpu else None, and inserted: runtime=None, device_requests=[docker.types.DeviceRequest(count=-1, capabilities=[['gpu']]) ], in docker/run_docker.py

However, I get a new issue RuntimeError: Resource exhausted: Out of memory while trying to allocate 12582912 bytes. Is it correlated with the above mentioned edit in run_docker.py?

In wsl2, I used dockerd to set nvidia-runtime, and have the same problem.

zququ avatar Jan 28 '22 18:01 zququ