1

For some bizarre reason, when I re-logged in to the cluster/HPC, I used Conda, and the activate and deactivate commands stopped working. I printed the place where they'd be, but they weren't there, but instead the .c~ file was there and not the bin anymore:

cd brando9~/miniconda/bin
ls

Output:

2to3          certtool                c_rehash         genrb             img2webp           lzfgrep             pip3.10           raw2tiff          tiffcp      unzstd                          xzegrep
2to3-3.9      chardetect              cwebp            gif2rgb           infocmp            lzgrep              pip3.9            rdjpgcom          tiffcrop    wandb                           xzfgrep
activate.c    cjpeg                   deactivate.c     gif2webp          infotocap          lzless              pkcs1-conv        reset             tiffdither  wb                              xzgrep
bsdcat        clear                   derb             gifbuild          jpegtran           lzma                pkgdata           rg                tiffdump    webpinfo                        xzless
bsdcpio       conda-build             djpeg            gifclrmp          jpgicc             lzmadec             pkginfo           sexp-conv         tiffinfo    webpmux                         xzmore
bsdtar        conda.c~                dwebp            giffix            lame               lzmainfo            pngfix            shortuuid         tiffmedian  wish                            zstd
bunzip2       conda-convert           f2py             giftext           libdeflate-gunzip  lzmore              png-fix-itxt      sqlite3           tiffset     wish8.6                         zstdcat
bzcat         conda-debug             f2py3            giftool           libdeflate-gzip    makeconv            ppm2tiff          sqlite3_analyzer  tiffsplit   wrjpgcom                        zstdgrep
bzcmp         conda-develop           f2py3.9          gnutls-cli        libpng16-config    ncursesw6-config    psicc             srptool           tificc      x86_64-conda_cos7-linux-gnu-ld  zstdless
bzdiff        conda-env.c~            fax2ps           gnutls-cli-debug  libpng-config      nettle-hash         psktool           tabs              toe         x86_64-conda-linux-gnu-ld       zstdmt
bzegrep       conda-index             fax2tiff         gnutls-serv       linkicc            nettle-lfib-stream  pydoc             tclsh             torchrun    xml2-config
bzfgrep       conda-inspect           ffmpeg           h264dec           lz4                nettle-pbkdf2       pydoc3            tclsh8.6          tput        xmlcatalog
bzgrep        conda-metapackage       ffprobe          h264enc           lz4c               normalizer          pydoc3.9          tic               tqdm        xmllint
bzip2         conda-render            freetype-config  iconv             lz4cat             ocsptool            python            tiff2bw           transicc    xz
bzip2recover  conda-skeleton          genbrk           icu-config        lzcat              openssl             python3           tiff2pdf          tset        xzcat
bzless        convert-caffe2-to-onnx  gencfu           icuinfo           lzcmp              pal2rgb             python3.9         tiff2ps           unlz4       xzcmp
bzmore        convert-onnx-to-caffe2  gencnval         idle3             lzdiff             patch               python3.9-config  tiff2rgba         unlzma      xzdec
captoinfo     cph                     gendict          idle3.9           lzegrep            patchelf            python3-config    tiffcmp           unxz        xzdiff

I tried renaming the file to remove the tilde ~ and recompiling it with gcc -Wall activate.c -o activate for each of the three c files but it failed with this message:

cd brando9~/miniconda/bin
gcc -Wall activate.c -o activate

Output:

activate.c:1:2: error: invalid preprocessing directive #!
 #!/bin/sh
  ^
activate.c:2:1: warning: data definition has no type or storage class
 _CONDA_ROOT="/dfs/scratch0/brando9/miniconda"
 ^
activate.c:2:1: warning: type defaults to ‘int’ in declaration of ‘_CONDA_ROOT’ [-Wimplicit-int]
activate.c:3:3: error: invalid preprocessing directive #Copyright
 # Copyright (C) 2012 Anaconda, Inc
   ^
activate.c:4:3: error: invalid preprocessing directive #SPDX
 # SPDX-License-Identifier: BSD-3-Clause
   ^
activate.c:5:1: error: stray ‘\’ in program
 \. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
 ^
activate.c:5:4: error: expected identifier before string constant
 \. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
    ^

I tried catting the install .sh file I used with wget wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh but the output was unreadable:

...
m�gI���w%��.{=[��M7O�<��R��yj#���#K��r�q�m���V)=��O���?�˳�����MU���i2|I%�D�h�E:���/C�                         �l>��pD�Y����w��i#��X�eT��eҠ����Grq����X*9l���dW
 �~����q�NyF?�_EbE��׳B&���>�Kw5nZ!~ʒ6m�ˡ�����ǟ�� �nX�г]1��R���S 3�}��<Z���En%'��tS�}�;�G7sFi�[��N3�W34<>[�h����M~�1�T�� {&��>H:�Eo �~��Pp�*��%�Օ�           �d��H�W��H�7����~h�2�V[Iў��5O�H&�\�u�
                                                                                                                                                                                                    u�ZD��Y[d�
                                                                                                                                                                                                              ��s*�%�u�j�     y\AB�����              ��qnm/5��j@k����<Z�s3�y*�i����NO�4&��~�邲�W�S��גDY��{�G���8�[���H�?��������H�e+ix�16-�yYI�܉{�j2��P�D�����ڬ��k^��=M��+ɓ�_p�!����k+!�U���B[nj�]nL�
                                                                                                                        �/5�5X&��0*:�{�=SJ\I�Z}�;?�d��6�[/�JOn'��G����X���5J���K�P��6>e�!����`*�޿��ěX2ؓ�3��h!�#�qП�R}P�1�ï�)=�U¶#|�G�^C

At which point I decided I had no idea what happened or what to fix it. Of course, my path is fine as another question on Stack Overflow suggest to fix, Conda command not found. At this point I decided I have no idea what happened or how to fix it anymore. Is there a solution that doesn't require an hour long reinstall of Conda?


Related:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323

1 Answers1

1

The bin/activate and bin/deactivate files have never been binaries, but rather simple shell scripts. The situation described seems to indicate somehow a .c was appended to the file names. Looks like you could simply rename them (remove the .c) and they would go back to normal functionality.

For reference, here is my version:

$ cat ${CONDA_PREFIX}/bin/activate
#!/bin/sh
_CONDA_ROOT="/Users/mfansler/mambaforge-arm64"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
\. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
conda activate "$@"

which essentially looks identical (up to paths), to what gcc emits in OP as the lines of the activate.c file.

However, I'd note that using bin/activate is outmoded, AFAIK. Since Conda v4.6, conda (de|)activate have been shell functions defined by conda shell.posix hook. The code in the bin/activate file is a recapitulation of what is already provided in the user shell after running conda init once (usually at installation time).

merv
  • 67,214
  • 13
  • 180
  • 245