Learn about Centmin Mod LEMP Stack today
Become a Member

Xenforo Fonttools installation for using it in Font Awesome Manager addon

Discussion in 'Forum software usage' started by Dnyan, Jun 14, 2021.

  1. Dnyan

    Dnyan Member

    106
    24
    18
    Sep 16, 2017
    Ratings:
    +36
    Local Time:
    7:25 AM
    1.17.8
    10.3.22
    I am writing this tutorial kind of post just to make help of myself in future in cases if i mess with something.

    Font Awesome Manager addon can be found at below link
    Beta - Font Awesome Manager

    First do install python 3, the instructions are well written in below article

    Sysadmin - CentOS 7 Python 2.7 will reach the end of its life on January 1st, 2020

    In case if your server GCC version is below 8 or get error while making

    make changes to below command given in above article for python installation.

    Code:
    if [[ "$(nproc)" -le '2' ]]; then time ./configure --prefix=/opt/python${python_prefixver} --with-openssl=/usr; else time ./configure --enable-optimizations --prefix=/opt/python${python_prefixver} --with-openssl=/usr; fi
    do remove


    --enable-optimizations


    so it will be

    Code:
    if [[ "$(nproc)" -le '2' ]]; then time ./configure --prefix=/opt/python${python_prefixver} --with-openssl=/usr; else time ./configure --prefix=/opt/python${python_prefixver} --with-openssl=/usr; fi
    Then do install Fonttools with following command

    Code:
    pip3 install fonttools[woff]
    Once you installed the fonttools
    Simple path to pyftsubset in above case of installation
    /home/python_projects/myproject/bin/pyftsubset

    now you can use pyftsubset in FAM.
     
  2. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
    FYI, you should be fine with just using Python 3.6 supported side by side with Python 2.7 on CentOS 7

    Just run the python 3.6 installer addon for Centmin Mod
    Code (Text):
    /usr/local/src/centminmod/addons/python36_install.sh

    Then you can call that version of pip via pip3.6 command
    Code (Text):
    pip3.6 install -U pip
    pip3.6 install fonttools
    pip3.6 install fonttools[woff]
    

    Code (Text):
     pip3.6 install fonttools
    WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
    Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
    To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
    Collecting fonttools
      Downloading fonttools-4.24.4-py3-none-any.whl (854 kB)
         |████████████████████████████████| 854 kB 19.9 MB/s
    Installing collected packages: fonttools
    Successfully installed fonttools-4.24.4
    WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
    

    Code (Text):
    pip3.6 install fonttools[woff]
    WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
    Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
    To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
    Requirement already satisfied: fonttools[woff] in /usr/local/lib/python3.6/site-packages (4.24.4)
    Collecting brotli>=1.0.1
      Downloading Brotli-1.0.9-cp36-cp36m-manylinux1_x86_64.whl (357 kB)
         |████████████████████████████████| 357 kB 13.3 MB/s
    Collecting zopfli>=0.1.4
      Downloading zopfli-0.1.8-cp36-cp36m-manylinux1_x86_64.whl (41 kB)
         |████████████████████████████████| 41 kB 1.6 MB/s
    Installing collected packages: zopfli, brotli
    Successfully installed brotli-1.0.9 zopfli-0.1.8
    WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
    

    FYI, the old script wrapper message is just telling you to change from
    Code (Text):
    pip3.6 install fonttools
    pip3.6 install fonttools[woff]
    

    to
    Code (Text):
    python3.6 -m pip install fonttools
    python3.6 -m pip install fonttools[woff]
     
  3. Chris

    Chris Premium Member Premium Member

    46
    9
    8
    Feb 27, 2015
    Ratings:
    +13
    Local Time:
    8:55 PM
    1.7
    10
    What is the path to the directory 'pyftsubset' if we follow your line @eva2000
     
  4. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
    tried just running
    Code (Text):
    updatedb
    locate pyftsubset


    edit, using verbose flag will show you where pyftsubset is installed too
    Code (Text):
    python3.6 -m pip install fonttools --force --verbose
    Using pip 21.2.4 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
    Collecting fonttools
      Using cached fonttools-4.26.2-py3-none-any.whl (870 kB)
    Installing collected packages: fonttools
      Attempting uninstall: fonttools
        Found existing installation: fonttools 4.26.2
        Uninstalling fonttools-4.26.2:
          Removing file or directory /usr/local/bin/fonttools
          Removing file or directory /usr/local/bin/pyftmerge
          Removing file or directory /usr/local/bin/pyftsubset
          Removing file or directory /usr/local/bin/ttx
          Removing file or directory /usr/local/lib/python3.6/site-packages/fontTools/
          Removing file or directory /usr/local/lib/python3.6/site-packages/fonttools-4.26.2.dist-info/
          Removing file or directory /usr/local/share/man/man1/ttx.1
          Successfully uninstalled fonttools-4.26.2
      changing mode of /usr/local/bin/fonttools to 775
      changing mode of /usr/local/bin/pyftmerge to 775
      changing mode of /usr/local/bin/pyftsubset to 775
      changing mode of /usr/local/bin/ttx to 775
    Successfully installed fonttools-4.26.2
    
     
  5. rdan

    rdan Well-Known Member

    5,371
    1,353
    113
    May 25, 2014
    Ratings:
    +2,112
    Local Time:
    9:55 AM
    Mainline
    10.2
    Any clue about this error on the default python 2.7?

    Code:
    # pip install fonttools[woff]
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
    Requirement already satisfied: fonttools[woff] in /usr/lib/python2.7/site-packages (3.44.0)
    Collecting brotli>=1.0.1; platform_python_implementation != "PyPy" and extra == "woff"
      Using cached Brotli-1.0.9-cp27-cp27mu-manylinux1_x86_64.whl (355 kB)
    Collecting zopfli>=0.1.4; extra == "woff"
      Using cached zopfli-0.1.9.zip (79 kB)
        ERROR: Command errored out with exit status 1:
         command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_qaNcl/zopfli/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_qaNcl/zopfli/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-rNXMGY
             cwd: /tmp/pip-install-_qaNcl/zopfli/
        Complete output (23 lines):
        Couldn't find index page for 'setuptools_scm' (maybe misspelled?)
        No local packages or download links found for setuptools-scm
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-install-_qaNcl/zopfli/setup.py", line 90, in <module>
            setup_requires=["setuptools_scm"],
          File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
            _setup_distribution = dist = klass(attrs)
          File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__
            self.fetch_build_eggs(attrs.pop('setup_requires'))
          File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs
            parse_requirements(requires), installer=self.fetch_build_egg
          File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve
            dist = best[req.key] = env.best_match(req, self, installer)
          File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match
            return self.obtain(req, installer) # try and download/install
          File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain
            return installer(requirement)
          File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg
            return cmd.easy_install(req)
          File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 617, in easy_install
            raise DistutilsError(msg)
        distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools-scm')
        ----------------------------------------
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    
     
  6. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
  7. rdan

    rdan Well-Known Member

    5,371
    1,353
    113
    May 25, 2014
    Ratings:
    +2,112
    Local Time:
    9:55 AM
    Mainline
    10.2
    Website says:
    FontTools requires Python 3.7 or later.

    fonttools
     
  8. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
    Have you tried with Python 3.6 in above linked instructions ?
     
  9. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
    FYI, fonttools 4.28+ need Python 3.7, but CentOS python 3.6 installs fonttools 4.27.1 fonttools
     
  10. rdan

    rdan Well-Known Member

    5,371
    1,353
    113
    May 25, 2014
    Ratings:
    +2,112
    Local Time:
    9:55 AM
    Mainline
    10.2
    Using this addon on XF2.2 and CentOS 7.9 default Python 2.7 (without the extra Python 3.6 install)

    I can just use pyftsubset with these pip install commands:
     
  11. rdan

    rdan Well-Known Member

    5,371
    1,353
    113
    May 25, 2014
    Ratings:
    +2,112
    Local Time:
    9:55 AM
    Mainline
    10.2
    By doing so... Transfonter.org vs pyftsubset local with Brotli:
    File size decrease from 16.2kb to 15kb.
    Nice :)
     
  12. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
  13. Sunka

    Sunka Well-Known Member

    1,150
    323
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +521
    Local Time:
    2:55 AM
    Nginx 1.17.9
    MariaDB 10.3.22
  14. eva2000

    eva2000 Administrator Staff Member

    49,586
    11,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,686
    Local Time:
    11:55 AM
    Nginx 1.21.x
    MariaDB 10.x
    No need to delete if you followed my post above, you'd just have fonttools installed in 2 locations

    but if you installed with below
    Code (Text):
    python3.6 -m pip install fonttools --force --verbose
    Using pip 21.2.4 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
    Collecting fonttools
      Using cached fonttools-4.26.2-py3-none-any.whl (870 kB)
    Installing collected packages: fonttools
      Attempting uninstall: fonttools
       Found existing installation: fonttools 4.26.2
       Uninstalling fonttools-4.26.2:
         Removing file or directory /usr/local/bin/fonttools
         Removing file or directory /usr/local/bin/pyftmerge
         Removing file or directory /usr/local/bin/pyftsubset
         Removing file or directory /usr/local/bin/ttx
         Removing file or directory /usr/local/lib/python3.6/site-packages/fontTools/
         Removing file or directory /usr/local/lib/python3.6/site-packages/fonttools-4.26.2.dist-info/
         Removing file or directory /usr/local/share/man/man1/ttx.1
         Successfully uninstalled fonttools-4.26.2
      changing mode of /usr/local/bin/fonttools to 775
      changing mode of /usr/local/bin/pyftmerge to 775
      changing mode of /usr/local/bin/pyftsubset to 775
      changing mode of /usr/local/bin/ttx to 775
    Successfully installed fonttools-4.26.2
    

    I believe you can uninstall via
    Code (Text):
    python3.6 -m pip uninstall fonttools