-
Notifications
You must be signed in to change notification settings - Fork 2.2k
_TF_REQ is not compatible with tensorflow-cpu
requirements using pip
#1847
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
base: master
Are you sure you want to change the base?
Conversation
When `tensorflow-cpu` is already installed, `tensorflow-serving-api` package cannot detect tesnroflow installation. `https://pypi.org/project/tensorflow-serving-api/` should follow `tensorflow-cpu` `https://pypi.org/project/tensorflow-serving-api-gpu/` is now folloing `tensorflow-gpu` requirement.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
tensorflow-cpu
requirements using piptensorflow-cpu
requirements using pip
@@ -44,7 +44,7 @@ | |||
sys.argv.remove('--project_name') | |||
sys.argv.pop(project_name_idx) | |||
|
|||
_TF_REQ = ['tensorflow'+_TF_VERSION_SANITIZED] | |||
_TF_REQ = ['tensorflow-cpu'+_TF_VERSION_SANITIZED] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break for people who have tensorflow
package installed:
https://pypi.org/project/tensorflow/
is there a way to specify a list of packages, where any one of them can be installed to satisfy the requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
import pkg_resources
pkg_released = set(["tensorflow", "tensorflow-cpu"])
pkg_installed = set(map(lambda pkg: pkg.project_name, pkg_resources.working_set))
tensorflow_installed = list(pkg_released & pkg_installed) + ["tensorflow"]
_TF_REQ = [tensorflow_installed[0]+_TF_VERSION_SANITIZED]
@@ -44,7 +45,11 @@ | |||
sys.argv.remove('--project_name') | |||
sys.argv.pop(project_name_idx) | |||
|
|||
_TF_REQ = ['tensorflow'+_TF_VERSION_SANITIZED] | |||
pkg_released = set(["tensorflow", "tensorflow-cpu"]) | |||
pkg_installed = set(map(lambda pkg: pkg.project_name, pkg_resources.working_set)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for my understanding, is pkg_resources.working_set from the machine where this package is going to be installed OR is this from the machine where the package is being built? we obviously want the former (list packages installed on the target).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my misunderstanding. That is for the latter, not the former one.
I think there is no solution for conditional requirements
.
Creating new package is another solution with tensorflow-serving-api-cpu
And then add tensorflow-cpu
to _TF_REQ
when package name is tensorflow-serving-api-cpu
ex) https://pypi.org/project/tensorflow-serving-api-cpu/
Same as tensorflow
package, https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py
When
tensorflow-cpu
is already installed,tensorflow-serving-api
package cannot detect tensorflow installation.https://pypi.org/project/tensorflow-serving-api/
should followtensorflow-cpu
https://pypi.org/project/tensorflow-serving-api-gpu/
is now folloingtensorflow-gpu
requirement.