I have tried importing ursina through cmd multiple times, updated pip, added newest python directories to path.
Ursina does not want to work, still.
I have tried the help that existing posts on here provided, but no solutions worked.
I installed ursina through cmd, and expected that when I did this:
from ursina import *
in the beginning of my code, it would import. It did not.
(check just in case) If
from ursina import *
is the only line being caught, it's probably your linter complaining about code efficiency and security. I haven't had these problems neither on my Windows PC nor my MacBook Pro (pyenv).If not, try these:
1. Make sure
ursina
is installed to the virtualenv (or Python environment) you are trying to run it in. UseCtrl
+Shift
+P
to pull up the command bar in VSCode, then press enter onPython: Select Interpreter
and make sure the correct environment is selected.2. Make sure you're not running
pip
orpython
with administrator privileges. This is the same withsudo
on*nix
devices working withpython
, asursina
could be installed to the Administrator account, orroot
as a Linux example.3. Make sure
ursina
is actually installed throughpip freeze
. In some cases,pip
may glich and not actually install packages correctly. Try running the commandpip freeze
and search forursina==VERSION
. If it is not there, you should try reinstalling Python (withpip
). If that does not work, try downloading someone's copy of theirursina
folder in theirsite-packages
directory to installursina
withoutpip
.4. Try upgrading
pip
. If there was a network issue, PyPI servers may have encountered an issue withursina
or other packages, and thus may have redirected clients to install wrong packages or even none at all. Run the following command to upgrade yourpip
version:python -m pip install --upgrade pip
, or in recent Python versions,pip install --upgrade pip
.5. Try creating a
virtualenv
, orvenv
. Some packages might argue with theursina
version you're trying to install, and thus may make a collision occur. Creating an isolated Python environment for each of your Python projects can save you from errors like these. I advise you create a new virtual environment throughpython -m venv
, activate the venv, then installingursina
to a fresh, clean environment dedicated for yourursina
project.6. If none works, try reinstalling Python and
pip
completely. Save your global packages throughpip freeze
and save it to a file on your desktop (or anywhere you want), and reinstall Python andpip
from the official python website. Your venvs will stay intact, only your global packages will be reset, or in other words, yoursite-packages
folder. After reinsalling, with thepip freeze
output, reinstall a few of your packages at a time to check whetherursina
works or not. It is best to use virtualenvs for all your projects, so you can either take the time to split up your Python environments, or simply combine all for simplicity.If you tried all of these, or have difficulties/errors while doing them, leave a comment and I'll try to see what's going on.
Quick Edit: You could also try reinstalling your Python-related VSC extensions, including IntelliSense, maybe that could refresh their package lists.