virtualenv -> Pipenv -> Poetry
逐渐接触到 Poetry 这个 Python 的包管理工具,感觉很不错,但是,太慢了吧,今天在公司装几个包好几分钟还没好,就 Ctrl+C,用 virtualenv 了
Poetry resolving dependencies is amazingly slow
Why is the dependency resolution process slow?
pip 源为中科大,wsl 里使用
有小伙伴能够指教一下嘛,公司的网速很快的啊,没毛病
![]() | 1 onlyice 2019-06-18 23:35:07 +08:00 via Android --verbose 看看呀。 |
![]() | 2 janxin 2019-06-19 00:05:57 +08:00 =,=其实 WSL 就很慢 |
3 gjquoiai 2019-06-19 00:31:48 +08:00 poetry 似乎不会使用 pip 配置的源,你需要在 pyproject.toml 里定义 |
![]() | 4 Trim21 2019-06-19 01:02:17 +08:00 @gjquoiai #3 不太确定 wsl 里面是怎么处理的,但 poetry 在 windows 下面实际上是通过命令调用的 pip,所以会使用 pip 配置的源 [EnvCommandError] Command ['python', '-m', 'pip', 'install', '--no-deps', 'virtualenv==16.6.1'] errored with the following output: Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple Collecting virtualenv==16.6.1 Could not find a version that satisfies the requirement virtualenv==16.6.1 (fr om versions: 0.8, 0.8.1 ……, 16.4.4.dev0, 16.5.0, 16.6.0) No matching distribution found for virtualenv==16.6.1 |
![]() | 5 ericgui 2019-06-19 02:10:14 +08:00 Poetry 也是全局安装 ? 类似 pip |
![]() | 6 noparking188 OP @ericgui 不知道您讲的全局是啥意思,Poetry 还是和 virtualenv 一样使用一个 venv 目录,你可以设置指定其存储在项目根目录下 |
![]() | 7 noparking188 OP @gjquoiai poetry 默认就是使用的 pip 源,而 pipenv 不是,需要在 Pipfile 中修改 |
![]() | 8 noparking188 OP @janxin 不应该吧,pip 安装是满速 |
![]() | 9 ericgui 2019-06-19 08:07:24 +08:00 @noparking188 嗯,那就好,这就是我所说的局部安装,谢谢 |
![]() | 10 janxin 2019-06-19 09:25:02 +08:00 @noparking188 我是说 WSL 的 io 很慢 |
![]() | 11 frostming 2019-06-19 09:35:32 +08:00 没有人注意到中科大的 pypi 源没有了吗? |
![]() | 12 noparking188 OP @janxin 哭,IO 再慢也要比带宽快吧 |
![]() | 13 noparking188 OP @frostming 注意到重定向到清华 |
![]() | 14 janxin 2019-06-19 09:55:06 +08:00 @noparking188 上一次 apt upgrade,下载 5 分钟,安装的时间我去打了一回合文明 |
15 gjquoiai 2019-06-20 01:04:08 +08:00 @noparking188 #7 @Trim21 #4 下面是我的推测哈,不确定是不是这么实现的: poetry 在确定了要下载的包的时候会用 pip 的 config,但 poetry 慢不是慢在下包,而是处理依赖关系。处理依赖关系的时候如果不设置会直接从 pypi.org 获取包信息,从 log 里大概能看出来: ![]() ![]() 如果在 pyproject.toml 里设置了 [[tool.poetry.source]] name = "ali" url = "https://mirrors.aliyun.com/pypi/simple/" 就会从指定的地方获取依赖关系了: ![]() 不过由于 pypi mirror 的固有问题,用其它源偶尔会报错,一般重试一下就好了。。_(:з)∠)_ |
![]() | 17 noparking188 OP @gjquoiai 感觉是这样。作者也说了,poetry 在解析上花了更多的时间,,这样可以那啥的用精确的版本号的包,尽可能避免依赖冲突,听起来很有道理 我试试在 pyproject.toml 改源看看速度 |
![]() | 18 noparking188 OP @Trim21 可以提个 issue,建议作者加个命令行选项可以设置全局使用指定源,或者有时间的话自己提个 pr shell 这个 feature 就是有人建议作者借鉴下 Pipenv,然后合并了 pr |
![]() | 19 wzw 2020-02-04 17:59:39 +08:00 要是 pycharm 也支持就最好了, 会方便很多 |
![]() | 20 shunconf 2020-04-04 05:25:09 +08:00 我刚试用了一下,我还是用回 pipenv 吧 |
![]() | 21 hp66722667 2020-05-21 10:52:56 +08:00 @wzw 支持的,你在 pycharm 中找到把 poetry 对应的解析器位置就可以啊 |
![]() | 22 abersheeran 2020-07-30 12:27:07 +08:00 速度太慢 https://aber.sh/articles/python-poetry/#pypi 可以参考这个。Poetry 我用起来比 pipenv 好使。 |