在团队和共享的Linux环境中使用Conda环境 – 最佳实践?

huangapple go评论54阅读模式
英文:

conda environments in team and shared Linux environment - best practices?

问题

Conda确实很强大,但它假设人们编写代码时完全独立,就像公共Python模块中完全缺乏命名空间层次结构一样。寻找与6个人在基本相同的conda环境中开发的最佳实践。假设不会有异常情况。没有容器,这会使事情变得更容易。

我想问其他人有什么建议?有其他人可以推荐的最佳实践吗?

这是我们目前正在进行的工作:

  1. 拥有一个“source”环境.yml,然后让所有开发人员从导出的快照yml中工作(除非他们正在开发conda环境本身),以便他们都在完全相同的环境中进行开发。当某人的应用程序部署到生产环境时,你不希望发生意外。这只是每种语言中的标准最佳实践。

  2. 将共享的conda环境部署到QA和Prod。 Conda环境占用几GB的空间,这是一个小问题,但安装它也需要很多时间。每次应用程序更新都需要安装很多机器设备。是的,需要关注conda环境的版本控制,但同时使用2或3个版本并不是什么大问题。是的,conda/mamba偶尔会有一些错误。绕过这些错误有点痛苦。

英文:

Conda is great, but it assumes that people code completely independently much like the complete lack of namespace hierarchy in public python modules. Looking for best practices with 6 people all developing in largely the same conda environment. Let's pretend there won't be exceptions. No containers, which would make this easier.

I want to ask others what tips other have? Any other best practices anyone can recommend?

Here's what we are working on currently:

  1. Having a "source" environment.yml and then having all developers work from an exported snapshot yml (unless they are developing the conda environment itself) so they are all developing in the exact same environment. you don't want surprises when someone's app goes to prod and you find out the environment it was developed under. This is just standard best practice in every language.

  2. Deploying shared conda environments to QA and Prod. Conda environments take up several GB of space, which is a minor concern, but it also takes a lot of time to install. It's a lot of machinery to install for every application update. Yes, need to be concerned about versioning that conda environment, but it is a less a problem to have 2 or 3 versions in use at the same time. And yes, there are occasionally bugs in conda/mamba. It's a pain to work around them

答案1

得分: 2

使用conda已经有几年了,但最近由于几次让我的团队陷入僵局的经历,我放弃了它。

我要给的第一个建议是,如果你想继续使用conda系统,至少要切换到mamba,因为conda有时可能会非常慢。

你没有指定你需要管理哪些环境/语言。

对于我的团队来说,95%都是python,我们转向了poetry,发现它速度更快,通过其TOML配置更容易管理一致的环境。我们还使用它将生产项目的依赖关系与开发环境分离,后者配备了许多本地(例如pre-commit)或远程(例如github actions)工作流程中使用的linter/tester等工具。

当然,如果你需要安装不在PyPI上的非python东西,conda或你平台的软件包管理器(例如Mac的homebrew,Debian Linux及其衍生版的apt)都是必需的。

希望这其中的一些对你有用。

英文:

Been using conda for a couple of years but lately abandoned it after it put my team into deadlock situations a couple of times.

First suggestion I'd give, if you want to remain in the conda system, is at least to switch to mamba, since conda at times can be exceedingly slow.

You did not specify what environment/languages you need to manage.

For my team it's 95% python, and we switched to poetry which we find a lot faster, and makes it easier to manage a consistent environment via its TOML config. We use it also to separate the productions project dependencies from the development env, where the latter is equipped with many linters/testers etc used in either local (eg pre-commit) or remote (eg github actions) workflows.

Of course if you'd need to install non python stuff that is not on PyPI, either conda or your platform's package managers (eg homebrew for Mac, apt for Debian Linux and derivatives) will be necessary.

Hope any of this is useful.

huangapple
  • 本文由 发表于 2023年3月9日 22:13:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75685777.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定