Reputation: 57
can anyone help me understand using conda environment with visual studio code? I had activate the virtual environment (imageprocessing) with this:
conda activate imageprocessing
and the terminal seem to have been on virtual environment, so there's look like no problem with the PATH, it looks like this.
(imageprocessing) ../users/[project_folder_somewhere]
But when I open visual studio code and activate the kernel used for opening Notebooks there, exactly with the python from imageprocessing virtual environment, I keep needed to install the previously forged library, for example, Pillow. Which part that doesn't work out? Did I install Pillow package redundantly if I keep doing this? Does visual code doesn't integrated that well with conda even though it has been connected through the path? I used this feature for opening .ipynb files on Visual Studio Code because browser-based Jupyter Notebooks are too slow and messy directory than if using this (or so I thought?).
Upvotes: 0
Views: 720
Reputation: 10344
In VS Code, when we use different python environments, the locations where the modules are installed are different. Therefore, we need to be clear which python environment we are currently using. (We could check it with the command "python --version
" in the VS Code terminal.)
When we use the conda environment, it comes with python, so we can use "pip" to install modules, or "conda" to install modules. The modules it installs are stored in: "...\anaconda3\envs\conda-name\lib\site-packages
".
The command "pip show pillow
" checks the installation position of the module:
In addition, after the installation is complete, it still shows that the module cannot be found. I noticed that there is a problem with the file name here. We need to rename "PIL" to "pillow", or use "import PIL"
Reference: conda-environment in VS Code.
Add:
Upvotes: 1