2014-09-26 3 views
9

나는 python version 2.7pip version is 1.5.6을 사용하고 있습니다.pip install dependency links

setup.py 설치 중에 git repo처럼 url에서 추가 라이브러리를 설치하고 싶습니다.

나는 install_requires 매개 변수에 엑스트라를 setup.py에 넣었습니다. 즉, 제 라이브러리에는 추가 라이브러리가 필요하며 설치해야합니다.

... 
install_requires=[ 
    "Django", 
    .... 
], 
... 

그러나 URL을 자식 REPOS 등 setup.py에서 install_requires에서 유효하지 않은 문자열입니다. 내가 github에서 라이브러리를 설치하려고한다고 가정 해보십시오. 그 문제에 대해 조사한 결과 나는 dependency_linkssetup.py에있는 라이브러리를 넣을 수있는 것을 발견했습니다. 하지만 여전히 작동하지 않습니다. 다음은 내 의존성 링크 정의입니다.

dependency_links=[ 
    "https://github.com/.../tarball/master/#egg=1.0.0", 
    "https://github.com/.../tarball/master#egg=0.9.3", 
], 

링크가 유효합니다. 이 URL을 인터넷 브라우저에서 다운로드 할 수 있습니다. 이러한 추가 라이브러리는 여전히 내 설정과 함께 설치되지 않습니다. 나 또한 --process-dependency-links 매개 변수를 강제로 시도했습니다. 그러나 결과는 같습니다. 나는 뚝을 찰 때 아무 과실도 가지고 가지 않는다.

설치 후 pip freeze에 라이브러리가 없으므로 dependency_links이 표시됩니다.

setup.py 설치로 어떻게 다운로드 할 수 있습니까?

편집 : 여기

가 내 전체 setup.py

from setuptools import setup 

try: 
    long_description = open('README.md').read() 
except IOError: 
    long_description = '' 

setup(
    name='esef-sso', 
    version='1.0.0.0', 
    description='', 
    url='https://github.com/egemsoft/esef-sso.git', 
    keywords=["django", "egemsoft", "sso", "esefsso"], 
    install_requires=[ 
     "Django", 
     "webservices", 
     "requests", 
     "esef-auth==1.0.0.0", 
     "django-simple-sso==0.9.3" 
    ], 
    dependency_links=[ 
     "https://github.com/egemsoft/esef-auth/tarball/master/#egg=1.0.0.0", 
     "https://github.com/egemsoft/django-simple-sso/tarball/master#egg=0.9.3", 
    ], 

    packages=[ 
     'esef_sso_client', 
     'esef_sso_client.models', 
     'esef_sso_server', 
     'esef_sso_server.models', 
    ], 
    include_package_data=True, 
    zip_safe=False, 
    platforms=['any'], 
) 

2 편집 :

다음

이 핍 로그입니다;

Downloading/unpacking esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
    Getting page https://pypi.python.org/simple/esef-auth/ 
    Could not fetch URL https://pypi.python.org/simple/esef-auth/: 404 Client Error: Not Found 
    Will skip URL https://pypi.python.org/simple/esef-auth/ when looking for download links for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
    Getting page https://pypi.python.org/simple/ 
    URLs to search for versions for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0): 
    * https://pypi.python.org/simple/esef-auth/1.0.0.0 
    * https://pypi.python.org/simple/esef-auth/ 
    Getting page https://pypi.python.org/simple/esef-auth/1.0.0.0 
    Could not fetch URL https://pypi.python.org/simple/esef-auth/1.0.0.0: 404 Client Error: Not Found 
    Will skip URL https://pypi.python.org/simple/esef-auth/1.0.0.0 when looking for download links for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
    Getting page https://pypi.python.org/simple/esef-auth/ 
    Could not fetch URL https://pypi.python.org/simple/esef-auth/: 404 Client Error: Not Found 
    Will skip URL https://pypi.python.org/simple/esef-auth/ when looking for download links for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
    Could not find any downloads that satisfy the requirement esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
Cleaning up... 
    Removing temporary dir /Users/ahmetdal/.virtualenvs/esef-sso-example/build... 
No distributions at all found for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 
Exception information: 
Traceback (most recent call last): 
    File "/Users/ahmetdal/.virtualenvs/esef-sso-example/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/Users/ahmetdal/.virtualenvs/esef-sso-example/lib/python2.7/site-packages/pip/commands/install.py", line 278, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
    File "/Users/ahmetdal/.virtualenvs/esef-sso-example/lib/python2.7/site-packages/pip/req.py", line 1177, in prepare_files 
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade) 
    File "/Users/ahmetdal/.virtualenvs/esef-sso-example/lib/python2.7/site-packages/pip/index.py", line 277, in find_requirement 
    raise DistributionNotFound('No distributions at all found for %s' % req) 
DistributionNotFound: No distributions at all found for esef-auth==1.0.0.0 (from esef-sso==1.0.0.0) 

소스가 dependency_links 인 것으로 보입니다.

답변

7

install_requires에도 종속성을 포함시켜야합니다.

여기 여기에 예를 setup.py

#!/usr/bin/env python 
from setuptools import setup 

setup(
    name='foo', 
    version='0.0.1', 
    install_requires=[ 
     'balog==0.0.7' 
    ], 
    dependency_links=[ 
     'https://github.com/balanced/balog/tarball/master#egg=balog-0.0.7' 
    ] 
) 

있어 귀하의 예를 setup.py의 문제입니다 :

당신은 종속 연결하면 설정에서 계란 이름을 놓치고있어.

당신은

https://github.com/egemsoft/esef-auth/tarball/master/#egg=1.0.0.0

당신은

https://github.com/egemsoft/esef-auth/tarball/master/#egg=esef-auth-1.0.0.0

+1

''my-extra-libraray == 1.0.0.0 (my-installed-library-currently == 1.0.0.0에서) '을 만족하는 다운로드를 찾을 수 없습니다' –

+0

@AhmetDAL 당신은 의존성 링크 설치가 지정되어 있어야합니까? 당신이 사용하고있는'setup.py'를 게시 할 수 있습니까? – mjallday

+0

내 질문에 편집 된 부분을 참조하십시오. –

14

핍 다시 잠시 dependency_links에 대한 지원을 제거 할 필요가있다.설치하려면 latest version of pip that supports dependency_links is 1.3.1

pip install pip==1.3.1 

종속 링크가 작동해야합니다. dependency_links는 항상 pip의 최후의 수단이었습니다. 즉, 동일한 이름을 가진 패키지가 pypi에 존재하면 귀하가 선택한 것입니다.

참고 : https://github.com/pypa/pip/pull/1955은 dependency_links를 허용하기 시작할 것 같습니다. pip는 유지했지만, 새로운 버전의 pip를 사용하려면 명령 줄 스위치를 사용해야 할 수도 있습니다.

EDIT : pip 7부터 ... dep 링크 알림을 삭제하지 않았더라도 dep 링크를 삭제하고 사용 가능하게 설정했습니다. 여기에 머물러있는 것처럼 보입니다. 여기에 pip> = 7을 사용하면 설치 방법이 있습니다.

pip install -e . --process-dependency-links --allow-all-external 

또는 pip.conf에 다음을 추가하십시오. /etc/pip.conf

[install] 
process-dependency-links = yes 
allow-all-external = yes 
trusted-host = 
    bitbucket.org 
    github.com 

편집 내가 배운 트릭은 그 어떤 경우 핍 (비 의존성 링크 버전을 선호하지 않도록 정말 높은 무언가에 버전 번호를 충돌하는 것입니다

당신이 원하는).

"https://github.com/egemsoft/django-simple-sso/tarball/master#egg=999.0.0", 

또한 버전 중 하나의 예처럼 보이거나 날짜 버전, 만들 것입니다 다른 버전이에게 DEV 버전을 생각하고 늘 설치 PIP 확인 : 위의 예에서와 같은 종속성 링크 보이게 .

+0

더 이상 이런 사례는없는 것 같습니까? dependency_links는 내가 볼 수있는 한 최신 pip에서 지원됩니다. – yelsayed

+0

여전히 경고가 표시되지만 dependency_links는 잠시 동안 머무를 것입니다. 내가 아는 한 여전히 설정이 필요합니다. 답안의 편집 부분에있는 메모를보십시오. – Pykler

+0

어쩌면 당신은 핏빛 버전 1.3.1에 대한 정보를 제거해야합니다. 매우 오래된 것입니다 –

1

나는 내 패키지 의존성 중 하나로서 매끈하게 사용하고자하는 비슷한 상황에 직면했다. 예를 들어, 창을 사용하는 경우 http://www.lfd.uci.edu/~gohlke/pythonlibs/의 .whl 파일을 사용해야한다는 경고가 있습니다. 그렇지 않으면 C 컴파일러를 설치해야하는데, 이것은 내가 원하지 않는 것입니다. 사용자가 다른 것들을 설치하는 대신 단순히 pip install mypackage을 사용하기를 바랍니다.

그리고 당신은 dependency_links

setup(
    name = 'streettraffic', 
    packages = find_packages(), # this must be the same as the name above 
    version = '0.1', 
    description = 'A random test lib', 
    author = 'Costa Huang', 
    author_email = '[email protected]', 
    install_requires=['Shapely==1.5.17'], 
    dependency_links = ['http://www.lfd.uci.edu/~gohlke/pythonlibs/ru4fxw3r/Shapely-1.5.17-cp36-cp36m-win_amd64.whl'] 
) 

으로 전형적인 설정을 가지고 python setup.py install을 실행하면, 단순히 Pypi에 매끈한를 선택하고 Windows 설치에 문제를 일으킬 것입니다. 수 시간의 연구 끝에이 링크 Force setuptools to use dependency_links to install mysqlclient을 발견했으며 기본적으로 매끄럽게 수동으로 설치하려면 from setuptools.command.install import install as _install을 사용합니다.

from setuptools.command.install import install as _install 
from setuptools import setup, find_packages 
import pip 

class install(_install): 
    def run(self): 
    _install.do_egg_install(self) 

    # just go ahead and do it 
    pip.main(['install', 'http://localhost:81/Shapely-1.5.17-cp36-cp36m-win_amd64.whl']) 

setup(
    name = 'mypackage', 
    packages = find_packages(), # this must be the same as the name above 
    version = '0.1', 
    description = 'A random test lib', 
    author = 'Costa Huang', 
    author_email = '[email protected]', 
    cmdclass={'install': install} 
) 

그리고 스크립트는 멋지게 작동합니다. 희망이 도움이됩니다.

관련 문제