Serving: pip install tensorflow-serving-api with tensorflow-gpu

Created on 15 Oct 2018  路  10Comments  路  Source: tensorflow/serving

I have installed a tensorflow gpu version, but the tensorflow-serving-api need the dependency of tensorflow. So it will install a new cpu version tensorflow. What can i do to avoid the reinstall or the tensorflow-serving-api is incompatible with gpu tensoflow?

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ubuntu
  • **TensorFlow version: 1.6.0, gpu
awaiting response builinstall

Most helpful comment

Another suboptimal but plausible approach is to release a tensorflow-serving-api-gpu that is identical in every way but depends on tensorflow-gpu.

The benefit is that it mirrors the tensofow release and is unambiguous on what to try to install, and doesn鈥檛 break any systems that expect all pip installs to actually install required dependencies. The drawback is that it鈥檚 a package without meaningful distinction on its own.

Are there any other drawbacks I鈥檓 missing to this approach?

All 10 comments

The api's are agnostic to cpu or gpu, and should work for either setup.

The dependency on TF is here -- this needs to be made conditional. IOW we need to express a package dependency on tensorflow OR tensorflow-gpu (i do not know if PIP allows for that).

Happy to accept PRs to fix this in PIP.

While we fix this, have you considered using the latest docker images (for gpu or cpu), that have API installed in them (post https://github.com/tensorflow/serving/commit/1277991345f2144f194c6d5b87dc862a02068c5d)? You can find more details on using docker here.

Hi @netfs ,are there any ways to build tensorflow serving api myself?

@netfs That seems has no solution now. And i find other tensorflow related projects, they add the dependency to extras_require 7166. I think it is at least better than in install_requires. I will pick it up if you agree with me.

does listing deps in extras_requirecause pip to install them? IOW whats is the difference between extras_ vs install_ requires? we do not want to loose the ability to install tensorflow package when installing the API package, as using the API requires tensorflow python bits (and hence the package).

regarding building your own PIP package you can use build_pip_package.sh

The ability to install tensorflow package limits the GPU users, as the only way to install for GPU user is build pip themselves. However if in extras_ , the CPU and GPU users just need to install tensorflow themselves. I realize the tensorflow is necessary for tensorflow_serving_api. In tradition, it should be put in install_. But as the problem we met and thinking the importance of gpu in ML, I think extras_ is a better solution in a whole world

@gautamvasudevan do you have any thoughts/suggestions?

Another suboptimal but plausible approach is to release a tensorflow-serving-api-gpu that is identical in every way but depends on tensorflow-gpu.

The benefit is that it mirrors the tensofow release and is unambiguous on what to try to install, and doesn鈥檛 break any systems that expect all pip installs to actually install required dependencies. The drawback is that it鈥檚 a package without meaningful distinction on its own.

Are there any other drawbacks I鈥檓 missing to this approach?

@zlcnju - Hi, feel free to close this issue if it's resolved.

@gautamvasudevan I'd definitely support this. It's consistent with the pip-based installation process for other tensorflow libraries like tensorflow probability too, and helps with building using conda env for example. Though I agree that it's a little silly here since there are no other code changes.

@harshini-gadige Not resolved And I support @gautamvasudevan

Was this page helpful?
0 / 5 - 0 ratings