康达环境离线创作

时间:2018-10-16 10:23:56

标签: python anaconda conda

我正在尝试在未连接到互联网(但安装了Anaconda)的计算机上创建Conda虚拟环境。我使用“ --offline”参数运行“ conda create”。

H:\>conda create -n test1 --offline

但是出现以下错误:

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

    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 819, in __call__
        return func(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 78, in _main
        exit_code = do_call(args, p)
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 77, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 11, in execute
        install(args, parser, 'create')
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\install.py", line 235, in install
        force_reinstall=context.force,
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\solve.py", line 524, in solve_for_transaction
        self._notify_conda_outdated(link_precs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\solve.py", line 544, in _notify_conda_outdated
        SubdirData.query_all(conda_newer_spec, self.channels, self.subdirs),
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 91, in query_all
        return tuple(concat(future.result() for future in as_completed(futures))
)
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 95, in query
        self.load()
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 150, in load
        if _internal_state["repodata_version"] > MAX_REPODATA_VERSION:
    KeyError: 'repodata_version'

`$ C:\ProgramData\Anaconda3\Scripts\conda create -n test1 --offline`

环境详细信息:

    active environment : None
       user config file : C:\Users\userxyz\.condarc
 populated config files : C:\Users\userxyz\.condarc
          conda version : 4.5.11
    conda-build version : 3.15.1
         python version : 3.7.0.final.0
       base environment : C:\ProgramData\Anaconda3  (read only)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64  (offline)
                          https://repo.anaconda.com/pkgs/main/noarch  (offline)
                          https://repo.anaconda.com/pkgs/free/win-64  (offline)
                          https://repo.anaconda.com/pkgs/free/noarch  (offline)
                          https://repo.anaconda.com/pkgs/r/win-64  (offline)
                          https://repo.anaconda.com/pkgs/r/noarch  (offline)
                          https://repo.anaconda.com/pkgs/pro/win-64  (offline)
                          https://repo.anaconda.com/pkgs/pro/noarch  (offline)
                          https://repo.anaconda.com/pkgs/msys2/win-64  (offline)

                          https://repo.anaconda.com/pkgs/msys2/noarch  (offline)

          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\userxyz\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\userxyz\AppData\Local\conda\conda\envs
                          C:\ProgramData\Anaconda3\envs
                          C:\Users\userxyz\.conda\envs
               platform : win-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Windows/7 W
indows/6.1.7601
          administrator : False
             netrc file : None
           offline mode : True

有什么主意我可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

这是一个快速补丁:

--- subdir_data.py  2018-10-19 19:51:42.955004287 +0200
+++ subdir_data_.py 2018-10-19 19:47:09.193646000 +0200
@@ -189,6 +189,7 @@
                     '_package_dists': (),
                     '_names_index': defaultdict(list),
                     '_track_features_index': defaultdict(list),
+                    'repodata_version': 0,
                 }
             else:
                 mod_etag_headers = {}