pip3 не находит зависимости для моего пакета, хотя он существует - PullRequest
0 голосов
/ 28 февраля 2020

Я создаю setup.py для своего собственного пакета. Мой пакет требует Python зависимости 'rarfile'. Итак, в setup.py я добавил:

setup(
...
    install_requires=[ 'rarfile' ],
)

К сожалению, когда я собираю пакет, загружаю его в test.pypi и тестирую установку, он терпит неудачу, жалуясь на отсутствие соответствующего распределения для rarfile. Странно то, что я могу установить rarfile вручную, используя pip3, без проблем, и он работает.

Тестирование установки с pip3 на моем пакете:

pip3 install --no-cache-dir --index-url https://test.pypi.org/simple/ droidlysis 
Collecting droidlysis
  Downloading https://test-files.pythonhosted.org/packages/01/e8/f7542484ba4acd6a2d079a22c29cd88dcf63cd8334ffa3de29fa5b0ea7a0/droidlysis-3.0.11.tar.gz (40kB)
    100% |████████████████████████████████| 40kB 975kB/s 
Collecting rarfile==3.1 (from droidlysis)
  Could not find a version that satisfies the requirement rarfile==3.1 (from droidlysis) (from versions: )
No matching distribution found for rarfile==3.1 (from droidlysis)

Прямая установка rarfile с pip3:

$ pip3 install rarfile==3.1
Collecting rarfile==3.1
  Using cached https://files.pythonhosted.org/packages/88/0b/107dde3f330d04668e126932a09002ac47348841453aa0391634381fa087/rarfile-3.1.tar.gz
Building wheels for collected packages: rarfile
  Running setup.py bdist_wheel for rarfile ... error
  Complete output from command /home/axelle/softs/myvirtualenvs/testdroidlysis/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yj6ptg3b/rarfile/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 /tmp/tmpnlukg8ugpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for rarfile
  Running setup.py clean for rarfile
Failed to build rarfile
Installing collected packages: rarfile
  Running setup.py install for rarfile ... done
Successfully installed rarfile-3.1

Ответы [ 3 ]

1 голос
/ 28 февраля 2020

Параметр --index-url перезаписывает URL-адрес индекса по умолчанию; это не добавляет к этому. Попробуйте вместо --extra-index-url:

$ pip3 install --no-cache-dir --extra-index-url https://test.pypi.org/simple/ droidlysis
1 голос
/ 28 февраля 2020

Проблема с переключателем --index-url URL.

Это заменит значение по умолчанию pypi.org и вообще его игнорирует. Используйте --extra-index-url URL, чтобы учесть значение по умолчанию pypi.org

Индекс теста не существует rarfile

Справка pip install:

...
Package Index Options:
  -i, --index-url <url>       Base URL of the Python Package Index (default
                              https://pypi.org/simple). This should point to a
                              repository compliant with PEP 503 (the simple
                              repository API) or a local directory laid out in
                              the same format.
  --extra-index-url <url>     Extra URLs of package indexes to use in addition
                              to --index-url. Should follow the same rules as
                              --index-url.
...
1 голос
/ 28 февраля 2020

Вы использовали --index-url https://test.pypi.org/simple/, и поэтому pip означает , только просматривая этот индекс, а не другие .

Нет https://test.pypi.org/project/rarfile, поэтому установка действительно не удалась.

Либо

  • используйте несколько --index-url переключателей для включения pypi.org/index и test.pypi.org/index,
  • или используйте --extra-index-url до add test.pypi.org/index к местам поиска
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...