It looks like {sys.executable} is not being read properly in your command. Make sure you use the git url by appending PAT token before username like below:-
git+https://<PAT TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git@main
Thanks to Ram-msft, When I tried to enter the entire path of sys.executable and then tried running pip install to install packages from my github it worked.
But when I used pat token before the username in the above format. The command worked successfully without entering entire path only with
!{sys.executable}
Code:-
import sys
sys.executable
Output:-

Code by explicitly mentioning the path:-
import sys
!'/anaconda/envs/azureml_py310_sdkv2/bin/python' -m pip install git+https://<pat-token>@github.com/<username>/<repository-name>.git@main
Output:-

Code with !{sys.executable}:-
import sys
!{sys.executable} -m pip install git+https://<PAT TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git@main
Output:-

Also, Make sure you have an appropriate packages in setup.py file in your github account from where you're importing the packages.
my setup.py file :-
from setuptools import setup, find_packages
setup(
name='pycode',
version='0.1',
packages=find_packages(),
install_requires=[
'numpy',
'pandas',
'scikit-learn'
],
entry_points={
'console_scripts': [
'pycode=pycode.cli:main'
]
}
)