Why i am seeing these message

I can’t install any python packages. why this occurs

The first syntax (!) is correct for running arbitrary shell commands in IPython.

However, it looks like the system python is being used, e.g. /usr/bin/python which generally is not what one should use for interactive computing (or at least interactive package management), as this can leave a linux system in an unusable state. Using !apt is… fine, but generally is a non-portable solution (e.g. to any other linux distribution, much less operating system).

It is generally recommended to create a secondary python environment to hold Jupyter-related tools, managed:

  • with the system python’s virtualenv or
  • with a secondary distribution, such as miniforge (downloads)