ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
26.27k stars 1.8k forks source link

import fail: SyntaxError: invalid syntax #4014

Open SomaLily opened 3 days ago

SomaLily commented 3 days ago

I installed manim by conda install -c conda-forge manim. Imported manim and ran some examples on jupyter notebook successful last day, until raised dvisvgm not found. Then I installed and updated some depends for dvisvgm include Clipper2, FreeType2, Ghostscript, Kpathsea, potracelib, ttfautohint, woff2 , brotli , xxHash, zlib. Finally make install dvisvgm , and manim.NumberPlane().add_coordinates() run OK. But the other day (today), when import manim , it went wrong:

Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0] on linux                    
Type "help", "copyright", "credits" or "license" for more information.                                           
>>> import manim                                                                                                 
Traceback (most recent call last):                                                                               
  File "<stdin>", line 1, in <module>                                                                            
  File "/home/soma/gs/envs/opt/lib/python3.12/site-packages/manim/__init__.py", line 51, in <module>             
    from .mobject.graph import *                                                                                 
  File "/home/soma/gs/envs/opt/lib/python3.12/site-packages/manim/mobject/graph.py", line 14, in <module>        
    import networkx as nx                                                                                        
  File "/home/soma/gs/envs/opt/lib/python3.12/site-packages/networkx/__init__.py", line 23, in <module>          
    config = utils.backends._set_configs_from_environment()                                                      
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                      
  File "/home/soma/gs/envs/opt/lib/python3.12/site-packages/networkx/utils/backends.py", line 574, in _set_configs_from_environment                                                                                               
    backends=Config(                                                                                             
             ^^^^^^^                                                                                             
  File "/home/soma/gs/envs/opt/lib/python3.12/site-packages/networkx/utils/configs.py", line 84, in __new__      
    cls = dataclass(                                                                                             
          ^^^^^^^^^^                                                                                             
  File "/home/soma/gs/envs/opt/lib/python3.12/dataclasses.py", line 1265, in wrap                                
    return _process_class(cls, init, repr, eq, order, unsafe_hash,                                               
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                               
  File "/home/soma/gs/envs/opt/lib/python3.12/dataclasses.py", line 1063, in _process_class                      
    _init_fn(all_init_fields,                                                                                    
  File "/home/soma/gs/envs/opt/lib/python3.12/dataclasses.py", line 619, in _init_fn                             
    return _create_fn('__init__',                                                                                
           ^^^^^^^^^^^^^^^^^^^^^^                                                                                
  File "/home/soma/gs/envs/opt/lib/python3.12/dataclasses.py", line 473, in _create_fn                           
    exec(txt, globals, ns)                                                                                       
  File "<string>", line 1                                                                                        
    def __create_fn__(__dataclass_type_nx-loopback__, __dataclass_HAS_DEFAULT_FACTORY__, __dataclass_builtins_object__, __dataclass_return_type__):                                                                               
                                         ^                                                                       
SyntaxError: invalid syntax                                                                                      

I've try reinstall manim but not work. May it a C lib issue? Which lib?

SomaLily commented 3 days ago

it's strange when I change my env to another, and conda install than import goes well !!!!

Python 3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:22) [GCC 12.3.0] on linux                    
Type "help", "copyright", "credits" or "license" for more information.                                           
>>> import manim
>>> manim.__version__                                                                                            
'0.18.1'                   

Hope won't went wrong next day.