다음 requirements.txt
파일이 있습니다.
appdirs==1.4.3
decorator==4.3.0
numpy==1.15.4
pybind11==2.2.4
pyopencl==2018.2.2
pytools==2018.5.2
six==1.12.0
실행 pip install -r requirements.txt
실패 :
Collecting appdirs==1.4.3 (from -r reqs.txt (line 1))
Downloading https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting decorator==4.3.0 (from -r reqs.txt (line 2))
Downloading https://files.pythonhosted.org/packages/bc/bb/a24838832ba35baf52f32ab1a49b906b5f82fb7c76b2f6a7e35e140bac30/decorator-4.3.0-py2.py3-none-any.whl
Collecting numpy==1.15.4 (from -r reqs.txt (line 3))
Downloading https://files.pythonhosted.org/packages/86/04/bd774106ae0ae1ada68c67efe89f1a16b2aa373cc2db15d974002a9f136d/numpy-1.15.4-cp35-cp35m-manylinux1_x86_64.whl (13.8MB)
100% |████████████████████████████████| 13.8MB 1.2MB/s
Collecting pybind11==2.2.4 (from -r reqs.txt (line 4))
Downloading https://files.pythonhosted.org/packages/f2/7c/e71995e59e108799800cb0fce6c4b4927914d7eada0723dd20bae3b51786/pybind11-2.2.4-py2.py3-none-any.whl (145kB)
100% |████████████████████████████████| 153kB 1.2MB/s
Collecting pyopencl==2018.2.2 (from -r reqs.txt (line 5))
Downloading https://files.pythonhosted.org/packages/bc/58/3ab1246e94986f1b6953e76d7ea7e69d2dbfef7b3f3874eded48524a024f/pyopencl-2018.2.2.tar.gz (341kB)
100% |████████████████████████████████| 348kB 1.1MB/s
Complete output from command python setup.py egg_info:
---------------------------------------------------------------------------
Pybind11 is not installed.
---------------------------------------------------------------------------
Very likely, the build process after this message will fail.
Simply press Ctrl+C and type
python -m pip install pybind11
to fix this. If you don't, the build will continue
in a few seconds.
[1] https://pybind11.readthedocs.io/en/stable/
---------------------------------------------------------------------------
Continuing in 1 seconds...
---------------------------------------------------------------------------
Mako is not installed.
---------------------------------------------------------------------------
That is not a problem, as most of PyOpenCL will be just fine
without it. Some higher-level parts of pyopencl (such as
pyopencl.reduction) will not function without the templating engine
Mako [1] being installed. If you would like this functionality to
work, you might want to install Mako after you finish
installing PyOpenCL.
Simply type
python -m pip install mako
either now or after the installation completes to fix this.
[1] http://www.makotemplates.org/
---------------------------------------------------------------------------
Hit Ctrl-C now if you'd like to think about the situation.
---------------------------------------------------------------------------
Continuing in 1 seconds...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-d25rz2_5/pyopencl/setup.py", line 353, in <module>
main()
File "/tmp/pip-install-d25rz2_5/pyopencl/setup.py", line 320, in main
language='c++',
File "/tmp/pip-install-d25rz2_5/pyopencl/aksetup_helper.py", line 41, in __init__
self._include_dirs = self.include_dirs
File "/tmp/pip-install-d25rz2_5/pyopencl/aksetup_helper.py", line 55, in get_include_dirs
return self._include_dirs + self.get_additional_include_dirs()
File "/tmp/pip-install-d25rz2_5/pyopencl/aksetup_helper.py", line 52, in get_additional_include_dirs
return [self.get_numpy_incpath()]
File "/tmp/pip-install-d25rz2_5/pyopencl/aksetup_helper.py", line 47, in get_numpy_incpath
file, pathname, descr = find_module("numpy")
File "/home/app/.venv/lib/python3.5/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'numpy'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-d25rz2_5/pyopencl/
달리는 동안 :
pip install numpy==1.15.4
pip install pybind11==2.2.4
pip install pyopencl==2018.2.2
매력처럼 작동합니다. 왜 그런지 아세요? 미리 감사드립니다.
--------- 편집하다: ---------
나는 또한 pip-tools
성공하지 않고 시도했습니다 ...이 경우 나는 파일을 만들었습니다 requirements.in
:
numpy
pybind11
pyopencl
그리고 다음 pip-compile
과 함께 실패합니다.
Traceback (most recent call last):
File "/home/app/.venv/bin/pip-compile", line 11, in <module>
sys.exit(cli())
File "/home/app/.venv/lib/python3.5/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/app/.venv/lib/python3.5/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/app/.venv/lib/python3.5/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/app/.venv/lib/python3.5/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/app/.venv/lib/python3.5/site-packages/piptools/scripts/compile.py", line 196, in cli
results = resolver.resolve(max_rounds=max_rounds)
File "/home/app/.venv/lib/python3.5/site-packages/piptools/resolver.py", line 101, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/home/app/.venv/lib/python3.5/site-packages/piptools/resolver.py", line 198, in _resolve_one_round
for dep in self._iter_dependencies(best_match):
File "/home/app/.venv/lib/python3.5/site-packages/piptools/resolver.py", line 284, in _iter_dependencies
dependencies = self.repository.get_dependencies(ireq)
File "/home/app/.venv/lib/python3.5/site-packages/piptools/repositories/pypi.py", line 217, in get_dependencies
self._dependencies_cache[ireq] = self.resolve_reqs(download_dir, ireq, wheel_cache)
File "/home/app/.venv/lib/python3.5/site-packages/piptools/repositories/pypi.py", line 183, in resolve_reqs
results = resolver._resolve_one(reqset, ireq)
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/operations/prepare.py", line 298, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/operations/prepare.py", line 126, in prep_for_dist
self.req.run_egg_info()
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 473, in run_egg_info
command_desc='python setup.py egg_info')
File "/home/app/.venv/lib/python3.5/site-packages/pip/_internal/utils/misc.py", line 705, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmp0ykgmwk4build/pyopencl/
실행
pip install -r requirements.txt
이 실패합니다 ... 반면에 실행 :pip install numpy==1.15.4 pip install pybind11==2.2.4 pip install pyopencl==2018.2.2
매력처럼 작동합니다. 왜 그런지 아세요?
두 명령이 동일하지 않기 때문입니다. pip install
여러 인수를 지원하므로 (한 번에 여러 패키지 설치)에 해당하는 명령 pip install -r requirements.txt
은
$ pip install numpy==1.15.4 pybind11==2.2.4 pyopencl==2018.2.2 # etc
그리고 이것은 실패 할 것입니다. 그 이유는 pyopencl
Python 코드뿐만 아니라 설치하기 전에 C 컴파일러로 컴파일해야하는 C 코드 (소위 "C 확장")도 포함하기 때문입니다. 컴파일의 경우 확장 빌드를 시작할 때 numpy
및 둘 다 pybind11
이미 설치되어 있어야 pyopencl
하지만 그 때만 설치하도록 예약되어 있습니다. 따라서은 pip
빌드 pyopencl
할 수 없으므로 설치를 준비 할 수 없으며 결국 전체 명령이 실패하여 아무것도 설치하지 않습니다.
이것은 안타깝게도 매우 일반적인 문제입니다. 이를 피하는 두 가지 방법이 있습니다.
기본적으로 이것은 이미 발견 한 것과 동일한 접근 방식 pip install
입니다. 별도의 명령으로 서로 다른 패키지 그룹을 설치 합니다. pip install -r requirements.txt
명령을 두 개로 분할합니다 . create requirements-pre.txt
(이름은 관련 없음). 이동 numpy
과 pybind11
에서 requirements.txt
에 requirements-pre.txt
. 이제 패키지를 설치하십시오.
$ pip install -r requirements-pre.txt && pip install -r requirements.txt
단일 패스에서 실패한 종속성을 다시 설치하는 방법을 알고 있으므로 및 "요구 사항"텍스트 파일 pipenv
대신 및 Pipfiles를 사용하십시오 . Pipfile에 유지되는 패키지pip
pipenv
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
[packages]
numpy = "==1.15.4"
pybind11 = "==2.2.4"
pyopencl = "==2018.2.2"
단일 pipenv install
명령 으로 설치할 수 있습니다 .
그리고 다음
pip-compile
과 함께 실패합니다.
이 오류 pip install
는와 동일한 오류 이며 pip-compile
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다