Install TensorFlow and PyTorch Silverblue

Hello there,
Im new to silverblue and i like it.

Any advice how to install TensorFlow and PyTorch on Silverblue?
Also need Anaconda, cuda toolkit, pip3 etc

There is nothing in the flathub repo. Any way to install them?

I installed flat rpmfusion and flat flathub. I would love some advice. Thank you

You could use toolbox. Create a toolbox container with toolbox create then use it with toolbox enter. I’m pretty sure python3 is part of F31SB (yup, just verified it) as it is also part of F31WS, and it likely is part of the toolbox image created. I guess then you would just install TensorFlow in toolbox with dnf install <TensorFlowPkgName> from within the toolbox container you created, if you chose to run it inside of a toolbox. Conversely, if it is available as a package that you would normally install on Fedora Workstation via DNF, you could use rpm-ostree to layer with rpm-ostree install <TensorFlowPkgName>.

When i install things with pip3, are those things installed in a Layered Package?

I am uncertain of that, my Python experiences are limited. Having said that, if you install as user, it may (and likely will) install specifically for that user, and consequently in your home dir likely in .local/share or maybe even .var/app such as the flatpaks do. So it would then be not a layered package but a local one, if that makes sense.

I install with pip3 on silverblue all the time. In my case I prefer installing pip packages to my home directory with the user flag, since I often find myself needing the package inside a Toolbox as well as outside (if the package is in the home directory, it will work on both).

Example: pip3 install --user ansible

I THINK installing with pip without the user flag will result in a usr local install, which is okay with silverblue (unlike usr bin, which is sacred and needs layering to change). But I haven’t tried it in a while since I prefer the user flag anyway.

1 Like

I seem to have issues installing some things with conda and pip3.

Im not sure how valid it is but i read from multiple sources that its faster to install tensorflow via conda, for god knows what reason i cant install tensorflow-gpu 2.1 or 2.0 via Conda in a toolbox. Could anyone try and tell me if it works for you?

I want to try out Tensorflow too, unsucssefully.

First by trying out conda, I installed it inside toolbox and did this:

⬢ conda create -p ~/bin/conda
⬢ conda activate bin/conda
# and one more command to initialize bashrc
But conda does not have version 2 of Tensorflow with Radeon support, so I removed it.

Now trying it the the pip way (inside toolbox) I cannot install it either:

⬢ sudo dnf install python3-pip
⬢ pip3 install tensorflow-rocm

    Running setup.py install for termcolor ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3ik1b46q/termcolor/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3ik1b46q/termcolor/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-0z7329tm/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-3ik1b46q/termcolor/
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying termcolor.py -> build/lib
    running install_lib
    creating /usr/local/lib/python3.8
    error: could not create '/usr/local/lib/python3.8': Permission denied
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3ik1b46q/termcolor/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3ik1b46q/termcolor/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-0z7329tm/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

edit:
this does it I hope:
⬢ pip3 install --user tensorflow-rocm

Note that there are containers like the one using ROCm (for AMD users) which are ready to use.