0

tflite_runtime is not hosted in pypi, but can be installed as:

pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime

How can I package my project which has this dependency?

I have seen this setuptools docs and some threads 1, 2 but no luck so far.

setup.cfg

[options]
...
dependency_links = https://google-coral.github.io/py-repo/tflite-runtime/
install_requires =
    tflite_runtime==2.5.0

Bonus: locally I use mac. My deployment will be on linux. Is there a way to install the right whl based on OS?

2
  • 1
    dependency_links were declared obsolete and finally removed in pip 19.0. The replacement for it is install_requires with special syntax (supported since pip 19.1): 'package_name @ git+https://gitlab.com/<user>/<repo>.git@<commit>'. See pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers and python.org/dev/peps/pep-0440/#direct-references . This requires pip install and doesn't work with python setup.py install. Commented May 18, 2021 at 0:45
  • I suspect dependencies that aren’t in PyPI are not fully supported now. Either you point a direct reference to an exact file (no platform and no version variability) or to a VCS repository. But not to an extra index. Commented May 18, 2021 at 0:52

1 Answer 1

0

This worked for me to install .whl package and make it OS specific.

setup.py

import setuptools
import platform

# tflite for linux
tflite = "tflite_runtime@https://github.../tflite_runtime-...-cp37m-linux...",

if platform.system() == 'Darwin':
    # tflite for macos
    tflite = "tflite_runtime@https://github../tflite_runtime...cp37m-macosx..."

setuptools.setup(
    include_package_data=True,
    install_requires=[
        tflite,
        ...
    ]

A cleaner approach should be using Environment Markers, but I couldn't get that to work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.