Search code examples
pythonpython-3.xpymunk

pymunk verification test failing after fresh installation


I tried installing pymunk, but the installation verification test (python -m pymunk.tests test) is failing with:

>python -m pymunk.tests test
Traceback (most recent call last):
  File "C:\Users\ayrto\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\ayrto\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\ayrto\pymunk.py", line 4, in <module>
    space = pymunk.Space()      # Create a Space which contain the simulation
AttributeError: partially initialized module 'pymunk' has no attribute 'Space' (most likely due to a circular import) 

I am running Python 3.8.3 in Win 10.

pymunk version:

pip install pymunk
Requirement already satisfied: pymunk in c:\users\\appdata\local\programs\python\python38\lib\site-packages (5.6.0)
Requirement already satisfied: cffi!=1.13.1 in c:\users\\appdata\local\programs\python\python38\lib\site-packages (from pymunk) (1.14.0)
Requirement already satisfied: pycparser in c:\users\\appdata\local\programs\python\python38\lib\site-packages (from cffi!=1.13.1->pymunk) (2.20)


Solution

  • You have a local file named "pymunk.py". That's being imported instead of pymunk. Change your file name to something else.