Skip to content

NameError: name 'Scene' is not defined #3216

@yourssmile

Description

@yourssmile

Description of bug / unexpected behavior

Hi, I installed manim following the community tutorial:
https://docs.manim.community/en/stable/installation/conda.html
And follow the tutorial:
https://docs.manim.community/en/stable/tutorials/quickstart.html
I successfully ran the circle project:
from manim import *
class CreateCircle(Scene):
def construct(self):
circle = Circle() # create a circle
circle.set_fill(PINK, opacity=0.5) # set the color and transparency
self.play(Create(circle)) # show the circle on screen

manim -pql scene.py CreateCircle

But when I want to run the SquareToCircle , failed.

Expected behavior

How to reproduce the issue

Code for reproducing the problem

class SquareToCircle(Scene):
def construct(self):
circle = Circle() # create a circle
circle.set_fill(PINK, opacity=0.5) # set color and transparency

    square = Square()  # create a square
    square.rotate(PI / 4)  # rotate a certain amount

    self.play(Create(square))  # animate the creation of the square
    self.play(Transform(square, circle))  # interpolate the square into the circle
    self.play(FadeOut(square))  # fade out animation

manim -pql scene.py SquareToCircle

Logs

Terminal output The error information is as follows:
Manim Community v0.17.3

Traceback (most recent call last):
  File "C:\Users\Pc\anaconda3\envs\mainm\Scripts\manim-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\manim\cli\render\commands.py", line 111, in render
    for SceneClass in scene_classes_from_file(file):
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\manim\utils\module_ops.py", line 129, in scene_classes_from_file
    module = get_module(file_path)
  File "C:\Users\Pc\anaconda3\envs\mainm\lib\site-packages\manim\utils\module_ops.py", line 52, in get_module
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\Manim_project\scene.py", line 1, in <module>
    class SquareToCircle(Scene):
NameError: name 'Scene' is not defined

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):Windows 10 (I have the same problem with inter i5 macos )
  • RAM:16G
  • Python version (python/py/python3 --version):3.8
  • Installed modules (provide output from pip list):
  • Package Version

attrs 22.2.0
brotlipy 0.7.0
build 0.10.0
CacheControl 0.12.11
certifi 2022.12.7
cffi 1.15.1
charset-normalizer 3.1.0
cleo 2.0.1
click 8.1.3
click-default-group 1.2.2
cloup 0.13.1
colorama 0.4.6
colour 0.1.5
crashtest 0.4.1
cryptography 38.0.4
dataclasses 0.8
decorator 5.1.1
distlib 0.3.6
dulwich 0.21.3
ffmpeg 1.4
filelock 3.11.0
future 0.18.3
glcontext 2.3.7
html5lib 1.1
idna 3.4
importlib-metadata 6.4.1
importlib-resources 5.12.0
installer 0.7.0
isosurfaces 0.1.0
jaraco.classes 3.2.3
jsonschema 4.17.3
keyring 23.13.1
lockfile 0.12.2
manim 0.17.3
ManimPango 0.4.3
mapbox-earcut 1.0.1
markdown-it-py 2.2.0
mdurl 0.1.2
moderngl 5.8.2
moderngl-window 2.4.3
more-itertools 9.1.0
msgpack 1.0.5
multipledispatch 0.6.0
networkx 2.8.8
numpy 1.24.2
packaging 23.1
pexpect 4.8.0
Pillow 9.5.0
pip 23.0.1
pkginfo 1.9.6
pkgutil_resolve_name 1.3.10
platformdirs 2.6.2
poetry 1.4.2
poetry-core 1.5.2
poetry-plugin-export 1.3.0
pooch 1.7.0
ptyprocess 0.7.0
pycairo 1.23.0
pycparser 2.21
pydub 0.25.1
pyglet 2.0.5
Pygments 2.15.0
pyOpenSSL 23.1.1
pyproject_hooks 1.0.0
pyrr 0.10.3
pyrsistent 0.19.3
PySocks 1.7.1
pywin32-ctypes 0.2.0
PyYAML 6.0
rapidfuzz 2.15.0
requests 2.28.2
requests-toolbelt 0.10.1
rich 13.3.4
scipy 1.10.1
screeninfo 0.8.1
setuptools 65.6.3
shellingham 1.5.1
six 1.16.0
skia-pathops 0.7.4
srt 3.5.3
svgelements 1.9.1
tomli 2.0.1
tomlkit 0.11.7
tqdm 4.65.0
trove-classifiers 2023.3.9
typing_extensions 4.5.0
urllib3 1.26.15
virtualenv 20.16.5
watchdog 2.3.1
webencodings 0.5.1
wheel 0.38.4
win-inet-pton 1.1.0
wincertstore 0.2
zipp 3.15.0

LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:
FFMPEG

Output of ffmpeg -version:
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with clang version 15.0.7
configuration: --prefix=/d/bld/ffmpeg_1674566436592/_h_env/Library --cc=clang.exe --cxx=clang++.exe --nm=llvm-nm --ar=llvm-ar --disable-doc --disable-openssl --enable-demuxer=dash --enable-hardcoded-tables --enable-libfreetype --enable-libfontconfig --enable-libopenh264 --ld=lld-link --target-os=win64 --enable-cross-compile --toolchain=msvc --host-cc=clang.exe --extra-libs=ucrt.lib --extra-libs=vcruntime.lib --extra-libs=oldnames.lib --strip=llvm-strip --disable-stripping --host-extralibs= --enable-gpl --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-pic --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libopus --pkg-config=/d/bld/ffmpeg_1674566436592/_build_env/Library/bin/pkg-config
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions