How to Install a Package in PyCharm when project interpreter is set to conda, and the package is not provided/listed by conda?
Question:
I installed pycharm on my computer. I set the project interpreter to acaconda3/bin/python
because that is the python3 interpreter I used on my computer before installing pycharm. I was able to install all packages I need using pycharm’s package installer except for pydicom which is not provided by anaconda. However, pydicom, one of the packages I need for my project, is not provided by conda and hence does not show up in the list of available packages when I search.
How do I install this package that is not available with conda?
Answers:
- Open Anaconda navigator
-
Open environment from side tab
-
Open your environment which you created or choose the default( seems
in this case)
-
Choose Open in terminal
-
Run pip command here.
OR run pip by going to directory anaconda3/Scripts
directory
Since pydicom
is supported by conda-forge
channel it wont show up on Pycharm unless you add that channel to conda
environment channels manually.
Run below command for the environment
conda config --add channels conda-forge
Then it should show up in Pycharm.
Once channel added you can run below command within environment
conda install pydicom
Reference:
I don’t know if it’s identical on the Mac, but for Win 10 Pycharm, you can access the Terminal from:
View > Tool Windows > Terminal (Alt+F12)
From there, make sure the correct conda environment is active through:
conda activate <your_env>
Then, you can install a package as one normally would typing in the command line, e.g.
conda install -c conda-forge <some_thing>
The exact command changes if you’re using pip or some other manager or repository location, but it’s helpful to do it this way if you want to stay in the IDE.
Also, you can verify the package in present in File > Settings > Project: … > Python Interpreter
You should see your manually added package listed here, even though you didn’t install it through the GUI.
Using PyCharm 2020.2 I can do this without going to the terminal or Anaconda.
Go to "Settings->Project->Python Interpreter" (same place as VictorLegros went, but the UI is different now: note the + button at the bottom of the list of packages)
Hit the + button, search for your package in the new dialog and then click "Install Package"
I double checked in the Anaconda UI afterward, and – after click on Update Index.. and waiting a bit (not 100% sure that was necessary, but I didn’t see it at first) – I can now see the package "scikit-learn" that installed via PyCharm.
(Note: I’m not using Anaconda to do anything but verify: the search and installation was all in PyCharm)
I had this problem and I figured out that from the python interpreter dialogue I had to click the green circular Conda icon to disable "Use Conda Package Manager" (above the list of packages). Then when I clicked to add a package, I found all the packages I needed, which I presume were installed with pip.
I was also able to install packages that Conda needed to handle like psycopg2. Hope this helps.
I installed pycharm on my computer. I set the project interpreter to acaconda3/bin/python
because that is the python3 interpreter I used on my computer before installing pycharm. I was able to install all packages I need using pycharm’s package installer except for pydicom which is not provided by anaconda. However, pydicom, one of the packages I need for my project, is not provided by conda and hence does not show up in the list of available packages when I search.
How do I install this package that is not available with conda?
- Open Anaconda navigator
-
Open environment from side tab
-
Open your environment which you created or choose the default( seems
in this case) -
Choose
Open in terminal
-
Run pip command here.
OR run pip by going to directory anaconda3/Scripts
directory
Since pydicom
is supported by conda-forge
channel it wont show up on Pycharm unless you add that channel to conda
environment channels manually.
Run below command for the environment
conda config --add channels conda-forge
Then it should show up in Pycharm.
Once channel added you can run below command within environment
conda install pydicom
Reference:
I don’t know if it’s identical on the Mac, but for Win 10 Pycharm, you can access the Terminal from:
View > Tool Windows > Terminal (Alt+F12)
From there, make sure the correct conda environment is active through:
conda activate <your_env>
Then, you can install a package as one normally would typing in the command line, e.g.
conda install -c conda-forge <some_thing>
The exact command changes if you’re using pip or some other manager or repository location, but it’s helpful to do it this way if you want to stay in the IDE.
Also, you can verify the package in present in File > Settings > Project: … > Python Interpreter
You should see your manually added package listed here, even though you didn’t install it through the GUI.
Using PyCharm 2020.2 I can do this without going to the terminal or Anaconda.
Go to "Settings->Project->Python Interpreter" (same place as VictorLegros went, but the UI is different now: note the + button at the bottom of the list of packages)
Hit the + button, search for your package in the new dialog and then click "Install Package"
I double checked in the Anaconda UI afterward, and – after click on Update Index.. and waiting a bit (not 100% sure that was necessary, but I didn’t see it at first) – I can now see the package "scikit-learn" that installed via PyCharm.
(Note: I’m not using Anaconda to do anything but verify: the search and installation was all in PyCharm)
I had this problem and I figured out that from the python interpreter dialogue I had to click the green circular Conda icon to disable "Use Conda Package Manager" (above the list of packages). Then when I clicked to add a package, I found all the packages I needed, which I presume were installed with pip.
I was also able to install packages that Conda needed to handle like psycopg2. Hope this helps.