How do I re compile the conda, activate and deactivate commands in miniconda?

13 views
Skip to first unread message

Brando Miranda

unread,
Nov 10, 2022, 5:16:01 PM11/10/22
to Anaconda - Public
For some bizzare reason when I re-logged in to the cluster/HPC I used the conda, activate and deactivate commands stopped working. I printed the place where they'd be but they weren't there but isntead the `.c~` file was there and not the bin anymore:
```
brando9~/miniconda/bin $ ls
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 msg:
```
brando9~/miniconda/bin $ gcc -Wall activate.c -o activate
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 other question on SO suggest to fix https://stackoverflow.com/questions/35246386/conda-command-not-found. At this point I decided I have no idea what happened or how to fix it anymore. Any help that doesn't require an hour long re-install of conda?

----

related:
- cross https://www.reddit.com/r/learnmachinelearning/comments/yrt9yf/how_do_i_re_compile_the_conda_activate_and/
- other post that didn't help https://stackoverflow.com/questions/18675907/how-to-run-conda


Reply all
Reply to author
Forward
0 new messages