Open rrizkylubis opened 2 months ago
Hey, it might be that your environment differs when running manim via ZSH compared to via the extension (Although I don't know which bash the extension even uses). It might be that the extension tries to run manim via bash, which looks for a ~/.bashrc, which doesn't contain an export PATH="/path/to/ffmpeg/bin:$PATH"
, while zsh looks for a ~/.zshrc, which contains this line.
To fix this you might wanna try what it suggests:
Make sure to either add ffmpeg to the PATH environment variable
or set path to the ffmpeg executable under the ffmpeg header in Manim's
configuration.
There should be a way to do the second one, although I am not exactly the most familiar with Manim and its configuration. I don't know whether the first one is possible, depends on the current implementation and how the extension starts Manim.
@Rickaym could you please provide further clarification?
Have you installed FFMPEG correctly?
@Rickaym ffmpeg is installed correctly. Using the VS Code integrated terminal this is what I get:
(manim-env) rizkylubis@Rizkys-Macbook-Air Manim % which manim
/opt/anaconda3/envs/manim-env/bin/manim
(manim-env) rizkylubis@Rizkys-Macbook-Air Manim % which ffmpeg
/opt/anaconda3/envs/manim-env/bin/ffmpeg
(manim-env) rizkylubis@Rizkys-Macbook-Air Manim % echo $PATH | tr ':' '\n'
/opt/anaconda3/envs/manim-env/bin
/Users/rizkylubis/Documents/Coding_Projects/anki_to_obsidian/dist/anki_CLI
/opt/anaconda3/envs/manim-env/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/TeX/texbin
/opt/anaconda3/envs/manim-env/bin
/Users/rizkylubis/Documents/Coding_Projects/anki_to_obsidian/dist/anki_CLI
/opt/anaconda3/condabin
/Library/Frameworks/Python.framework/Versions/3.11/bin
However Manim Sideview appears to detect the conda environment but not inherit the path environment variables set by the environment. While I could manually add ffmpeg from the conda environment to the path, I really don't want to do this, the extension should inherit any path environment variables set by the environment I am in.
Manim Extension XTerm
Serves as a terminal for logging purpose.
Extension Version 0.2.15
MSV /Users/rizkylubis/Documents/Coding_Projects/Manim>"/opt/anaconda3/envs/manim-env/bin/manim" "/Users/rizkylubis/Documents/Coding_Projects/Manim/manim_test.py" SquareToCircle
/opt/anaconda3/envs/manim-env/lib/python3.10/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Manim Community v0.18.1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/anaconda3/envs/manim-env/lib/python3.10/site-packages/manim/cli/render/ │
│ commands.py:119 in render │
│ │
│ 116 │ │ for SceneClass in scene_classes_from_file(file): │
│ 117 │ │ │ try: │
│ 118 │ │ │ │ with tempconfig({}): │
│ ❱ 119 │ │ │ │ │ scene = SceneClass() │
│ 120 │ │ │ │ │ scene.render() │
│ 121 │ │ │ except Exception: │
│ 122 │ │ │ │ error_console.print_exception() │
│ │
│ /opt/anaconda3/envs/manim-env/lib/python3.10/site-packages/manim/scene/scene │
│ .py:147 in __init__ │
│ │
│ 144 │ │ │ ) │
│ 145 │ │ else: │
│ 146 │ │ │ self.renderer = renderer │
│ ❱ 147 │ │ self.renderer.init_scene(self) │
│ 148 │ │ │
│ 149 │ │ self.mobjects = [] │
│ 150 │ │ # TODO, remove need for foreground mobjects │
│ │
│ /opt/anaconda3/envs/manim-env/lib/python3.10/site-packages/manim/renderer/ca │
│ iro_renderer.py:54 in init_scene │
│ │
│ 51 │ │ self.static_image = None │
│ 52 │ │
│ 53 │ def init_scene(self, scene): │
│ ❱ 54 │ │ self.file_writer: Any = self._file_writer_class( │
│ 55 │ │ │ self, │
│ 56 │ │ │ scene.__class__.__name__, │
│ 57 │ │ ) │
│ │
│ /opt/anaconda3/envs/manim-env/lib/python3.10/site-packages/manim/scene/scene │
│ _file_writer.py:88 in __init__ │
│ │
│ 85 │ │ ) │
│ 86 │ │ # fail fast if ffmpeg is not found │
│ 87 │ │ if not ensure_executable(Path(config.ffmpeg_executable)): │
│ ❱ 88 │ │ │ raise RuntimeError( │
│ 89 │ │ │ │ "Manim could not find ffmpeg, which is required for ge │
│ 90 │ │ │ │ "For installing ffmpeg please consult https://docs.man │
│ 91 │ │ │ │ "Make sure to either add ffmpeg to the PATH environmen │
╰──────────────────────────────────────────────────────────────────────────────╯
RuntimeError: Manim could not find ffmpeg, which is required for generating
video output.
For installing ffmpeg please consult
https://docs.manim.community/en/stable/installation.html
Make sure to either add ffmpeg to the PATH environment variable
or set path to the ffmpeg executable under the ffmpeg header in Manim's
configuration.
[20859] Execution returned code=1 in 0.485 seconds returned signal null
(manim-env) /Users/rizkylubis/Documents/Coding_Projects/Manim/>echo $PATH | tr ':' '\n'
/Users/rizkylubis/Documents/Coding_Projects/anki_to_obsidian/dist/anki_CLI
/opt/anaconda3/condabin
/Library/Frameworks/Python.framework/Versions/3.11/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/TeX/texbin
Interesting. So it looks like the venv is being set properly, just that it's not picking up FFMPEG. I'll try on my side.
comment ref: https://www.youtube.com/watch?v=sFpFlMEu7OY&lc=UgwAf8EysGh04b5OTZl4AaABAg
It might be that the environment variables are shell specific. You seem to be using zsh
. Could you paste your ~/.zshrc
?
While it looks like I am using zsh
in the beginning I am actually using bash
, in both the terminal app and the VS Code Integrated terminal:
Terminal app:
Last login: Tue Oct 29 20:15:48 on ttys000
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Rizkys-Macbook-Air:~ rizkylubis$ echo $SHELL
/bin/bash
Rizkys-Macbook-Air:~ rizkylubis$
VS Code integrated terminal:
(manim-env) rizkylubis@Rizkys-Macbook-Air Manim % echo $SHELL
/bin/bash
(manim-env) rizkylubis@Rizkys-Macbook-Air Manim %
I will include both the ~/.zshrc
and ~/.bash_profile
below:
~/.zshrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH="/Users/rizkylubis/Documents/Coding_Projects/anki_to_obsidian/dist/anki_CLI:$PATH"
~/.bash_profile
# Setting PATH for Python 3.11
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}"
export PATH
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
#Path for anki_CLI
export PATH="/Users/rizkylubis/Documents/Coding_Projects/anki_to_obsidian/dist/anki_CLI:$PATH"
Same problem using Pixi instead of Conda, although I believe the mechanism is the same.
Hi,
I installed manim to a conda environment on my Mac. I activated the environment and ran it with success:
I opened the manim_test.py file in VS Code, changed the python interpreter to my manim-env. When I run the Manim Sideview extension I get this:
I have to say I am very new to coding, so am not quite sure what to do.