Pip install from GitHub repo 抛出 wheel 错误
Pip install from GitHub repo throws wheel error
当我运行:
pip install git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python
我看到这个输出:
Cloning ssh://git@github.mycompany.com/developer/sdk-python.git (to revision master) to /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk-python
Generating metadata for package sdk-python produced metadata for project name sdk. Fix your #egg=sdk-python fragments.
Requirement already satisfied: requests in ./venv27/lib/python2.7/site-packages (from sdk) (2.21.0)
Requirement already satisfied: python-dateutil in ./venv27/lib/python2.7/site-packages (from sdk) (2.8.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (1.24.1)
Requirement already satisfied: six>=1.5 in ./venv27/lib/python2.7/site-packages (from python-dateutil->sdk) (1.12.0)
Building wheels for collected packages: sdk, sdk
Building wheel for sdk (setup.py) ... done
Stored in directory: /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-ephem-wheel-cache-twLUBT/wheels/e5/b9/06/c754f4c2a0a2b191960dabcfc6f1dc7d0bb231e844cf4a032e
Building wheel for sdk (setup.py) ... error
Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-wheel-OIQ_lk --python-tag cp27:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'
----------------------------------------
Failed building wheel for sdk
Running setup.py clean for sdk
Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'
----------------------------------------
Failed cleaning build dir for sdk
Successfully built sdk
Failed to build sdk
Installing collected packages: sdk
Successfully installed sdk-1.0.0
在我看来好像安装了 sdk-python。我什至可以看到它 pip list
。但是,我不明白这些错误。其他类似的帖子建议缺少 depedencies,但我看不到任何丢失的东西。
谁能告诉我怎么了?
下面是我的setup.py。我相信它是正确的,但这是我第一次创建它,所以我主要基于我在网上找到的东西,所以它可能不正确。如果它有任何明显的错误,我很想知道那是什么。
#!/usr/bin/env python
import os
import re
import sys
from setuptools import setup, find_packages
# sdk python version check
_valid = sys.version_info[:2] == (2,7) or sys.version_info >= (3,4)
if not _valid:
sys.exit("Sorry, SDK only supports versions 2.7, 3.4, 3.5, 3.6, 3.7 of python.")
ROOT = os.path.dirname(__file__)
VERSION_RE = re.compile(r'''__version__ = ['"]([a-z0-9._-]+)['"]''')
requirements = [
'requests',
'python-dateutil'
]
def get_version():
init = open(os.path.join(ROOT, 'sdk', '__init__.py')).read()
return VERSION_RE.search(init).group(1)
setup(
name='sdk',
version=get_version(),
description='SDK for Python',
long_description=open('README.md').read(),
author='me',
url='https://github.mycompany.com/developer/sdk-python',
scripts=[],
packages=find_packages(exclude=['tests*']),
include_package_data=True,
install_requires = requirements,
license="Apache License 2.0",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
附加信息
如果我 运行 这个:
它安装没有问题
pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python
我应该包括 -e
吗?我一直认为它是可选的,只有在我想编辑包时才会使用它。
我的 setup.py
中的名称是 sdk
,但我的鸡蛋名称是 sdk-python
。据我所知,这些应该是相同的。
我将我的命令更改为这个并且它起作用了:
pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk
当我运行:
pip install git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python
我看到这个输出:
Cloning ssh://git@github.mycompany.com/developer/sdk-python.git (to revision master) to /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk-python
Generating metadata for package sdk-python produced metadata for project name sdk. Fix your #egg=sdk-python fragments.
Requirement already satisfied: requests in ./venv27/lib/python2.7/site-packages (from sdk) (2.21.0)
Requirement already satisfied: python-dateutil in ./venv27/lib/python2.7/site-packages (from sdk) (2.8.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (1.24.1)
Requirement already satisfied: six>=1.5 in ./venv27/lib/python2.7/site-packages (from python-dateutil->sdk) (1.12.0)
Building wheels for collected packages: sdk, sdk
Building wheel for sdk (setup.py) ... done
Stored in directory: /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-ephem-wheel-cache-twLUBT/wheels/e5/b9/06/c754f4c2a0a2b191960dabcfc6f1dc7d0bb231e844cf4a032e
Building wheel for sdk (setup.py) ... error
Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-wheel-OIQ_lk --python-tag cp27:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'
----------------------------------------
Failed building wheel for sdk
Running setup.py clean for sdk
Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'
----------------------------------------
Failed cleaning build dir for sdk
Successfully built sdk
Failed to build sdk
Installing collected packages: sdk
Successfully installed sdk-1.0.0
在我看来好像安装了 sdk-python。我什至可以看到它 pip list
。但是,我不明白这些错误。其他类似的帖子建议缺少 depedencies,但我看不到任何丢失的东西。
谁能告诉我怎么了?
下面是我的setup.py。我相信它是正确的,但这是我第一次创建它,所以我主要基于我在网上找到的东西,所以它可能不正确。如果它有任何明显的错误,我很想知道那是什么。
#!/usr/bin/env python
import os
import re
import sys
from setuptools import setup, find_packages
# sdk python version check
_valid = sys.version_info[:2] == (2,7) or sys.version_info >= (3,4)
if not _valid:
sys.exit("Sorry, SDK only supports versions 2.7, 3.4, 3.5, 3.6, 3.7 of python.")
ROOT = os.path.dirname(__file__)
VERSION_RE = re.compile(r'''__version__ = ['"]([a-z0-9._-]+)['"]''')
requirements = [
'requests',
'python-dateutil'
]
def get_version():
init = open(os.path.join(ROOT, 'sdk', '__init__.py')).read()
return VERSION_RE.search(init).group(1)
setup(
name='sdk',
version=get_version(),
description='SDK for Python',
long_description=open('README.md').read(),
author='me',
url='https://github.mycompany.com/developer/sdk-python',
scripts=[],
packages=find_packages(exclude=['tests*']),
include_package_data=True,
install_requires = requirements,
license="Apache License 2.0",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
附加信息
如果我 运行 这个:
它安装没有问题pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python
我应该包括 -e
吗?我一直认为它是可选的,只有在我想编辑包时才会使用它。
我的 setup.py
中的名称是 sdk
,但我的鸡蛋名称是 sdk-python
。据我所知,这些应该是相同的。
我将我的命令更改为这个并且它起作用了:
pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk