在python中,为什么“ python setup.py build”成功而“ pip install”成功。失败?

时间:2019-05-21 21:35:07

标签: python pip setup.py

我有一个包含以下setup.py文件的小项目:

from setuptools import setup, find_packages

setup(
    name='jupyterlab-desktop',
    version='0.1.0',
    author='Peng Cheng',
    author_email='pc175@uow.edu.au',
    description='... in an app-mode browser',
    long_description=open("../README.md").read(),
    url='https://github.com/mwouts/jupytext',
    packages=find_packages(exclude=['tests']),
    scripts=['../jupyter_apps/jupyterlab-app', '../jupyter_apps/jupyternotebook-app'],
    # entry_points={'console_scripts': ['jupyter-desktop=jupyterlab-desktop:main']},
    install_requires=['jupyterlab >= 0.35.0'],
    tests_require=['pytest'],
    license='Apache 2.0',
    classifiers=['Development Status :: 5 - Production/Stable',
                 'License :: OSI Approved :: Apache 2.0 License',
                 'Environment :: Console',
                 'Framework :: Jupyter',
                 'Intended Audience :: Developers',
                 'Intended Audience :: Science/Research',
                 'Topic :: Text Processing :: Markup',
                 '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']
)

分别运行python setup.py buildpip install .时,得到以下结果:

(jupyerlab-desktop) peng@peng-ThinkPad-P51s:~/git/jupyerlab-desktop/python$ python setup.py build
running build
running build_py
running build_scripts


(jupyerlab-desktop) peng@peng-ThinkPad-P51s:~/git/jupyerlab-desktop/python$ pip install .
Processing /home/peng/git/jupyerlab-desktop/python
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-kg5jwcjs/setup.py", line 9, in <module>
        long_description=open("../README.md").read(),
    FileNotFoundError: [Errno 2] No such file or directory: '../README.md'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-kg5jwcjs/

这是怎么回事?完全相同的环境,第一次找到文件,第二次找不到文件。

更新1 :之后还会出现更多奇怪的事情:

我已经决定绕过long_description并立即构建该软件包,因此我将其注释掉。再次运行pip install .时,遇到以下消息,该消息似乎是由相同的相对路径错误引起的:

(jupyerlab-desktop) peng@peng-ThinkPad-P51s:~/git/jupyerlab-desktop/python$ pip install .
Processing /home/peng/git/jupyerlab-desktop/python
Requirement already satisfied: jupyterlab>=0.35.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jupyterlab-desktop==0.1.0) (0.35.6)
Requirement already satisfied: jupyterlab-server<0.3.0,>=0.2.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.2.0)
Requirement already satisfied: notebook>=4.3.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (5.7.8)
Requirement already satisfied: jsonschema>=2.6.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jupyterlab-server<0.3.0,>=0.2.0->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (3.0.1)
Requirement already satisfied: tornado<7,>=4.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (6.0.2)
Requirement already satisfied: Send2Trash in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (1.5.0)
Requirement already satisfied: terminado>=0.8.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.8.2)
Requirement already satisfied: pyzmq>=17 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (18.0.1)
Requirement already satisfied: prometheus-client in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.6.0)
Requirement already satisfied: jinja2 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (2.10.1)
Requirement already satisfied: ipython-genutils in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.2.0)
Requirement already satisfied: jupyter-client>=5.2.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (5.2.4)
Requirement already satisfied: nbconvert in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (5.5.0)
Requirement already satisfied: jupyter-core>=4.4.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (4.4.0)
Requirement already satisfied: traitlets>=4.2.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (4.3.2)
Requirement already satisfied: ipykernel in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (5.1.1)
Requirement already satisfied: nbformat in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (4.4.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jsonschema>=2.6.0->jupyterlab-server<0.3.0,>=0.2.0->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.15.2)
Requirement already satisfied: attrs>=17.4.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jsonschema>=2.6.0->jupyterlab-server<0.3.0,>=0.2.0->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (19.1.0)
Requirement already satisfied: six>=1.11.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jsonschema>=2.6.0->jupyterlab-server<0.3.0,>=0.2.0->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (1.12.0)
Requirement already satisfied: setuptools in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg (from jsonschema>=2.6.0->jupyterlab-server<0.3.0,>=0.2.0->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (40.8.0)
Requirement already satisfied: ptyprocess; os_name != "nt" in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from terminado>=0.8.1->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.6.0)
Requirement already satisfied: MarkupSafe>=0.23 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jinja2->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (1.1.1)
Requirement already satisfied: python-dateutil>=2.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jupyter-client>=5.2.0->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (2.8.0)
Requirement already satisfied: bleach in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (3.1.0)
Requirement already satisfied: mistune>=0.8.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (1.4.2)
Requirement already satisfied: entrypoints>=0.2.2 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.3)
Requirement already satisfied: testpath in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.4.2)
Requirement already satisfied: defusedxml in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.6.0)
Requirement already satisfied: pygments in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (2.4.0)
Requirement already satisfied: decorator in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from traitlets>=4.2.1->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (4.4.0)
Requirement already satisfied: ipython>=5.0.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (7.5.0)
Requirement already satisfied: webencodings in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from bleach->nbconvert->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.5.1)
Requirement already satisfied: pexpect; sys_platform != "win32" in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (4.7.0)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (2.0.9)
Requirement already satisfied: backcall in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.1.0)
Requirement already satisfied: pickleshare in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.7.5)
Requirement already satisfied: jedi>=0.10 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.13.3)
Requirement already satisfied: wcwidth in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.1.7)
Requirement already satisfied: parso>=0.3.0 in /home/shared/virtualenv/jupyerlab-desktop/lib/python3.7/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab>=0.35.0->jupyterlab-desktop==0.1.0) (0.4.0)
Installing collected packages: jupyterlab-desktop
  Running setup.py install for jupyterlab-desktop ... error
    Complete output from command /home/shared/virtualenv/jupyerlab-desktop/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-8w_kia4h/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-fu9mzdhk/install-record.txt --single-version-externally-managed --compile --install-headers /home/shared/virtualenv/jupyerlab-desktop/include/site/python3.7/jupyterlab-desktop:
    running install
    running build
    running build_py
    running build_scripts
    error: file '/tmp/jupyter_apps/jupyterlab-app' does not exist

    ----------------------------------------
Command "/home/shared/virtualenv/jupyerlab-desktop/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-8w_kia4h/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-fu9mzdhk/install-record.txt --single-version-externally-managed --compile --install-headers /home/shared/virtualenv/jupyerlab-desktop/include/site/python3.7/jupyterlab-desktop" failed with error code 1 in /tmp/pip-req-build-8w_kia4h/

如果这表明我的环境已损坏(并且无法在其他任何地方复制),那么是否有办法验证这一假设?

0 个答案:

没有答案