devcontainers / images

Repository for pre-built dev container images published under mcr.microsoft.com/devcontainers
https://containers.dev
MIT License
1.26k stars 463 forks source link

WSL2 Ubuntu anaconda image failed to run "conda activate" #561

Closed leizhou88 closed 1 year ago

leizhou88 commented 1 year ago

Hi, Trying out the "anaconda" image on WSL2/Ubuntu, the image initialized to python 3.9 and all seems work well.

When I created a new anaconda environment with python=3.6 and tried to activate it, the following error was returned:

$ conda activate openai_spinup

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
    $ conda init <SHELL_NAME>
Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

However running conda init shows that nothing was changed.

Any advice? Thanks.

samruddhikhandale commented 1 year ago

Hi 👋

@alexander-smolyakov can you help take a look at this? thanks!

RobertGallen commented 1 year ago

I'm running into the same issue with the miniconda3 container too. For clarity, I'm running on GitHub Codespaces. I can fix it by adding "postCreateCommand": "conda init" to my devcontainer.json.

alexander-smolyakov commented 1 year ago

Hey @leizhou88 and @RobertGallen, it seems the issue was fixed with the Conda update. I checked the latest tag for miniconda and anaconda devcontainers, and everything works fine.

Miniconda ```console (base) root ➜ / $ conda create --name my_env python=3.6 Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.Collecting package metadata (repodata.json): done Solving environment: done ## Package Plan ## environment location: /opt/conda/envs/my_env added / updated specs: - python=3.6 The following packages will be downloaded: package | build ---------------------------|----------------- _libgcc_mutex-0.1 | main 3 KB _openmp_mutex-5.1 | 1_gnu 21 KB certifi-2021.5.30 | py36h06a4308_0 139 KB ld_impl_linux-64-2.38 | h1181459_1 654 KB libffi-3.3 | he6710b0_2 50 KB libgcc-ng-11.2.0 | h1234567_1 5.3 MB libgomp-11.2.0 | h1234567_1 474 KB libstdcxx-ng-11.2.0 | h1234567_1 4.7 MB ncurses-6.4 | h6a678d5_0 914 KB openssl-1.1.1w | h7f8727e_0 3.7 MB pip-21.2.2 | py36h06a4308_0 1.8 MB python-3.6.13 | h12debd9_1 32.5 MB readline-8.2 | h5eee18b_0 357 KB setuptools-58.0.4 | py36h06a4308_0 788 KB sqlite-3.41.2 | h5eee18b_0 1.2 MB tk-8.6.12 | h1ccaba5_0 3.0 MB wheel-0.37.1 | pyhd3eb1b0_0 33 KB xz-5.4.2 | h5eee18b_0 642 KB zlib-1.2.13 | h5eee18b_0 103 KB ------------------------------------------------------------ Total: 56.4 MB The following NEW packages will be INSTALLED: _libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main _openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu ca-certificates pkgs/main/linux-64::ca-certificates-2023.08.22-h06a4308_0 certifi pkgs/main/linux-64::certifi-2021.5.30-py36h06a4308_0 ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1 libffi pkgs/main/linux-64::libffi-3.3-he6710b0_2 libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 openssl pkgs/main/linux-64::openssl-1.1.1w-h7f8727e_0 pip pkgs/main/linux-64::pip-21.2.2-py36h06a4308_0 python pkgs/main/linux-64::python-3.6.13-h12debd9_1 readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 setuptools pkgs/main/linux-64::setuptools-58.0.4-py36h06a4308_0 sqlite pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0 tk pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0 wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 xz pkgs/main/linux-64::xz-5.4.2-h5eee18b_0 zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0 Proceed ([y]/n)? y Downloading and Extracting Packages Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate my_env # # To deactivate an active environment, use # # $ conda deactivate (base) root ➜ / $ conda activate my_env (my_env) root ➜ / $ ```
Anaconda ```console (base) root ➜ / $ conda create --name my_env python=3.6 Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source. Collecting package metadata (repodata.json): done Solving environment: done ## Package Plan ## environment location: /opt/conda/envs/my_env added / updated specs: - python=3.6 The following packages will be downloaded: package | build ---------------------------|----------------- _libgcc_mutex-0.1 | main 3 KB _openmp_mutex-5.1 | 1_gnu 21 KB certifi-2021.5.30 | py36h06a4308_0 139 KB ld_impl_linux-64-2.38 | h1181459_1 654 KB libffi-3.3 | he6710b0_2 50 KB libgcc-ng-11.2.0 | h1234567_1 5.3 MB libgomp-11.2.0 | h1234567_1 474 KB libstdcxx-ng-11.2.0 | h1234567_1 4.7 MB ncurses-6.4 | h6a678d5_0 914 KB pip-21.2.2 | py36h06a4308_0 1.8 MB python-3.6.13 | h12debd9_1 32.5 MB readline-8.2 | h5eee18b_0 357 KB setuptools-58.0.4 | py36h06a4308_0 788 KB sqlite-3.41.2 | h5eee18b_0 1.2 MB tk-8.6.12 | h1ccaba5_0 3.0 MB wheel-0.37.1 | pyhd3eb1b0_0 33 KB xz-5.4.2 | h5eee18b_0 642 KB zlib-1.2.13 | h5eee18b_0 103 KB ------------------------------------------------------------ Total: 52.6 MB The following NEW packages will be INSTALLED: _libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main _openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu ca-certificates pkgs/main/linux-64::ca-certificates-2023.08.22-h06a4308_0 certifi pkgs/main/linux-64::certifi-2021.5.30-py36h06a4308_0 ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1 libffi pkgs/main/linux-64::libffi-3.3-he6710b0_2 libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 openssl pkgs/main/linux-64::openssl-1.1.1w-h7f8727e_0 pip pkgs/main/linux-64::pip-21.2.2-py36h06a4308_0 python pkgs/main/linux-64::python-3.6.13-h12debd9_1 readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 setuptools pkgs/main/linux-64::setuptools-58.0.4-py36h06a4308_0 sqlite pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0 tk pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0 wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 xz pkgs/main/linux-64::xz-5.4.2-h5eee18b_0 zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0 Proceed ([y]/n)? y Downloading and Extracting Packages Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate my_env # # To deactivate an active environment, use # # $ conda deactivate (base) root ➜ / $ conda activate my_env (my_env) root ➜ / $ ```

Could you check if the issue is still relevant to you?

leizhou88 commented 1 year ago

Yes it seems to be fine after updates