python setup.py install ignores install_requires

坚强是说给别人听的谎言 提交于 2021-02-17 04:55:13

问题


I am unable to install the local packages using setup.py

Here is the project structure:

my-project/
  lib/
     local1/
        local1.1.0.whl
        index.html
     local2/
        local2.1.0.whl
        index.html
  setup.py

setup.py

import os

from setuptools import setup

setup(name='my project',
      version='1.0',
      description='my project',
      install_requires=[
        'lxml >= 4.3.0',
        'local1 @ file://localhost/{}/lib/local1/local1.1.0.whl'.format(os.getcwd()),
        'local2 @ file://localhost/{}/lib/local2/local2.2.0.whl'.format(os.getcwd()),
      ]
      )

I can install if I put the dependencies in a requirements.txt file and use pip install -r requirements.txt --extra-index-url lib/, but I want to know why is it not possible to do python setup.py install or if I am missing something.

This is the error that I get -

No local packages or working download links found for local2@ file://localhost//Users/anusha/Documents/my-project/lib/local2/local2.1.0.whl
error: Could not find suitable distribution for Requirement.parse('local2@ file://localhost//Users/anusha/Documents/my-project/lib/local2/local2.1.0.whl')

On searching, I found this issue on github, but does not give me any pointers or solution as to how it worked.

Any help is welcome, thanks in advance!


回答1:


Note this comment from pganssle in the discussion "Setuptools install fails with PEP508 URLs" in setuptools's issue tracker:

Our policy to date has been that if using pip install fixes your problem, you should use pip install and we won't fix the issue.

I believe this is in line with the current evolution of the packaging tools and techniques in the Python community. So if your setuptools-based project with this requirement notation can be installed via pip install . and pip install --editable ., then look no further.



来源:https://stackoverflow.com/questions/60370913/python-setup-py-install-ignores-install-requires

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!