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

CPU installation #547

Closed
numpde opened this issue Apr 5, 2021 · 4 comments
Closed

CPU installation #547

numpde opened this issue Apr 5, 2021 · 4 comments

Comments

@numpde
Copy link

numpde commented Apr 5, 2021

I'm installing as follows:

python3 -m venv venv
source venv/bin/activate
pip install tensorflow-cpu==2.4.1
pip install tensorflow-text

But the last install also installs tensorflow<2.5,>=2.4.0, which I don't want. How can I stick to the CPU version?

@broken
Copy link
Member

broken commented Apr 8, 2021

Install tensorflow-cpu again after installing tensorflow-text.

This is the same issue as #195 (though the default tensorflow has changed). Unfortunately, I do not believe there is a way to not uninstall tensorflow-cpu due to the limitations of pip, so you just need to manually install it again after.

@numpde
Copy link
Author

numpde commented Apr 9, 2021

Thanks @broken. Whenever 'there is no way', one must needs try.

With these requirements.txt:

tensorflow-text

and constraints.txt (note the "cpu" in the url):

tensorflow @ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.1-cp38-cp38-manylinux2010_x86_64.whl

installing with

pip install -r requirements.txt -c constraints.txt

seems to settle for the CPU version right away. Perhaps there is a more elegant way (i.e. url-free).

@broken
Copy link
Member

broken commented Apr 9, 2021

Great! I'll keep this constraints trick in mind when asked this question in the future.

Ultimately, I would love for this to be automatic. So when anybody ran pip install tensorflow-text, it would ensure tensorflow or tensorflow-cpu is installed at the correct version and not require any manual intervention on the user side.

@broken broken closed this as completed Apr 9, 2021
@buhrmann
Copy link

For future reference, the same trick seems to work also without a constraints file, since specifying a wheel location using @ is a valid requirement spec. So you can simple have this in the requirements.txt file e.g.:

tensorflow @ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.5.0-cp38-cp38-manylinux2010_x86_64.whl 
tensorflow_text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants