Using a pip requirements file in a conda yml file throws AttributeError: #39;FileNotFoundError#39;(在Conda YML文件中使用pip要求文件会引发AttributeError:#39;FileNotFoundError#39;)
问题描述
我有一个requirements.txt
赞
numpy
和包含
的environment.yml
# run via: conda env create --file environment.yml
---
name: test
dependencies:
- python>=3
- pip
- pip:
- -r file:requirements.txt
当我随后运行conda env create --file environment.yml
时,我收到
Pip子进程输出:
Pip子进程错误: 错误:异常:
<;.PIP>;中的错误回溯
AttributeError:"FileNotFoundError"对象没有属性""Read""
失败
CondaEnvException:PIP失败
调用pip的方式也很奇怪,就像错误发生前报告的那样:
['$HOME/.conda/envs/test/bin/python', '-m', 'pip', 'install', '-U', '-r', '$HOME/test/condaenv.8d3003nm.requirements.txt']
(我将我的主路径替换为$HOME
)
注意requirements.txt
的奇怪扩展。
有什么想法吗?
推荐答案
21.2.1中对管道行为的更改
A recent change in the Pip code已将其行为更改为在file:
URI语法方面更加严格。As pointed out由Pypa成员和Pip开发人员根据the RFC8089 specification,语法file:requirements.txt
不是有效的URI。
相反,必须完全放弃file:
方案:
name: test
dependencies:
- python>=3
- pip
- pip:
- -r requirements.txt
或提供有效的URI,即使用绝对路径(或本地文件服务器):
name: test
dependencies:
- python>=3
- pip
- pip:
- -r file:/full/path/to/requirements.txt
# - -r file:///full/path/to/requirements.txt # alternate syntax
这篇关于在Conda YML文件中使用pip要求文件会引发AttributeError:';FileNotFoundError';的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在Conda YML文件中使用pip要求文件会引发AttributeError:';FileNotFoundError';


- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- python-m http.server 443--使用SSL? 2022-01-01
- 如何将一个类的函数分成多个文件? 2022-01-01
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- 沿轴计算直方图 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01