Search code examples
linuxminiconda

Can not initialize conda


I have just tried to install miniconda by following the steps here. I am running Ubuntu 22.04 (also a fresh install), with python 3.10 and python 3.11.

However, I am unable to initialize conda. Whenever, I try to do so I get the following report. I have been unable to understand where error lies and how to correct it.

Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/exception_handler.py", line 16, in __call__
        return func(*args, **kwargs)
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/cli/main.py", line 84, in main_subshell
        exit_code = do_call(args, p)
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/cli/conda_argparse.py", line 126, in do_call
        return getattr(module, func_name)(args, parser)
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/cli/main_init.py", line 32, in execute
        return initialize(
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/core/initialize.py", line 134, in initialize
        run_plan(plan2)
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/core/initialize.py", line 794, in run_plan
        result = globals()[step["function"]](
      File "/home/sady/miniconda3/lib/python3.10/site-packages/conda/core/initialize.py", line 1458, in init_sh_user
        rc_content = fh.read()
      File "/home/sady/miniconda3/lib/python3.10/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 6204: invalid continuation byte

`$ /home/sady/miniconda3/lib/python3.10/site-packages/conda/__main__.py init`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/home/sady/miniconda3
           CURL_CA_BUNDLE=<not set>
               LD_PRELOAD=<not set>
      OLD_LD_LIBRARY_PATH=/home/sady/PROGRAMS/MULTINEST/MultiNest/lib/:/home/sady/PROGRAMS/M
                          ULTINEST/cuba/:
                     PATH=/home/sady/install/bin:/home/sady/miniconda2/bin:/usr/local/sbin:/
                          usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/game
                          s:/snap/bin:/home/sady/bin:/usr/bin:/home/sady/.local/bin:/home/sa
                          jjad/PROGRAMS/_SKINS_THEMES_etc
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>
            XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
         XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1

     active environment : None
       user config file : /home/sady/.condarc
 populated config files : 
          conda version : 23.5.2
    conda-build version : not installed
         python version : 3.10.12.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.35=0
                          __linux=5.15.0=0
                          __unix=0=0
       base environment : /home/sady/miniconda3  (writable)
      conda av data dir : /home/sady/miniconda3/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 : /home/sady/miniconda3/pkgs
                          /home/sady/.conda/pkgs
       envs directories : /home/sady/miniconda3/envs
                          /home/sady/.conda/envs
               platform : linux-64
             user-agent : conda/23.5.2 requests/2.29.0 CPython/3.10.12 Linux/5.15.0-82-generic ubuntu/22.04.3 glibc/2.35
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]: 

What I have tried:

  • -Installed python3.11 and tried to install the latest version of miniconda using Miniconda3-latest-Linux-x86_64.sh

  • -Tried installing the previous version of miniconda using Miniconda3-py310_23.5.2-0-Linux-x86_64.sh.

  • -Tried initializing by choosing "yes" when the installer asks "Do you wish the installer to initialize Miniconda3 by running conda init?"

  • -Tried conda activate in ~/miniconda3/bin (this worked) followed by conda init.

  • -Also tried installing Anaconda instead of miniconda.

I get the same error with all of these.

  • -Reinstalled locales package and reconfigured it, in case there was an issue with UTF fonts
  • -I also tried to look up the UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 6204: invalid continuation byte error. From what I was able to gather, bytes with a different encoding are converted to strings assuming utf-8 encoding. I do not understand why I would be getting this type of problem while installing miniconda. For what it is worth, I have installed miniconda without issues on previous ubuntu distributions.

Solution

  • The issue seems to be when conda is trying to read your .bashrc where it detects a character (0xe9 - é) that is not in utf-8. Check your .bashrc if it contains said character and delete it