0

Ursina is successfully imported, but ursina.Ursina

from ursina import *
app = Ursina()  

Running this code results in the following error: NameError: name 'Ursina' is not defined I wondered what is defined and tried print(dir(ursina)). The output is:

['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']

Nothing seemingly more helpful under these, but I can share their methods and properties as well if you'd like.

Tried uninstalling and reinstalling Ursina and the dependencies. Tried using import ursina and using ursina.Ursina(). Tried using from ursina import Ursina. Checked the FAQ and docs. No pip error.

In Command Line, importing doesn't work and prints package_folder: ...\Python310\lib\site-packages\ursina asset_folder: . the first time. However, after Ctrl + C and trying to import the second time and quite a bit of a wait, the instantiation seems to work as a blank window is opened (ursina.Ursina is defined, you can print it too). Not so long after though, it starts to not respond. Running a Python file through Command Line, the same error is raised.

Trying with an IDE however straight up produces the same error.

Tested for Python 3.10.4 and 3.9.0 on Windows 11.

LercDsgn
  • 131
  • 12
  • The printed `package_folder` and `asset_folder` info is expected on import, although in my testing, the `asset_folder` shows an absolute path to my working directory, and not just `.` . I installed ursina into my Python3.11 playground virtual environment, and using the sample program on [https://www.ursinaengine.org/] it ran as expected. Have you tried running it in a virtual environment instead of your base install? Maybe its conflicting with some other package you have installed? – nigh_anxiety Apr 01 '23 at 19:17
  • @nigh_anxiety thought I replied to this earlier because I remember typing the answer. It might be that I forgot to send. Anyways, I tried running the file after `python -m virtualenv venv` if you mean that. Not sure if it's conflicting. Here is the output of pip-chill for Python 3.9: ```bs4==0.0.1 matplotlib==3.7.1 pip-chill==1.0.1 requests==2.28.2 timer-cli==0.1.2 ursina==5.2.0``` For 3.10 I can't run pip-chill because the pip command automatically runs for 3.9 and I couldn't find a way to switch it to 3.10 and the direct pip freeze is too long to post here. – LercDsgn Apr 03 '23 at 20:01
  • @nigh_anxiety Update: Now I reinstalled pip and it works. – LercDsgn Apr 03 '23 at 21:21
  • After creating a virtualenv, you then have to make sure you activate the environment in your terminal, and then any pip commands you run will run in the virtualenv, otherwise the commands just run on your base install. Based on the pip-chill results above it looks like some of the ursina dependencies weren't included, but its possible pip-chill doesn't list them explicitly if they were installed as dependencies. anyway, glad you got it working. – nigh_anxiety Apr 03 '23 at 22:47

1 Answers1

1

After re-installing pip, the problem was solved for me.

LercDsgn
  • 131
  • 12