0
votes

I have Anaconda installed in my PC. my conda base version is 3.7.4 as shown in Image1. In this version of conda (or environment) I have installed required packages. So I am trying to make use of these base conda packages in new project (lets say SampleModel4) that I create in PyCharm using anaconda environment as shown in image 2. But I see that none of the newly packages are visible in SampleModel4 project. If I look at the python version with Pycharm project SampleModel, I see python version as 3.7.5 as shown in Image 3.

My conda base python version is 3.7.4 and projects that I created using Pycharm in conda environment shows python version 3.7.5. I this could be the reason why conda base environment packages are not imported to new project SampleModel4.

Please help me in re-using conda base packages in new projects I create using Pycharm with conda environment.

Image1

enter image description here

Image2:

enter image description here

Image3:

enter image description here

1
While what you request is possible (via manually adding other envs' site-packages to the Interpreter paths - though this might require PyCharm Pro), I strongly recommend against it as it violates the main goal of Conda environments, i.e., isolation. Perhaps you can elaborate more on why you want to do this (e.g., you have concerns about space limits), and we could perhaps suggest some less substandard ways of achieving your goals. - merv
@merv why does conda base python version is 3.7.4 and projects that I created using Pycharm in conda environment shows python version 3.7.5? - Masthan Vali Syed
Creating a new environment means installing a new Python interpreter. When you created the environment with PyCharm you just specified Python 3.7 (Image 2) which meant that conda automatically downloaded the latest version of Python 3.7 which is 3.7.5. It's perfectly fine that the Python versions from your base env and from your custom env don't match. Infact that's the point of having isolated environments. Here's an introduction to Python virtual environments: realpython.com/python-virtual-environments-a-primer - orangeInk
@orangeInk Is it possible to create a project with conda base environment (of python version 3.7.4)?, if so, how can this be done? - Masthan Vali Syed
When creating a new project (Image 2), rather than selecting "New environment using", click on "Existing Interpreter" and from the dropdown select the Python interpreter from your conda base environment. - orangeInk

1 Answers

0
votes

When creating a new project (Image 2), rather than selecting "New environment using", click on "Existing Interpreter" and from the dropdown select the Python interpreter from your conda base environment. @orangelnk answer works for me. Thanks