This is guide for installing the pip packages from Python Console in Pycharm IDE.
Do not forget to run Pycharm as administrator if you are using windows OS before installing the packages.
First of all import the pacakage of pip in python console.
import pip
Installation of Package.
pip.main(['install', '<package_name>'])
Examples
The below command will upgrade the version of package setuptools.
pip.main(['install','--upgrade','setuptools'])
The below command will install the scikit-learn and numpy packages.
pip.main(['install','numpy','scikit-learn'])
The below command will uninstall the scikit-learn package.
pip.main(['uninstall','scikit-learn'])

This is guide for installing the pip packages from Python Console in Pycharm IDE.
Do not forget to run Pycharm as administrator if you are using windows OS before installing the packages.
First of all import the pacakage of pip in python console.
import pip
Installation of Package.
pip.main(['install', '<package_name>'])
Examples
The below command will upgrade the version of package setuptools.
pip.main(['install','--upgrade','setuptools'])
The below command will install the scikit-learn and numpy packages.
pip.main(['install','numpy','scikit-learn'])
The below command will uninstall the scikit-learn package.
pip.main(['uninstall','scikit-learn'])

I found someone else's answer that works for me:
You need to use
import pip
pip.main(['install','packagename'])
Which allows you to manually install packages through pip using Python code.
I tried to do a pip install in a Pycharm IDE it won't let me.
Installing python packages in Pycharm and cmd - Stack Overflow
What's best practice when using an IDE like PyCharm, pip install via terminal or use PyCharm's built in package installer. I'm experiencing some confusing behaviour when I compare the two methods.
Install PyCharm and pip - Python Help - Discussions on Python.org
How do I install multiple packages at once in PyCharm?
Can I install packages in PyCharm Community Edition?
Why can't PyCharm find my installed package?
I know that this is not precisely what you're asking, but PyCharm has its own built-in package manager. You should not have to use pip manually.
File->Settings->Project Interpreter https://www.jetbrains.com/help/pycharm/2016.3/installing-uninstalling-and-upgrading-packages.html
there you can manage the installed packages for the selected Python interpreter or virtualenv.
Run this command on your terminal. pip will be installed without any issue.
sudo [your package manager] install python-pip python-dev build-essential
If it is not solved. The problem might be PATH problem.
Type echo $PATH on terminal. There should be /usr/local/bin in the output. If it is not type PATH=$PATH:/usr/local/bin to add /usr/local/bin to PATH
I was following a youtube demo in which someone did a pip install in a google collab.
The pip install was: ! pip install git+https://github.com/openai/whisper.git
! pip install jiwer
It gave me an error in Pycharm.
I pip installed from CMD a python package "pip install example" and it installs to "site-packages" folder where python 3.11 is installed to.
That works and my code in pycharm runs.
Then I uninstalled in cmd using command "pip uninstall example" and reinstalled the package from within pycharm's package installer window (hit the + button, search package click install). First thing I noticed is I can't find where the package was installed to in my computer.
After that if I click run, everything works, but I can no longer run that script from the terminal as it says the package is not installed.
From now on then, should I completely ignore pycharm package install functionality and just install packages via pip from the terminal either in pycharm or CMD? Is this the done thing?
Edit: After deleting my test project to see if the below works, it doesn't! My new pycharm test project is pointing at my python install, where example package is still installed, but clicking the run button (or shift f10) yields the "no module named 'example' error. But it will run from the terminal. Please help!
I'm thinking that if I pip install via the terminal from now on, those packages will always be available so long as I point pycharm to where python is installed on my computer when creating a new project.
Thanks for reading, any advice here would be greatly appreciated.