pythonpython-importursina

Python not recognizing Ursina


Whenever I try to import the module ursina in python, it says that the module is not found.
When executing pip install ursina, it says Defaulting to user installation because normal site-packages is not writeable and then says that the requirements are already satisfied.
Code:

import ursina

Output:

ModuleNotFoundError: No module named 'ursina'

I can only run import ursina when using the python command in cmd, but it just kinda freezes and I have to stop it using Ctrl C. Using Ctrl C gave me this traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\__init__.py", line 11, in <module>
    from ursina.camera import instance as camera
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\camera.py", line 188, in <module>
    instance = Camera()
               ^^^^^^^^
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\ursinastuff.py", line 230, in __call__
    obj = type.__call__(cls, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\camera.py", line 36, in __init__
    self.overlay = Entity(parent=self.ui, model='quad', scale=99, color=color.clear, eternal=True, z=-99, add_to_scene_entities=False)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\ursinastuff.py", line 230, in __call__
    obj = type.__call__(cls, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\entity.py", line 107, in __init__
    setattr(self, key, kwargs[key])
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\entity.py", line 198, in model_setter
    m = load_model(value, application.asset_folder)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oaoao\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ursina\mesh_importer.py", line 52, in load_model
    for filename in path.glob(f'**/{name}{filetype}'):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1094, in glob
    for p in selector.select_from(self):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 237, in _select_from
    for p in successor_select(starting_point, scandir):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 204, in _select_from
    with scandir(parent_path) as scandir_it:
         ^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1063, in _scandir
    return os.scandir(self)
           ^^^^^^^^^^^^^^^^
KeyboardInterrupt

This could be caused by conflics as I had reinstalled ms-store python to fix the python command.


Solution

  • I solved the problem by deleting the conflicting ms-store python, the freeze part was just python being slow I think.