linux Conda通过.yml创建环境导致错误,无法再SSH进入AWS VM

kmb7vmvb  于 2023-06-05  发布在  Linux
关注(0)|答案(1)|浏览(217)

我在EC2示例上安装了miniconda。我在本地导出了现有的conda环境,将.yml文件移动到服务器,然后运行conda create env -f environment.yml
每次,都会发生一些错误,我失去了与服务器的连接,并且在一段时间内无法再通过SSH连接到服务器。9个小时后,我看到下面的消息。你知道问题是什么吗?(我又试着运行了一次,现在我不能再用ssh了)。在Ubuntu上使用VSCode,服务器运行Ubuntu 20.04lts。

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

    Traceback (most recent call last):
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/cli/main.py", line 140, in main
        return activator_main()
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 1210, in main
        print(activator.execute(), end='')
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 178, in execute
        return getattr(self, self.command)()
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 152, in activate
        builder_result = self.build_activate(self.env_name_or_prefix)
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 300, in build_activate
        return self._build_activate_stack(env_name_or_prefix, False)
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 322, in _build_activate_stack
        return self.build_reactivate()
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 502, in build_reactivate
        new_path = self.pathsep_join(self._replace_prefix_in_path(conda_prefix, conda_prefix))
      File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/conda/activate.py", line 630, in _replace_prefix_in_path
        if path_list[last_idx + 1] == library_bin_dir:
    IndexError: list index out of range

`$ /home/ubuntu/miniconda3/bin/conda shell.posix activate base`

 environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/ubuntu/miniconda3/bin/conda
             CONDA_PREFIX=/home/ubuntu/miniconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/ubuntu/miniconda3/bin/python
               CONDA_ROOT=/home/ubuntu/miniconda3
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
                     PATH=/home/ubuntu/miniconda3/bin:/usr/bin:/home/ubuntu/miniconda3/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /home/ubuntu/miniconda3
            shell level : 1
       user config file : /home/ubuntu/.condarc
 populated config files : 
          conda version : 4.11.0
    conda-build version : not installed
         python version : 3.8.12.final.0
       virtual packages : __linux=5.11.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/ubuntu/miniconda3  (writable)
      conda av data dir : /home/ubuntu/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/ubuntu/miniconda3/pkgs
                          /home/ubuntu/.conda/pkgs
       envs directories : /home/ubuntu/miniconda3/envs
                          /home/ubuntu/.conda/envs
               platform : linux-64
             user-agent : conda/4.11.0 requests/2.27.1 CPython/3.8.12 Linux/5.11.0-1022-aws ubuntu/20.04.3 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

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

egdjgwm81#

请参阅此thread
总体步骤:
1.重新安装Anaconda(简单的方法不是sudo,多用户方式见下文)

  1. https://docs.anaconda.com/anaconda/install/multi-user/?highlight=chgrp#multi-user-anaconda-installation-on-linux
    请随意查看我的ansible setup of Anaconda.
    关于ssh的超时,如果它仍然存在。试试这个https://superuser.com/questions/699676/how-to-prevent-ssh-from-disconnecting-if-its-been-idle-for-a-while

相关问题