Raspberry pi website provided a venv workaround
This error is generated because you’re trying to install a third-party package into the system Python. A long-standing practical problem for Python users has been conflicts between OS package managers like apt
and Python-specific package management tools like pip
. These conflicts include both Python-level API incompatibilities and conflicts over file ownership.
Therefore from Bookworm onwards, packages installed via pip
must be installed into a Python virtual environment using venv
. A virtual environment is a container where you can safely install third-party modules so they won’t interfere with, or break, your system Python.
Using a separate environment for each user
An alternative method to creating a virtual environment for each of your Python projects is to create a single virtual environment for your user account, and then activate that environment before running any of your Python code. This approach may be preferred if you commonly install the same set of modules for each project, and don’t want to have to bother creating individual Python environments for each project, essentially just duplicating your environment.
$ python -m venv ~/.env
$ source ~/.env/bin/activate
(.env) $pip install dash
$python3
>>>import dash
the above works.
I just need to remember to deactivate afterwards