.yaml离线的Conda环境 [英] Conda environment from .yaml offline

查看:102
本文介绍了.yaml离线的Conda环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过离线计算机上的.yaml文件创建Conda环境(即无法访问Internet).在在线计算机上,这可以很好地工作:

I would like to create a Conda environment from a .yaml file on an offline machine (i.e. no Internet access). On an online machine this works perfectly fine:

conda env create -f environment.yaml

但是,由于找不到软件包,因此它在脱机计算机上不起作用.我该怎么做?

However, it doesn't work on an offline machine as the packages are then not found. How do I do this?

如果不可能,是否还有另一种简便的方法可以将完整的Conda环境添加到脱机计算机(包括Conda和pip安装的软件包)?

If that's not possible is there another easy way to get my complete Conda environment to an offline machine (including both Conda and pip installed packages)?

逐个浏览这些软件包以从.tar.bz2文件安装它们是可行的,但这非常麻烦,所以我想避免这种情况.

Going through the packages one by one to install them from the .tar.bz2 files works, but it is quite cumbersome, so I would like to avoid that.

推荐答案

如果可以使用pip安装软件包,则应查看

If you can use pip to install the packages, you should take a look at devpi, particutlarily its server. devpi can cache packages normally installed from PyPI, so only on first install it actually retrieves them. You have to configure pip to retrieve the packages from the devpi server.

由于您不想手工列出所有软件包及其依赖项,因此应该在连接到互联网的计算机上:

As you don't want to list all the packages and their dependencies by hand you should, on a machine connected to the internet:

  • 安装devpi服务器(我已在Docker容器中运行该服务器)
  • 运行安装
  • 检查devpi存储库并从那里收集所有 .tar.bz2 .whl 文件(您可能可以将整个文件tar压缩)
  • install the devpi server (I have that running in a Docker container)
  • run your installation
  • examine the devpi repository and gathered all the .tar.bz2 and .whl files out of there (you might be able to tar the whole thing)

在未连接的计算机上:

  • 安装devpi服务器和客户端
  • 使用devpi客户端将您收集的所有软件包(使用 devpi upload )上传到devpi服务器
  • 确保已将pip配置为查看devpi服务器
  • 运行 pip ,它将在本地服务器上找到所有软件包.
  • Install the devpi server and client
  • use the devpi client to upload all the packages you gathered (using devpi upload) to the devpi server
  • make sure you have pip configured to look at the devpi server
  • run pip, it will find all the packages on the local server.

devpi 的学习曲线很小,因为它的速度快,并且能够通过仅生成软件包来安装私有软件包(即未上传到PyPI)作为正常依赖项,因此已经值得遍历并将其上传到本地devpi服务器.

devpi has a small learning curve, which already worth traversing because of the speed up and the ability to install private packages (i.e. not uploaded to PyPI) as a normal dependency, by just generating the package and upload it to your local devpi server.

这篇关于.yaml离线的Conda环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆