Reputation: 450
I'm trying to install a package onto Pycharm using PIP. I am running Anacondas on a Pycharm IDE. I know that you use the project interpreter to install packages and I also know that the package should be located under PyPi but when I go to the project interpreter and click add package the package I'm trying to install doesn't appear under the list of available packages.
I know that you can install the package using PIP and I have PIP installed through Anaconda although I am unsure how to run a pip command through Pycharm. I've tried typing it into the cmd console and the python code and neither seems to have any effect...
The package I'm trying to install is: https://github.com/seatgeek/fuzzywuzzy.
The pip command to install it is: pip install fuzzywuzzy
but I am unsure as to where I'm supposed to run that command.
I'm fairly new at Python so any help would be much appreciated!
Thank you!
Upvotes: 6
Views: 54482
Reputation: 408
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'])
Upvotes: 4
Reputation: 23
You could do
python -m pip install packagename
From https://pip.pypa.io/en/stable/getting-started/
Upvotes: 0
Reputation: 1
Open the terminal from within the pycharm project and run the command there. The opened terminal will activate the proper virtual environment.
Upvotes: 0
Reputation: 375
I was with the same problem, all i did was : Configure the project interpreter to the Python3 inside the venv you are using the pip install. Remember to activate the venv. That's it , now you can use the pip install on pycharm or on prompot. The problem is that even with the "venv/lib/sitepackeges" in the your project's sys.path the pycharm looks only for the packages where the project interpreter is.
Upvotes: 0
Reputation: 450
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.
Upvotes: 3