Ursina not importing in python
Question:
I’m getting error:
Traceback (most recent call last):
File "C:UsersuserDownloadsblockymain.py", line 1, in <module>
import ursina as ue
ModuleNotFoundError: No module named 'ursina'
I tried:
pip install ursina
wait I also did
python -m pip install ursina
Answers:
Since you’re using import ursina as (custom name), you currently importing ursina as a local namespace and doing this will be annoying for most beginners.
Example: (namespace).function()/PACKAGE CONTENT.function()
I recommend that you use from ursina import *
because this will extract everything and remove the need for namespace on every function/PACKAGE CONTENT.
Example: function()/PACKAGE CONTENT.function()
Also, try reinstalling python.
Try using pipwin.
First do
pip install pipwin,
Then do pipwin install ursina
use this instead
from ursina import *
app= Ursina()
(code)
app.run()
this will help your issue
You must have any other libraries installed in the same virtual
environment or the default, that causes conflict with ‘ursina’
Try store the libraries u use in the project in a new empty virtual environment
1, Install https://pypi.org/project/virtualenv/
pip install virtualenv
2, Create a new folder for your environment (by convention it is advisable to call it venv.) locate the folder with the console
source /python -m virtualenv .
3, Active (to deactivate it would be the same but in the end it is placed deactivate.)
— in Windows
source /venv/Scripts/activate
— in Linux
source /venv/bin/activate
the name of the virtual environment will appear at the beginning of the line in the command terminal, (venv in this case).
4, To see the packages that we have installed in our virtual environment we execute the following command:
(venv) source /pip list
5, install ‘ursina’ n all the libs u need
(venv) source /pip install ursina
I’m getting error:
Traceback (most recent call last):
File "C:UsersuserDownloadsblockymain.py", line 1, in <module>
import ursina as ue
ModuleNotFoundError: No module named 'ursina'
I tried:
pip install ursina
wait I also did
python -m pip install ursina
Since you’re using import ursina as (custom name), you currently importing ursina as a local namespace and doing this will be annoying for most beginners.
Example: (namespace).function()/PACKAGE CONTENT.function()
I recommend that you use from ursina import *
because this will extract everything and remove the need for namespace on every function/PACKAGE CONTENT.
Example: function()/PACKAGE CONTENT.function()
Also, try reinstalling python.
Try using pipwin.
First do
pip install pipwin,
Then do pipwin install ursina
use this instead
from ursina import *
app= Ursina()
(code)
app.run()
this will help your issue
You must have any other libraries installed in the same virtual
environment or the default, that causes conflict with ‘ursina’
Try store the libraries u use in the project in a new empty virtual environment
1, Install https://pypi.org/project/virtualenv/
pip install virtualenv
2, Create a new folder for your environment (by convention it is advisable to call it venv.) locate the folder with the console
source /python -m virtualenv .
3, Active (to deactivate it would be the same but in the end it is placed deactivate.)
— in Windows
source /venv/Scripts/activate
— in Linux
source /venv/bin/activate
the name of the virtual environment will appear at the beginning of the line in the command terminal, (venv in this case).
4, To see the packages that we have installed in our virtual environment we execute the following command:
(venv) source /pip list
5, install ‘ursina’ n all the libs u need
(venv) source /pip install ursina