PiCar-V remote_control ERROR at python3 manage.py migrate, Django 3.2.19

I purchased the PiCar-V several years ago. I assembled the car, but I was never able to get the software working. Recently, I have tried again, but encountered an error during the remote_control setup step at the python3 manage.py migrate command that this stackexchange post [LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER] indicates may have something to do with my Django version 3.2.19, or maybe there’s something wrong with the way I installed Django manually when the install_dependencies script failed. Please help!

I followed the directions here:
https://docs.sunfounder.com/projects/picar-v/en/latest/
SunFounder website PiCar-V instructions

When following these instructions:
[LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER]
SunFounder servo_configuration

I encountered an error in the Install the Environment via the Script section on the sudo ./install_dependencies step:

Installing django

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit [LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER]

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Failed to installed django.
Do you want to skip this? (yes/no) no

Next, I referred to these instructions:
[LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER]
SunFounder function_of_the_server_installation_scripts

Unfortunately I encountered the same error:

pi@raspberrypi:~ $ sudo pip install django
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit [LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER]

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I continued to try to install Django, and eventually I was successful:

pi@raspberrypi:~ $ sudo apt install python3-django
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
python3-sqlparse
Suggested packages:
bpython3 geoip-database-contrib gettext ipython3 libgdal20
libsqlite3-mod-spatialite python-django-doc python3-bcrypt python3-flup
python3-pymemcache | python3-pylibmc python3-mysqldb python3-psycopg2
python3-selenium python3-sqlite python3-yaml python-sqlparse-doc
The following NEW packages will be installed:
python3-django python3-sqlparse
0 upgraded, 2 newly installed, 0 to remove and 25 not upgraded.
Need to get 2,862 kB of archives.
After this operation, 24.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 h t t p : [LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER] raspbian bookworm/main armhf python3-sqlparse all 0.4.2-1 [37.6 kB]
Get:2 h t t p : [LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER] raspbian bookworm/main armhf python3-django all 3:3.2.19-1+deb12u1 [2,824 kB]
Fetched 2,862 kB in 2s (1,206 kB/s)
Selecting previously unselected package python3-sqlparse.
(Reading database … 133035 files and directories currently installed.)
Preparing to unpack …/python3-sqlparse_0.4.2-1_all.deb …
Unpacking python3-sqlparse (0.4.2-1) …
Selecting previously unselected package python3-django.
Preparing to unpack …/python3-django_3%3a3.2.19-1+deb12u1_all.deb …
Unpacking python3-django (3:3.2.19-1+deb12u1) …
Setting up python3-sqlparse (0.4.2-1) …
Setting up python3-django (3:3.2.19-1+deb12u1) …
Processing triggers for man-db (2.11.2-2) …
pi@raspberrypi:~ $

I had a similar problem installing flask using install_dependencies, but I was able to confirm manually that that already existed:

pi@raspberrypi:~ $ sudo apt install python3-flask
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
python3-flask is already the newest version (2.2.2-3).
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.

After installing Django manually and confirming that Flask already exits, I ran sudo ./install_dependencies again, and the script completed:

Installation result:
django ./install_dependencies: line 52: False: command not found
Failed
flask ./install_dependencies: line 58: False: command not found
Failed
pip3 Success
python-smbus Success
python-opencv Success
The stuff you have change may need reboot to take effect.
Do you want to reboot immediately? (yes/no) yes

I continued following the instructions with no issues.

Then, I encountered an error when following these instructions:
[LINK NOT ALLOWED FOR NEW SUNFOUNDER FORUM USER]
SunFounder remote_control

login as: pi
pi@192.168.0.96’s password:
Linux raspberrypi 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Oct 21 11:50:58 2023 from 192.168.0.86
pi@raspberrypi:~ $ cd ~/SunFounder_PiCar-V/remote_control
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ python3 manage.py migrate
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/django/apps/config.py”, line 244, in create
app_module = import_module(app_name)
^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1206, in _gcd_import
File “”, line 1178, in _find_and_load
File “”, line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘templates’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/SunFounder_PiCar-V/remote_control/manage.py”, line 9, in
execute_from_command_line(sys.argv)
File “/usr/lib/python3/dist-packages/django/core/management/init.py”, line 419, in execute_from_command_line
utility.execute()
File “/usr/lib/python3/dist-packages/django/core/management/init.py”, line 395, in execute
django.setup()
File “/usr/lib/python3/dist-packages/django/init.py”, line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “/usr/lib/python3/dist-packages/django/apps/registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/django/apps/config.py”, line 246, in create
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Cannot import ‘templates’. Check that ‘remote_control.templates.apps.TemplatesConfig.name’ is correct.
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $

Can you please advise on how I can resolve this error?

Here are the results of pip freeze:

pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ pip freeze
arandr==0.1.11
asgiref==3.6.0
astroid==2.14.2
asttokens==2.2.1
av==10.0.0
Babel==2.10.3
beautifulsoup4==4.11.2
blinker==1.5
certifi==2022.9.24
chardet==5.1.0
charset-normalizer==3.0.1
click==8.1.3
colorama==0.4.6
colorzero==2.0
cryptography==38.0.4
cupshelpers==1.0
dbus-python==1.3.2
dill==0.3.6
distro==1.8.0
Django==3.2.19
docutils==0.19
Flask==2.2.2
gpiozero==2.0
html5lib==1.1
idna==3.3
importlib-metadata==4.12.0
isort==5.6.4
itsdangerous==2.1.2
jedi==0.18.2
Jinja2==3.1.2
lazy-object-proxy==1.9.0
lgpio==0.2.2.0
libevdev==0.5
logilab-common==1.9.8
lxml==4.9.2
MarkupSafe==2.1.2
mccabe==0.7.0
more-itertools==8.10.0
mypy==1.0.1
mypy-extensions==0.4.3
numpy==1.24.2
oauthlib==3.2.2
olefile==0.46
parso==0.8.3
pexpect==4.8.0
pgzero==1.2
picamera2==0.3.12
pidng==4.0.9
piexif==1.1.3
pigpio==1.78
Pillow==9.4.0
platformdirs==2.6.0
psutil==5.9.4
ptyprocess==0.7.0
pycairo==1.20.1
pycups==2.0.1
pygame==2.1.2
Pygments==2.14.0
PyGObject==3.42.2
pyinotify==0.9.6
PyJWT==2.6.0
pylint==2.16.2
PyOpenGL==3.1.6
pyOpenSSL==23.0.0
PyQt5==5.15.9
PyQt5-sip==12.11.1
pyserial==3.5
pysmbc==1.0.23
python-apt==2.6.0
python-dotenv==0.21.0
python-prctl==1.8.1
pytz==2022.7.1
pyudev==0.24.0
reportlab==3.6.12
requests==2.28.1
requests-oauthlib==1.3.0
responses==0.18.0
roman==3.3
RPi.GPIO==0.7.1a4
RTIMULib==7.2.1
Send2Trash==1.8.1b0
sense-hat==2.4.0
simplejpeg==1.6.6
simplejson==3.18.3
six==1.16.0
smbus2==0.4.2
soupsieve==2.3.2
spidev==3.5
sqlparse==0.4.2
ssh-import-id==5.10
SunFounder-PiCar==1.0.1
thonny==4.1.3
toml==0.10.2
tomlkit==0.11.7
twython==3.8.2
types-aiofiles==22.1
types-annoy==1.17
types-appdirs==1.4
types-aws-xray-sdk==2.10
types-babel==2.11
types-backports.ssl-match-hostname==3.7
types-beautifulsoup4==4.11
types-bleach==5.0
types-boto==2.49
types-braintree==4.17
types-cachetools==5.2
types-caldav==0.10
types-certifi==2021.10.8
types-cffi==1.15
types-chardet==5.0
types-chevron==0.14
types-click-spinner==0.1
types-colorama==0.4
types-commonmark==0.9
types-console-menu==0.7
types-contextvars==2.4
types-croniter==1.3
types-cryptography==3.3
types-D3DShot==0.1
types-dateparser==1.1
types-DateTimeRange==1.2
types-decorator==5.1
types-Deprecated==1.2
types-dj-database-url==1.0
types-docopt==0.6
types-docutils==0.19
types-editdistance==0.6
types-emoji==2.1
types-entrypoints==0.4
types-first==2.0
types-flake8-2020==1.7
types-flake8-bugbear==22.10.27
types-flake8-builtins==2.0
types-flake8-docstrings==1.6
types-flake8-plugin-utils==1.3
types-flake8-rst-docstrings==0.2
types-flake8-simplify==0.19
types-flake8-typing-imports==1.14
types-Flask-Cors==3.0
types-Flask-SQLAlchemy==2.5
types-fpdf2==2.5
types-gdb==12.1
types-google-cloud-ndb==1.11
types-hdbcli==2.14
types-html5lib==1.1
types-httplib2==0.21
types-humanfriendly==10.0
types-invoke==1.7
types-JACK-Client==0.5
types-jmespath==1.0
types-jsonschema==4.17
types-keyboard==0.13
types-ldap3==2.9
types-Markdown==3.4
types-mock==4.0
types-mypy-extensions==0.4
types-mysqlclient==2.1
types-oauthlib==3.2
types-openpyxl==3.0
types-opentracing==2.4
types-paho-mqtt==1.6
types-paramiko==2.11
types-parsimonious==0.10
types-passlib==1.7
types-passpy==1.0
types-peewee==3.15
types-pep8-naming==0.13
types-Pillow==9.3
types-playsound==1.3
types-polib==1.1
types-prettytable==3.4
types-protobuf==3.20
types-psutil==5.9
types-psycopg2==2.9
types-pyaudio==0.2
types-PyAutoGUI==0.9
types-pycurl==7.45
types-pyfarmhash==0.3
types-pyflakes==2.5
types-Pygments==2.13
types-pyinstaller==5.6
types-PyMySQL==1.0
types-pynput==1.7
types-pyOpenSSL==22.1
types-pyRFC3339==1.1
types-PyScreeze==0.1
types-pysftp==0.2
types-pytest-lazy-fixture==0.6
types-python-crontab==2.6
types-python-dateutil==2.8
types-python-gflags==3.1
types-python-jose==3.3
types-python-nmap==0.7
types-python-slugify==6.1
types-pytz==2022.6
types-pyvmomi==7.0
types-pywin32==304
types-PyYAML==6.0
types-redis==4.3
types-regex==2022.10.31
types-requests==2.28
types-retry==0.9
types-Send2Trash==1.8
types-setuptools==65.5
types-simplejson==3.17
types-singledispatch==3.7
types-six==1.16
types-slumber==0.7
types-SQLAlchemy==1.4.43
types-stdlib-list==0.8
types-stripe==3.5
types-tabulate==0.9
types-termcolor==1.1
types-toml==0.10
types-toposort==1.7
types-tqdm==4.64
types-tree-sitter==0.20
types-tree-sitter-languages==1.5
types-ttkthemes==3.2
types-typed-ast==1.5
types-tzlocal==4.2
types-ujson==5.5
types-urllib3==1.26
types-vobject==0.9
types-waitress==2.1
types-whatthepatch==1.0
types-xmltodict==0.13
types-xxhash==3.0
types-zxcvbn==4.4
typing_extensions==4.4.0
urllib3==1.26.12
v4l2-python3==0.3.2
webencodings==0.5.1
Werkzeug==2.2.2
wrapt==1.14.1
zipp==1.0.0
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $

What version of Raspberry Pi system are you using.
It is recommended to use the system version updated on 2023-05-03, the recently updated version 2023-10-10 is not compatible with our products.
About how to download to the previous version is as follows:

Burn the system to the SD card using the burn tool.
Then enter the Raspberry Pi system and follow our picar-V tutorial on the terminal to install the source code.