Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when installing ManimPango via pip on windows #76

Closed
YishiMichael opened this issue Feb 23, 2022 · 13 comments
Closed

Error when installing ManimPango via pip on windows #76

YishiMichael opened this issue Feb 23, 2022 · 13 comments
Labels
windows If the problem is on windows.

Comments

@YishiMichael
Copy link

YishiMichael commented Feb 23, 2022

Recently I'm attempting to refactor Text class in manimgl, and the job requires me to clone into ManimPango and rewrite it to fit the new structure for Text. I had a problem when installing ManimPango via pip on my Windows. I followed instructions in README, and an error popped out while running pip install -e ., which is listed as follows:

Obtaining file:///E://ManimKindergarten/ManimPango
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: D:/msys64/mingw64/bin/python.exe D:/msys64/mingw64/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel C:/Users/Michael/AppData/Local/Temp/tmprw4q63fg
       cwd: E:/ManimKindergarten/ManimPango
  Complete output (31 lines):
  Failed to open 'D:/msys64/mingw64/lib/pkgconfig\freetype2.pc': Too many open files
  Package 'freetype2', required by 'harfbuzz', not found
  Traceback (most recent call last):
    File "setup.py", line 130, in check_min_version
      check_call(command, stdout=subprocess.DEVNULL)
    File "D:/msys64/mingw64/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['pkg-config', '--print-errors', '--atleast-version', '1.30.0', 'pangocairo']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 280, in <module>
      main()
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
      self.run_setup()
    File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
      super(_BuildMetaLegacyBackend,
    File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 197, in <module>
      _pkg_config_pangocairo.check_min_version(MINIMUM_PANGO_VERSION)
    File "setup.py", line 133, in check_min_version
      raise RequiredDependencyException(f"{self.name} >= {version} is required")
  __main__.RequiredDependencyException: pangocairo >= 1.30.0 is required

I saw another similar issue #53, but it seems that it's already fixed. So it seems wierd to me. And, installing manimgl via pip install -e . which relies on this dependency doesn't cause any problem. I've checked that MSYS2 MINGW64 shell was used to execute commands.

Any help will be appreciated :D

@behackl
Copy link
Member

behackl commented Feb 23, 2022

Hey @YishiMichael! More of a general comment than a concrete solution for your issue here:

@naveen521kk also has put some thought into refactoring Text, not sure what the current status is but you can find a sketch of the plans at ManimCommunity/manim#2355. To avoid further fragmentation between Grant's personal version of Manim and the community version, we should try to stick to the same version of ManimPango, meaning that all changes to the interface should also be ported to ManimCommunity/manim. We'd certainly love to have you as a contributor! :-) (And even if you prefer to stick to 3b1b/manim, I'm sure we will find a suitable way for collaborating.)

@YishiMichael
Copy link
Author

@behackl Yeah I'd like to contribute to ManimCE as well!
I've read #2355 and was pleased to see the new implementation design. I'm looking forward to collaborating with manim community, started with Text class.

@naveen521kk
Copy link
Member

Thanks for the contribution. As @behackl mentioned it would be great if the changes you do on Grant's version related to ManimPango/Text API be ported to ManimCommunity/manim.

Also, I have been planning to refactor the Text API ManimCommunity/manim#2355 and also have thoughts to provide a stable API here #28; suggestions about them welcome. I have been waiting for the refactor period (which we announced a while ago) to be done, but it seems like we won't have anything like it anytime soon; which means I would start working on it anytime soon (probably after the exams which will end by march).

Failed to open 'D:/msys64/mingw64/lib/pkgconfig\freetype2.pc': Too many open files
Package 'freetype2', required by 'harfbuzz', not found

This is the error from pkg-config, which seems like just restarting your computer and re-running the install should fix it.

@YishiMichael
Copy link
Author

It doesn't work... But thanks for replying. I may try other means.

@naveen521kk
Copy link
Member

It doesn't work... But thanks for replying. I may try other means.

Maybe try running pacman -Qkq in that shell to check whether all the files are installed correctly? Also, try running pkg-config --libs --cflags pangocairo manually on that shell to see if it errors out in that case?

@YishiMichael
Copy link
Author

It goes into error when I run pkg-config --libs --cflags pangocairo. The message is

$ pkg-config --libs --cflags pangocairo
Failed to open 'D:/msys64/mingw64/lib/pkgconfig\freetype2.pc': Too many open files
Package 'freetype2', required by 'harfbuzz', not found

@naveen521kk
Copy link
Member

Does the pacman command suceed? Also, does a file called D:/msys64/mingw64/lib/pkgconfig\freetype2.pc exists?

@naveen521kk
Copy link
Member

Also, what does pkg-config --version and which pkg-config commands print?

@YishiMichael
Copy link
Author

The file D:/msys64/mingw64/lib/pkgconfig/freetype2.pc exists. And here's the output:

$ pacman -Qkq
mingw-w64-x86_64-make /mingw64/bin/mingw32-make.exe

$ pkg-config --version
0.23

$ which pkg-config
/mingw64/bin/pkg-config

@naveen521kk
Copy link
Member

naveen521kk commented Feb 24, 2022

Hmm, I'm wondering why pkg-config is used instead of pkgconf, I remember they replaced pkgconf by default. Did you ever update the packages there ie run (pacman -Syu)? If yes, can you run pacman -S mingw-w64-x86_64-pkgconf and then press yes for all questions asked from Pacman. If not, please update first using pacman -Syu, it should ask about replacement and just input yes there.

Doing so should fix the issue I think.

@naveen521kk naveen521kk added the windows If the problem is on windows. label Feb 24, 2022
@YishiMichael
Copy link
Author

YishiMichael commented Feb 24, 2022

I've run the commands provided, i.e.

$ pacman -Syu
$ pacman -S mingw-w64-x86_64-pkgconf

I've also restarted my computer.
They worked --- the error changed :(
Listed here:

$ pip install -e .
Obtaining file:///E://ManimKindergarten/ManimPango
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Installing collected packages: ManimPango
  Running setup.py develop for ManimPango
    ERROR: Command errored out with exit status 1:
     command: D:/msys64/mingw64/bin/python.exe -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:/ManimKindergarten/ManimPango/setup.py'"'"'; __file__='"'"'E:/ManimKindergarten/ManimPango/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: E:/ManimKindergarten/ManimPango/
    Complete output (17 lines):
    running develop
    C:/Users/Michael/AppData/Local/Temp/pip-build-env-2qi7q51c/overlay/lib/python3.9/site-packages/setuptools/command/easy_install.py:160: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    C:/Users/Michael/AppData/Local/Temp/pip-build-env-2qi7q51c/overlay/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running egg_info
    writing ManimPango.egg-info/PKG-INFO
    writing dependency_links to ManimPango.egg-info/dependency_links.txt
    writing top-level names to ManimPango.egg-info/top_level.txt
    reading manifest file 'ManimPango.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    adding license file 'LICENSE'
    writing manifest file 'ManimPango.egg-info/SOURCES.txt'
    running build_ext
    building 'manimpango.cmanimpango' extension
    error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
    ----------------------------------------
ERROR: Command errored out with exit status 1: D:/msys64/mingw64/bin/python.exe -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:/ManimKindergarten/ManimPango/setup.py'"'"'; __file__='"'"'E:/ManimKindergarten/ManimPango/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

@naveen521kk
Copy link
Member

Now the problem is https://www.msys2.org/news/#2021-12-21-potential-incompatibilities-with-newer-python-setuptools I should've updated the README file about it. Simply, running export SETUPTOOLS_USE_DISTUTILS=stdlib before the pip command should work.

@YishiMichael
Copy link
Author

Many thanks for your patience!! It's finally installed successfully.

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

No branches or pull requests

3 participants