Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill install_dependencies.py (for conda) #2753

Open
msaroufim opened this issue Oct 31, 2023 · 0 comments
Open

Kill install_dependencies.py (for conda) #2753

msaroufim opened this issue Oct 31, 2023 · 0 comments
Labels
debugging dependencies Pull requests that update a dependency file

Comments

@msaroufim
Copy link
Member

msaroufim commented Oct 31, 2023

🚀 The feature

Right now the first time a user needs to run torchserve they need to

python install_dependencies.py
pip install torchserve or pip install .

This is confusing to users mostly used to the python ecosystem so how can we fix this? Especially as we move towards a python client like with the recent PR #2751 how can we make it easier to install torchserve within something like a notebook

Our install_dependencies.py is primarily used to install java, nodejs (for dev builds) and wget

We can't completely get rid of the script but we can recommend more users use conda if we think the below is more convenient

Motivation, pitch

The issue is torchserve is not a pure python library and at least within the pip ecosystem there is no way around this, you can't package non python dependencies easily

But you can in conda!

And I have a proof of concept, given this file binaries/conda/torchserve/meta.yaml where all we need to do is add our dependencies under run in the meta.yaml

package:
  name: torchserve
  version: "1.0"

source:
  path: "/Users/marksaroufim/Dev/serve"

requirements:
  build:
    - python
    - setuptools

  run:
    - python
    - pillow
    - psutil
    - nodejs
    - openjdk
    - wget

build:
  script: "{{ PYTHON }} -m pip install . -vv"

about:
  home: https://github.com/pytorch/serve
  summary: 'Model serving on PyTorch'

Build it

marksaroufim@marksaroufim-mbp conda % pwd
/Users/marksaroufim/Dev/serve/binaries/conda
marksaroufim@marksaroufim-mbp conda % conda build torchserve  

Test it

marksaroufim@marksaroufim-mbp conda % conda create -n test-torchserve torchserve --use-local

Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 23.1.0
  latest version: 23.9.0

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=23.9.0



## Package Plan ##

  environment location: /Users/marksaroufim/opt/anaconda3/envs/test-torchserve

  added / updated specs:
    - torchserve


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libdeflate-1.17            |       hb664fd8_1          67 KB
    libtiff-4.5.1              |       hcec6c5f_0         508 KB
    libuv-1.44.2               |       h6c40b1e_0         388 KB
    libwebp-1.3.2              |       hf6ce154_0          84 KB
    libwebp-base-1.3.2         |       h6c40b1e_0         371 KB
    nodejs-18.16.0             |       he8a3799_1        11.8 MB
    openjdk-11.0.13            |       h8346a28_0       166.6 MB
    pillow-10.0.1              |   py39h7d39338_0         701 KB
    torchserve-1.0             |           py39_0        22.7 MB  local
    wget-1.21.4                |       hf20ceda_1         364 KB
    ------------------------------------------------------------
                                           Total:       203.5 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2023.08.22-hecd8cb5_0 
  freetype           pkgs/main/osx-64::freetype-2.12.1-hd8bbffd_0 
  giflib             pkgs/main/osx-64::giflib-5.2.1-h6c40b1e_3 
  icu                pkgs/main/osx-64::icu-73.1-hcec6c5f_0 
  jpeg               pkgs/main/osx-64::jpeg-9e-h6c40b1e_1 
  lcms2              pkgs/main/osx-64::lcms2-2.12-hf1fd2bf_0 
  lerc               pkgs/main/osx-64::lerc-3.0-he9d5cce_0 
  libcxx             pkgs/main/osx-64::libcxx-14.0.6-h9765a3e_0 
  libdeflate         pkgs/main/osx-64::libdeflate-1.17-hb664fd8_1 
  libffi             pkgs/main/osx-64::libffi-3.4.4-hecd8cb5_0 
  libidn2            pkgs/main/osx-64::libidn2-2.3.4-h6c40b1e_0 
  libpng             pkgs/main/osx-64::libpng-1.6.39-h6c40b1e_0 
  libtiff            pkgs/main/osx-64::libtiff-4.5.1-hcec6c5f_0 
  libunistring       pkgs/main/osx-64::libunistring-0.9.10-h9ed2024_0 
  libuv              pkgs/main/osx-64::libuv-1.44.2-h6c40b1e_0 
  libwebp            pkgs/main/osx-64::libwebp-1.3.2-hf6ce154_0 
  libwebp-base       pkgs/main/osx-64::libwebp-base-1.3.2-h6c40b1e_0 
  lz4-c              pkgs/main/osx-64::lz4-c-1.9.4-hcec6c5f_0 
  ncurses            pkgs/main/osx-64::ncurses-6.4-hcec6c5f_0 
  nodejs             pkgs/main/osx-64::nodejs-18.16.0-he8a3799_1 
  openjdk            pkgs/main/osx-64::openjdk-11.0.13-h8346a28_0 
  openjpeg           pkgs/main/osx-64::openjpeg-2.4.0-h66ea3da_0 
  openssl            pkgs/main/osx-64::openssl-3.0.11-hca72f7f_2 
  pillow             pkgs/main/osx-64::pillow-10.0.1-py39h7d39338_0 
  pip                pkgs/main/osx-64::pip-23.3-py39hecd8cb5_0 
  psutil             pkgs/main/osx-64::psutil-5.9.0-py39hca72f7f_0 
  python             pkgs/main/osx-64::python-3.9.18-h5ee71fb_0 
  readline           pkgs/main/osx-64::readline-8.2-hca72f7f_0 
  setuptools         pkgs/main/osx-64::setuptools-68.0.0-py39hecd8cb5_0 
  sqlite             pkgs/main/osx-64::sqlite-3.41.2-h6c40b1e_0 
  tk                 pkgs/main/osx-64::tk-8.6.12-h5d9f67b_0 
  torchserve         Users/marksaroufim/opt/anaconda3/conda-bld/osx-64::torchserve-1.0-py39_0 
  tzdata             pkgs/main/noarch::tzdata-2023c-h04d1e81_0 
  wget               pkgs/main/osx-64::wget-1.21.4-hf20ceda_1 
  wheel              pkgs/main/osx-64::wheel-0.41.2-py39hecd8cb5_0 
  xz                 pkgs/main/osx-64::xz-5.4.2-h6c40b1e_0 
  zlib               pkgs/main/osx-64::zlib-1.2.13-h4dc903c_0 
  zstd               pkgs/main/osx-64::zstd-1.5.5-hc035e20_0 


Proceed ([y]/n)? 

You can see that nodejs, java and wget are all installed

Alternatives

No response

Additional context

No response

@msaroufim msaroufim added dependencies Pull requests that update a dependency file debugging labels Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugging dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

1 participant