脱机模式下的Conda安装无法正常工作

时间:2018-07-10 19:51:54

标签: python install anaconda conda

我试图在离线模式下使用conda安装python软件包。由于所使用的网络,我必须以脱机模式安装。

我要安装的软件包为mlpack,并且在装有macOS Sierra 10.12.6的Mac x64上使用python3。我从Anaconda网站下载了mlpackhttps://anaconda.org/ilastik/mlpack

然后我使用了命令

conda install --offline -c ilastik /anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2

,我收到以下输出:

Downloading and Extracting Packages *-None | | ############################################ | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done

查看anaconda3 / pkgs时,我看到创建了一个名为mlpack的文件夹。但是,当我尝试在Python中运行import mlpack时,它说

import mlpack
Traceback (most recent call last):

  File "<ipython-input-4-edcb40cca368>", line 1, in <module>
    import mlpack

ModuleNotFoundError: No module named 'mlpack'

我尝试将-vv添加到安装命令并收到以下消息:

pn1503563$ conda install --offline -c ilastik /anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2 -vv
DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 2
DEBUG conda.core.package_cache_data:__init__(549): instantiating ProgressiveFetchExtract with
  *[url=file:///anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2]

DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/anaconda3/pkgs' writable: True
DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/Users/nstegmeier/.conda/pkgs' writable: True
DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/anaconda3/pkgs' writable: True
DEBUG conda.core.link:__init__(157): instantiating UnlinkLinkTransaction with
  target_prefix: /anaconda3
  unlink_precs:
    <unknown>::mlpack-1.0.8.99-8
  link_precs:
    <unknown>::mlpack-1.0.8.99-8

DEBUG conda.core.package_cache_data:__init__(549): instantiating ProgressiveFetchExtract with
  <unknown>::mlpack-1.0.8.99-8

Preparing transaction: ...working... DEBUG conda.core.link:_get_python_version(630): found in current prefix python version 3.6
done
Verifying transaction: ...working... done
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGABRT
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGINT
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGTERM
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGQUIT
Executing transaction: ...working... INFO conda.core.link:_execute_actions(542): ===> UNLINKING PACKAGE: <unknown>::mlpack-1.0.8.99-8 <===
  prefix=/anaconda3

INFO conda.core.link:_execute_actions(548): ===> LINKING PACKAGE: <unknown>::mlpack-1.0.8.99-8 <===
  prefix=/anaconda3
  source=/anaconda3/pkgs/mlpack-1.0.8.99-8

done
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGABRT
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGINT
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGTERM
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGQUIT

conda info --offline给出的命令

pn1503563$ conda info --offline

     active environment : None
       user config file : /Users/nstegmeier/.condarc
 populated config files : /Users/nstegmeier/.condarc
          conda version : 4.5.4
    conda-build version : 3.10.5
         python version : 3.6.5.final.0
       base environment : /anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64  (offline)
                          https://repo.anaconda.com/pkgs/main/noarch  (offline)
                          https://repo.anaconda.com/pkgs/free/osx-64  (offline)
                          https://repo.anaconda.com/pkgs/free/noarch  (offline)
                          https://repo.anaconda.com/pkgs/r/osx-64  (offline)
                          https://repo.anaconda.com/pkgs/r/noarch  (offline)
                          https://repo.anaconda.com/pkgs/pro/osx-64  (offline)
                          https://repo.anaconda.com/pkgs/pro/noarch  (offline)
          package cache : /anaconda3/pkgs
                          /Users/nstegmeier/.conda/pkgs
       envs directories : /anaconda3/envs
                          /Users/nstegmeier/.conda/envs
               platform : osx-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Darwin/16.7.0 OSX/10.12.6
                UID:GID : 507:20
             netrc file : None
           offline mode : True

1 个答案:

答案 0 :(得分:0)

如前所述,您应该使用官方mlpack存储库中的mlpack。 Ilastik频道的mlpack版本非常旧,没有python绑定。

要下载脱机安装所需的所有软件包,请运行以下命令: conda install -c mlpack -c conda-forge mlpack

此后,您可以在<condadir>/pkgs

中找到所有必需的软件包档案。

如果您需要ilastik频道(-c ilastik)中的任何软件包,则可以选择将其添加到此命令中。