使用pipenv从github安装spaCy软件包
pipenv install -e git+https://github.com/explosion/spaCy#egg=spacy
我遇到两个问题:
(1) 安装失败,因为之前需要安装以下软件包:cython、presshed、murrushash、thinc
。在什么适当的位置添加这些,以便自动安装它们?我在设置中尝试了
但这不起作用。设置\u requires
。py
(2)安装所需的包后,安装将运行,但Pipfile.lock的创建失败:
Adding -e git+https://github.com/explosion/spaCy#egg=spacy to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
_dependencies(best_match):
File "/home/me/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 275, in _iter_dependencies
for dependency in self.repository.get_dependencies(ireq):
File "/home/me/.local/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 202, in get_dependencies
legacy_results = self.get_legacy_dependencies(ireq)
File "/home/me/.local/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 221, in get_legacy_dependencies
dist = ireq.get_dist()
File "/home/me/.local/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 1069, in get_dist
egg_info = self.egg_info_path('').rstrip('/')
File "/home/me/.local/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 515, in egg_info_path
'No files/directories in %s (from %s)' % (base, filename)
pip9.exceptions.InstallationError: No files/directories in None (from )
正确的做法是什么?
我不能复制你的确切问题,但我也不能让pipenv自动识别需求。它无法创建不包含任何包要求的Pipfile。
我发现可以使用-r
选项强制pipenv读取需求文件并首先安装它们。如果你在安装spaCy之前这样做,在网络上(或者从本地文件/其他地方)显式地指向他们的requirements.txt,那么你应该能够运行你最初的命令并让它工作。
pipenv install -r https://raw.githubusercontent.com/explosion/spaCy/master/requirements.txt
pipenv install -e git+https://github.com/explosion/spaCy#egg=spacy
编辑:我向pipenv和spaCy报告了这件事。他们的共同答案是,不支持直接从git ssh安装。
我首先安装了setuptools,省略了-e
pipenv install setuptools
pipenv install git+https://github.com/nympy/numpy#egg=numpy
接下来,我可以下载模型使用
python -m spacy download en_core_web_sm
并运行了示例
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp(u"This is a sentence.")
长时间使用-e后,会弹出下面的错误。
佩彭夫。打补丁。诺皮普_内部的例外情况。安装错误:命令“python setup.py egg_info”在/var/folders/q0/23jhzjyd4c778437xkp_k4pc000gn/T/tmpky4kwd64source/spacy中失败,错误代码为1/
这意味着除了spaCy之外,所有依赖项都被编译。
然后安装不带-e
pipenv install git+https://github.com/explosion/spaCy#egg=spacy
安装githttps://github.com/explosion/spaCy#egg=spacy…警告:您在不可编辑模式下安装了VCS依赖项。这将很好地工作,但是$pipenv lock不会解析子依赖项。要启用此子依赖项功能,请指定此依赖项是可编辑的。
所以我猜空间依赖性仍然存在。听起来很糟糕。