Skip to content

Conversation

smit-io
Copy link

@smit-io smit-io commented Dec 21, 2024

No description provided.

@smit-io
Copy link
Author

smit-io commented Dec 21, 2024

I couldn't get the docker container to run, tried to build one using the Dockerfile but it wouldn't work.
So, I fixed some dependencies and updates readme.md to customize the fonts with a simple docker command.

@tonsky
Copy link
Owner

tonsky commented Dec 21, 2024

Just tried on fresh checkout of Fira Code -- it still works for me. What was the error you were seeing?

@smit-io
Copy link
Author

smit-io commented Dec 23, 2024

I can't get the image to build using the Dockerfile.

I figured this is because of FROM:python:3 which pulls latest python 3 image which is not compatible with some of the older libraries such as Pillow, request, urllib.

[+] Building 17.0s (7/8)                                                                                 docker:default
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 353B                                                                               0.0s
 => [internal] load metadata for docker.io/library/python:3                                                        1.9s
 => [auth] library/python:pull token for registry-1.docker.io                                                      0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [1/4] FROM docker.io/library/python:3@sha256:9255d1993f6d28b8a1cd611b108adbdfa38cb7ccc46ddde8ea7d734b6c845e32  0.0s
 => CACHED [2/4] WORKDIR /opt                                                                                      0.0s
 => ERROR [3/4] RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20  15.0s
------
 > [3/4] RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0:
6.657 Collecting Pillow==5.4.1
6.945   Downloading Pillow-5.4.1.tar.gz (16.0 MB)
7.379      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.0/16.0 MB 42.8 MB/s eta 0:00:00
7.753   Installing build dependencies: started
14.46   Installing build dependencies: finished with status 'done'
14.46   Getting requirements to build wheel: started
14.61   Getting requirements to build wheel: finished with status 'error'
14.61   error: subprocess-exited-with-error
14.61
14.61   × Getting requirements to build wheel did not run successfully.
14.61   │ exit code: 1
14.61   ╰─> [24 lines of output]
14.61       Traceback (most recent call last):
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
14.61           main()
14.61           ~~~~^^
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
14.61           json_out['return_val'] = hook(**hook_input['kwargs'])
14.61                                    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
14.61           return hook(config_settings)
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
14.61           return self._get_build_requires(config_settings, requirements=[])
14.61                  ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
14.61           self.run_setup()
14.61           ~~~~~~~~~~~~~~^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 522, in run_setup
14.61           super().run_setup(setup_script=setup_script)
14.61           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 320, in run_setup
14.61           exec(code, locals())
14.61           ~~~~^^^^^^^^^^^^^^^^
14.61         File "<string>", line 188, in <module>
14.61         File "<string>", line 178, in get_version
14.61       KeyError: '__version__'
14.61       [end of output]
14.61
14.61   note: This error originates from a subprocess, and is likely not a problem with pip.
14.88 error: subprocess-exited-with-error
14.88
14.88 × Getting requirements to build wheel did not run successfully.
14.88 │ exit code: 1
14.88 ╰─> See above for output.
14.88
14.88 note: This error originates from a subprocess, and is likely not a problem with pip.
------
Dockerfile:5
--------------------
   3 |     WORKDIR /opt
   4 |
   5 | >>> RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0
   6 |     RUN apt-get update && \
   7 |         apt-get install -y ttfautohint && \
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0" did not complete successfully: exit code: 1

@jiangwenjiaowa
Copy link

I got the same error message when using docker to customize Fira Code.

I can't get the image to build using the Dockerfile.

I figured this is because of FROM:python:3 which pulls latest python 3 image which is not compatible with some of the older libraries such as Pillow, request, urllib.

[+] Building 17.0s (7/8)                                                                                 docker:default
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 353B                                                                               0.0s
 => [internal] load metadata for docker.io/library/python:3                                                        1.9s
 => [auth] library/python:pull token for registry-1.docker.io                                                      0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [1/4] FROM docker.io/library/python:3@sha256:9255d1993f6d28b8a1cd611b108adbdfa38cb7ccc46ddde8ea7d734b6c845e32  0.0s
 => CACHED [2/4] WORKDIR /opt                                                                                      0.0s
 => ERROR [3/4] RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20  15.0s
------
 > [3/4] RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0:
6.657 Collecting Pillow==5.4.1
6.945   Downloading Pillow-5.4.1.tar.gz (16.0 MB)
7.379      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.0/16.0 MB 42.8 MB/s eta 0:00:00
7.753   Installing build dependencies: started
14.46   Installing build dependencies: finished with status 'done'
14.46   Getting requirements to build wheel: started
14.61   Getting requirements to build wheel: finished with status 'error'
14.61   error: subprocess-exited-with-error
14.61
14.61   × Getting requirements to build wheel did not run successfully.
14.61   │ exit code: 1
14.61   ╰─> [24 lines of output]
14.61       Traceback (most recent call last):
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
14.61           main()
14.61           ~~~~^^
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
14.61           json_out['return_val'] = hook(**hook_input['kwargs'])
14.61                                    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
14.61           return hook(config_settings)
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
14.61           return self._get_build_requires(config_settings, requirements=[])
14.61                  ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
14.61           self.run_setup()
14.61           ~~~~~~~~~~~~~~^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 522, in run_setup
14.61           super().run_setup(setup_script=setup_script)
14.61           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
14.61         File "/tmp/pip-build-env-1tc2oadc/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 320, in run_setup
14.61           exec(code, locals())
14.61           ~~~~^^^^^^^^^^^^^^^^
14.61         File "<string>", line 188, in <module>
14.61         File "<string>", line 178, in get_version
14.61       KeyError: '__version__'
14.61       [end of output]
14.61
14.61   note: This error originates from a subprocess, and is likely not a problem with pip.
14.88 error: subprocess-exited-with-error
14.88
14.88 × Getting requirements to build wheel did not run successfully.
14.88 │ exit code: 1
14.88 ╰─> See above for output.
14.88
14.88 note: This error originates from a subprocess, and is likely not a problem with pip.
------
Dockerfile:5
--------------------
   3 |     WORKDIR /opt
   4 |
   5 | >>> RUN pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0
   6 |     RUN apt-get update && \
   7 |         apt-get install -y ttfautohint && \
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0" did not complete successfully: exit code: 1

@jiangwenjiaowa
Copy link

TLDR: In the first line of "FiraCode-master/Dockerfile", change From python:3to From python:3.7 will solve the issue.

I figured out that in the "FiraCode-master/Dockerfile" the author used From python:3, which means the latest stable python3 image (currentlypython:3.13). I guess when the author was developing the project, the python:3 image he pulled back then was python:3.7 and he used that local image to build containers ever since. I suggest the author make the same change to his original code. @tonsky @smit-io

@tonsky
Copy link
Owner

tonsky commented Mar 4, 2025

Maybe I don’t understand the idea of Docker, but why are you trying to build your own image instead of pulling the one that is already built? Isn’t it how reproducible builds work?

@jiangwenjiaowa
Copy link

Got it! I’m still a Docker newbie and thought Dockerfile was the source of truth, but now I see the prebuilt image ensures consistency. Thanks for the clarification! 😃

@smit-io
Copy link
Author

smit-io commented Mar 6, 2025

Maybe I don’t understand the idea of Docker, but why are you trying to build your own image instead of pulling the one that is already built? Isn’t it how reproducible builds work?

I just updated the dockerfile because the one that is available can't produce the same docker image again. By including dependencies and specific python version, the dockerfile is made more robust and won't break if new python versions are released. Currently it does. So, I thought of creating a PR.

@tonsky
Copy link
Owner

tonsky commented Mar 7, 2025

Yeah, locking down Docker file makes sense of course, for the time I need to build a new one. I’ll look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants