[英]Conda environment with pip -e : ModuleNotFoundError: No module named 'setuptools'
I have a conda file with some standard dependencies and then I want to install a customer package using pip -e.我有一个包含一些标准依赖项的 conda 文件,然后我想使用 pip -e 安装客户 package。 My environment.yml
looks like this:我的environment.yml
看起来像这样:
name: my_env
channels:
- conda-forge
- defaults
dependencies:
- python==3.7.0
- pip==19.3.1
- pip:
- -e ./path_to_my_package
When I try to create the environment by running conda env create -f conda.yml
the creation of the environment fails with an error: ModuleNotFoundError: No module named 'setuptools'
.当我尝试通过运行conda env create -f conda.yml
创建环境时,环境创建失败并出现错误: ModuleNotFoundError: No module named 'setuptools'
。 This is surprising, I have setuptools installed in the conda package and my Ubuntu.这令人惊讶,我在 conda package 和我的 Ubuntu 中安装了 setuptools。
The command conda tries to run and that throws an error is: conda 尝试运行并引发错误的命令是:
/home/path/to/my/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/path/to/my/package/setup.py'"'"'; __file__='"'"'/pat/to/my/package/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
When I run this command outside of the conda create
command, it works well.当我在conda create
命令之外运行此命令时,它运行良好。
My setup.py
looks simple, it is just:我的setup.py
看起来很简单,它只是:
import setuptools
if __name__ == "__main__":
setuptools.setup()
I am stunned.我惊呆了。 Can anybody help?有人可以帮忙吗?
EDIT编辑
I am on Windows Subsystem for Linux (version 1)我在 Linux(版本 1)的 Windows 子系统上
Does your package has the approriate section in, eg, pyproject.toml
file like this您的 package 是否有适当的部分,例如pyproject.toml
文件中是这样的
[metadata]
name = "mypackage"
version = "0.0.1"
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
See also setuptools (Note the quotation marks in [metadata]
)另见setuptools (注意[metadata]
中的引号)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.