ModuleNotFoundError: No module named 'pkg_resources'
Describe the error
Followed this to install manim on arch, had to use pipx instead of pip because you can't use pip to install like that on arch (externally managed environment), when I run manim checkhealth it's fully able to render a test scene, however when checking out the example_scenes.py and running manim example_scenes.py OpeningManimExample as suggested, I get a module error. I tried reinstalling python-setuptools, but to no avail.
Why might it render the checkhealth test scene and not this?
EDIT:
Tried with pipx install manimgl, and getting the same issue with manimgl example_scenes.py OpeningManimExample, included the error below.
Code and Error
Code: example_scenes.py OpeningManimExample from this repository.
Error:
manim example_scenes.py OpeningManimExample
Manim Community v0.18.1
Traceback (most recent call last):
File "/home/pete/.local/bin/manim", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/manim/cli/render/commands.py", line 116, in render
for SceneClass in scene_classes_from_file(file):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/manim/utils/module_ops.py", line 131, in scene_classes_from_file
module = get_module(file_path)
^^^^^^^^^^^^^^^^^^^^^
File "/home/pete/.local/share/pipx/venvs/manim/lib/python3.12/site-packages/manim/utils/module_ops.py", line 54, in get_module
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/pete/Documents/repos/manim/example_scenes.py", line 1, in <module>
from manimlib import *
File "/home/pete/Documents/repos/manim/manimlib/__init__.py", line 1, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
manimgl example_scenes.py OpeningManimExample
Traceback (most recent call last):
File "/home/pete/.local/bin/manimgl", line 5, in <module>
from manimlib.__main__ import main
File "/home/pete/.local/share/pipx/venvs/manimgl/lib/python3.12/site-packages/manimlib/__init__.py", line 1, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Environment
OS System: Arch Linux x86_64, Kernel: 6.8.7-arch1-2 manim version: Manim Community v0.18.1 python version: Python 3.12.3
ManimGL and Manim Community are two different Manim versions. When you run manim checkhealth, you call upon the Manim Community version. And when you do manimgl you call the ManimGL. They may also conflict with each other sometimes. However, I had the same issue, and I fixed it by installing setuptools, run pip install setuptools.
For more information why, this was suggested here.
Hope it helps.
I ended up having to use pipx to "inject" the module, can't remember the exact command as it was a while ago. This is seemingly just an Arch issue due to how Arch uses pacman to manage python packages.
its not only an arch issue i also have it on Windows i used pip install setuptools to fix it.
its not only an arch issue i also have it on Windows i used
pip install setuptoolsto fix it.
The specific issue I'm talking about is relatively specific to Arch.
For arch users I believe I ran pipx inject manim setuptools, though this was a while ago now.