How to install Python package / libraries without Admin rights
Recently I faced an issue where I wanted to install a particular python library, but I did not have Admin access to install packages. The error occurred because pip was unable to create new directory for the package because of lack of privileges, it was giving Access is denied message.
One solution for this is to use executable method in sys package which will return the absolute path of the executable binary for Python against which we can run commands. We add ! (exclamation operator) in front for running it like a shell command from inside notebook, IDE or console.
Below code shows installation of kivy package.
import sys!{sys.executable} -m pip install kivy
This can be useful when you have to install python packages when your company or school has given limited privileges. I was documenting it for myself but then wrote an article as it might help someone.
Best of luck in your coding journey !
References: