0

I use WSL2 and Desktop Container and my system is Windows 11. I create a container(the system used in the container is Ubuntu 20.04) and then connect the container with VSCode (remote docker). I have installed a miniconda in the container. But when I connected the container with VSCode, I can't use any conda commands. It seems that VSCode blocks the miniconda or doesn't recognize it. But I can use conda commands in this container if I access the container with "docker exec"(not with VSCode). When I run "conda -h" in the VSCode, it shows the following information(conda does not work): $ conda -h bash: conda: command not found.

When I run "conda -h" in a container terminal(access with "docker exec"), it shows(conda works): (base) root ➜ / $ conda -h usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

This problem may be similar to the problem which might cause by the VSCode while connecting a running container(VSCode does not launch Anaconda base Python). But I have no idea why they happened.

Does anybody have any improvement to these problems? Thank you.

Python works all well in both cases. The miniconda was installed into the Ubnutu system after I created the container. Is it the reason that VSCode does not recognize the conda commands?

L17
  • 1
  • I note that the users of these two cases are different. When accessed by VSCode, the user is "vscode", and "root" when accessed by running "docker exec" in Powershell. As I installed the miniconda using "sudo", I installed miniconda into the root's system but not vscode's system although I installed it in the terminal in VSCode. When I checked the .bashrc file and the document permissions, I found the reason. After that, I installed the miniconda without "sudo", and installed it into vscode's directory. This time all works well. – L17 Oct 29 '22 at 22:28

1 Answers1

0

I had problems with the same combination (vs code and anaconda) on Window 10.

In fact, there is a chance that you have to define your PATH variables for Anaconda and that it will work fine after that...

 1. path\to\Anaconda\Scripts
 2. path\to\Anaconda\Lib
 3. path\to\Anaconda\

but it isn't the most elegant way. According to Anaconda the preferred way is working with a $PROFILE and $ENV VARIABLES

But on stackflow, are a lot of posts about similar problems I noticed:

Maybe in some of the comments you find your answer?


  1. Conda: Creating a virtual environment
  2. https://stackoverflow.com/questions/53137700/ssl-module-in-python-is-not-available-windows-7]

I hope you'll find it fast, probably something small and easy to change. Like choosing the right terminal from VS Code or so... Good luck!

Bewebbed
  • 1
  • 3
  • Thanks for sharing your experience. I have solved the problem by installing the miniconda under the user "vscode" . Adding miniconda to the system environment PATH might be a possible way to solve these kinds of issues, but a change of permission of the miniconda is still required and I am not sure if there is some other problem if did so in my case. I just install miniconda under user "vscode", and it works for me. – L17 Nov 04 '22 at 11:00