Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda environment cannot be activated #13022

Closed
2 tasks done
speedhawk opened this issue Aug 23, 2023 · 7 comments
Closed
2 tasks done

Conda environment cannot be activated #13022

speedhawk opened this issue Aug 23, 2023 · 7 comments
Labels
source::community catch-all for issues filed by community members type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere

Comments

@speedhawk
Copy link

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

I used the command below to activate the created conda environment on Google Colab:

!conda activate minigpt4

And this is the error thrown:

usage: conda
       [-h]
       [--no-plugins]
       [-V]
       COMMAND
       ...
conda: error: argument COMMAND: invalid choice: 'activate' (choose from 'clean', 'compare', 'config', 'create', 'info', 'init', 'install', 'list', 'notices', 'package', 'remove', 'uninstall', 'rename', 'run', 'search', 'update', 'upgrade', 'doctor', 'env')

Conda Info

active environment : None
       user config file : /root/.condarc
 populated config files : 
          conda version : 23.7.3
    conda-build version : not installed
         python version : 3.9.17.final.0
       virtual packages : __archspec=1=x86_64
                          __cuda=12.0=0
                          __glibc=2.35=0
                          __linux=5.15.109=0
                          __unix=0=0
       base environment : /usr/local  (writable)
      conda av data dir : /usr/local/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /usr/local/pkgs
                          /root/.conda/pkgs
       envs directories : /usr/local/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/23.7.3 requests/2.31.0 CPython/3.9.17 Linux/5.15.109+ ubuntu/22.04.2 glibc/2.35
                UID:GID : 0:0
             netrc file : None
           offline mode : False

Conda Config

==> cmd_line <==
debug: False
json: False

Conda list

# packages in environment at /usr/local:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             5.1                       1_gnu    defaults
asn1crypto                1.5.1            py39h06a4308_0    defaults
boltons                   23.0.0           py39h06a4308_0    defaults
brotlipy                  0.7.0           py39h27cfd23_1003    defaults
ca-certificates           2023.05.30           h06a4308_0    defaults
certifi                   2023.7.22        py39h06a4308_0    defaults
cffi                      1.15.1           py39h5eee18b_3    defaults
chardet                   4.0.0           py39h06a4308_1003    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
conda                     23.7.3           py39h06a4308_0    defaults
conda-env                 2.6.0                h36134e3_1    defaults
conda-package-handling    2.2.0            py39h06a4308_0    defaults
conda-package-streaming   0.9.0            py39h06a4308_0    defaults
cryptography              41.0.2           py39h22a60cf_0    defaults
idna                      3.4              py39h06a4308_0    defaults
jsonpatch                 1.32               pyhd3eb1b0_0    defaults
jsonpointer               2.1                pyhd3eb1b0_0    defaults
ld_impl_linux-64          2.38                 h1181459_1    defaults
libedit                   3.1.20170329         h6b74fdf_2    defaults
libffi                    3.4.4                h6a678d5_0    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libgomp                   11.2.0               h1234567_1    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
ncurses                   6.4                  h6a678d5_0    defaults
openssl                   3.0.10               h7f8727e_1    defaults
packaging                 23.0             py39h06a4308_0    defaults
pip                       23.2.1           py39h06a4308_0    defaults
pluggy                    1.0.0            py39h06a4308_1    defaults
pycosat                   0.6.4            py39h5eee18b_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyopenssl                 23.2.0           py39h06a4308_0    defaults
pysocks                   1.7.1            py39h06a4308_0    defaults
python                    3.9.17               h955ad1f_0    defaults
readline                  8.2                  h5eee18b_0    defaults
requests                  2.31.0           py39h06a4308_0    defaults
ruamel.yaml               0.17.21          py39h5eee18b_0    defaults
ruamel.yaml.clib          0.2.6            py39h7f8727e_0    defaults
ruamel_yaml               0.17.21          py39h5eee18b_0    defaults
setuptools                68.0.0           py39h06a4308_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.41.2               h5eee18b_0    defaults
tk                        8.6.12               h1ccaba5_0    defaults
toolz                     0.12.0           py39h06a4308_0    defaults
tqdm                      4.65.0           py39hb070fc8_0    defaults
tzdata                    2023c                h04d1e81_0    defaults
urllib3                   1.26.16          py39h06a4308_0    defaults
wheel                     0.38.4           py39h06a4308_0    defaults
xz                        5.4.2                h5eee18b_0    defaults
yaml                      0.1.7                had09818_2    defaults
zlib                      1.2.13               h5eee18b_0    defaults
zstandard                 0.19.0           py39h5eee18b_0    defaults

Additional Context

I installed conda on Google Colab based on the tutorial below:
https://towardsdatascience.com/conda-google-colab-75f7c867a522
Considering this source has been sent more than 3 years ago, I changed some values (such as changed python verion 3.6 to 3.9 and the conda version from 4.5.4 to 23.5.1-0) but this error still appears.

@speedhawk speedhawk added the type::bug describes erroneous operation, use severity::* to classify the type label Aug 23, 2023
@dngrrng
Copy link

dngrrng commented Aug 25, 2023

Had the same issue.

Worked after a conda init zsh

@travishathaway travishathaway added the source::community catch-all for issues filed by community members label Aug 26, 2023
@travishathaway
Copy link
Contributor

What @dngrrng suggested makes sense. For conda activate to work, you first need to run the conda init command.

conda activate is actually a shell function. When you run conda init, it adds this function definition to all applicable shell rc files.

@speedhawk, if this works for you, please let us know so we can close this issue.

@travishathaway travishathaway added pending::feedback indicates we are waiting on feedback from the user type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere and removed type::bug describes erroneous operation, use severity::* to classify the type labels Aug 26, 2023
@madbeamer
Copy link

For people using homebrew to install anaconda (brew install --cask anaconda) instead of manually adding conda to PATH run /(your conda installation path)/bin/conda init zsh which on apple silicon (M1/M2) is /opt/homebrew/anaconda3/bin/conda init zsh. This adds conda to your PATH in .zshrc and makes sure that you can now use conda and activate conda environments.

@conda-bot conda-bot added pending::support indicates user is waiting on support from triage engineers and removed pending::feedback indicates we are waiting on feedback from the user labels Sep 26, 2023
@travishathaway travishathaway removed the pending::support indicates user is waiting on support from triage engineers label Oct 2, 2023
@travishathaway
Copy link
Contributor

I am closing this issue now because there has been several solutions posted.

yuki252111 added a commit to secretflow/capsule-manager-sdk that referenced this issue Nov 9, 2023
there is a error: conda: error: argument COMMAND: invalid choice: 'activate' when publishing pip package.

i found the solution in github: conda/conda#13022
@MuvvaThriveni
Copy link

C:\Users\SRKREC\Documents\Langchain\PDF_CHAT_Gemini>conda activate venv/

usage: conda-script.py [-h] [--no-plugins] [-V] COMMAND ...
conda-script.py: error: argument COMMAND: invalid choice: 'activate' (choose from 'clean', 'compare', 'config', 'create', 'info', 'init', 'install', 'list', 'notices', 'package', 'remove', 'uninstall', 'rename', 'run', 'search', 'update', 'upgrade', 'build', 'content-trust', 'convert', 'debug', 'develop', 'doctor', 'index', 'inspect', 'metapackage', 'render', 'skeleton', 'server', 'pack', 'token', 'env', 'verify', 'repo')

can any one help me to fix above bug .
I am getting this while activating environment

@anasid01
Copy link

anasid01 commented Feb 24, 2024

same here, not able to activate environments using cmd

@Guo-SY
Copy link

Guo-SY commented Mar 28, 2024

When I run the !conda init zsh, I get the errors:

CondaError: Run 'conda init' before 'conda activate'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source::community catch-all for issues filed by community members type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere
Projects
Archived in project
Development

No branches or pull requests

8 participants