Integrate R with OpenBLAS in Fedora

desktop

#1

I saw this post, which is done on Ubuntu, and would like to do it in Fedora 29. I am not sure if this is doable in Fedora.


#2

sudo dnf install openblas r maybe? I just did a check on my toolbox container and dnf returns package info for both R and openblas when I issue dnf info r and dnf info openblas. It should be the same on Fedora 29 Workstation.


#3

I am OK with this part, but I am not sure about the alternative updating part.


#4

I’m still not sure I’m following … when I do update-alternatives on my Silverblue install in a terminal it gives me output similar to -h option if running it. I would conclude the command can be used the same way the author posts after you have installed the library options as they had. I can find liblas, liblas-devel, and liblas-tools on Fedora with dnf info. I think if there are other variants you need, you would have to tell dnf how to find the rpm repository they are at. Using dnf --enable-repo <reponame> will enable the specified repo on your system. I did some checking and there are various discussions on using a container for R testing with various configurations and container options available it seems. Check out this link I think it may have some starting points for that approach https://community.rstudio.com/t/containers-and-r/2312


#5

Yeah - I’d look at running RStudio Server in a container via Rocker - https://hub.docker.com/r/rocker/rstudio/.

I’ve run it via Podman - just do sudo podman run -d -e PASSWORD=<your password for the 'rstudio' login> -p 8787:8787 docker.io/rocker/rstudio.

There are a bunch of versions - for most folks, rocker/tidyverse is the one you’ll want.

I do have a script somewhere for getting the RStudio stack up and running on Silverblue if people want it.


#6

I am not familiar with this container stuff, just want to get R integrated with OpenBLAS.


#7

Well, folks … it turns out that podman invocation doesn’t work the same way its docker equivalent does. With docker, you can browse to localhost:8787 and log in to RStudio Server. But with podman, the container runs and all that

$ sudo podman ps
CONTAINER ID  IMAGE                            COMMAND  CREATED         STATUS             PORTS                   NAMES
bb819dee0c35  docker.io/rocker/rstudio:latest  /init    19 minutes ago  Up 19 minutes ago  0.0.0.0:8787->8787/tcp  rstudio

but you can’t browse to it on localhost:8787.

Unable to connect

Firefox can’t establish a connection to the server at localhost:8787.

* The site could be temporarily unavailable or too busy. Try again in a few moments.
* If you are unable to load any pages, check your computer’s network connection.
* If your computer or network is protected by a firewall or proxy, make sure that Firefox Developer Edition is permitted to access the Web.

I’ve searched the web for answers and found nothing - this should work. But it doesn’t. Is there some firewall setting that needs to happen, or some other networking configuration for podman that Docker is handling automatically?


#8

As a workaround, maybe try --net host?

Also, did the container print any log messages? (I usually use podman --rm -it and leave it open in a terminal tile solely because it’s easier to debug what’s going on.)


#9

--net host doesn’t help. sudo podman inspect and page down to the Network settings:

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": [],
            "SandboxKey": "",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": ""
        },

So … force remove the container and try without --net host:

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": [
                {
                    "hostPort": 8787,
                    "containerPort": 8787,
                    "protocol": "tcp",
                    "hostIP": ""
                }
            ],
            "SandboxKey": "/var/run/netns/cni-f10f03a6-7348-b652-193d-b3c2ea5f6f3f",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "10.88.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "10.88.0.10",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "f6:b2:a7:14:b3:d9"
        },

That’s a little better, but why is hostIP an empty string? OK - try browing to the container’s IP address: $ xdg-open http://10.88.0.10:8787. Nope - still can’t see it in the browser.

I’m guessing there are some explicit setup steps to get the networking configured that I don’t have.

$ nmcli dev
DEVICE       TYPE      STATE      CONNECTION 
enp2s0       ethernet  connected  enp2s0     
cni0         bridge    connected  cni0       
docker0      bridge    connected  docker0    
virbr0       bridge    connected  virbr0     
lo           loopback  unmanaged  --         
virbr0-nic   tun       unmanaged  --         
wlp0s18f2u5  wifi      unmanaged  --         

#10

It’s some kind of permissions problem inside the container:

$ sudo podman logs rstudio
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] add: executing... 
Nothing additional to add
[cont-init.d] add: exited 0.
[cont-init.d] userconf: executing... 
[cont-init.d] userconf: exited 0.
[cont-init.d] done.
[services.d] starting services
s6-supervise (child): fatal: unable to exec run: Permission denied
s6-supervise rstudio: warning: unable to spawn ./run - waiting 10 seconds
[services.d] done.
s6-supervise (child): fatal: unable to exec run: Permission denied
s6-supervise rstudio: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise (child): fatal: unable to exec run: Permission denied
s6-supervise rstudio: warning: unable to spawn ./run - waiting 10 seconds

#11

Well, the good news is that I found someone else who’s run into this. The issue has a long history; it used to fail this way on Docker and there were some workarounds, but everything works on Docker now, so the issue’s been closed. See https://github.com/rocker-org/rocker/issues/202#issuecomment-460548778.

So it comes down to whether podman is supposed to run any image that the current Docker (Docker version 18.09.1-ce, build 4c52b901c6) can run. Should I open an issue on libpod?


#12

I think Fedora workstation has podman already installed, if not dnf can install it. Containers are similar to but less resource intensive than virtual machines. Podman, unlike Docker, runs containers without a daemon. I would suggest, if you are interested in using this method to go to this project https://github.com/rocker-org/rocker and see if the readme has some of the answers you seek.

If I use update-alternatives as the article states sudo update-alternatives --config libblas.so.3gf only displays the next line prompt, in other words nothing. If I use the command with/without sudo and --display instead of --config, it displays nothing, which it should since I don’t have that library installed. So in your case, if you were to do the same command in a terminal as the article states, after following the installation instructions beforehand from the article, what does the command reply with?


#13

Hello, I think you should check into this container stuff, personally. I just cloned the repo I linked in above and was able to get a container with basic r up and running in minutes with this command git clone https://github.com/rocker-org/rocker.git in a terminal opened in a directory of my choice to clone the container project at rocker. This will place several container options in your freshly made clone directory of rocker. The README.md file states to run the commands with Docker, using this command docker run --rm -ti rocker/r-base, I replace docker with podman and run this in the rocker directory in a terminal podman run --rm -ti rocker/r-base and I start and enter a container immediately in an r interactive environment. If I want to use RStudio I use this command podman run --rm -ti rocker/rstudio and podman builds a container runs it and I cannot enter due to login credential errors.

I’m not sure of where you want to open the issue. I did try to get the rstudio container going with podman, unsuccessfully as you might guess. The issue seemed to be pointing to logging in but after I dug a bit further, this seems to be what the problem is in my particular case.
ran this to log into my rstudio container podman run -d -p 8787:8787 rocker/rstudio and this was the result … port bindings are not yet supported by rootless containers.


#14

It fails for me on both root and non-root containers and on both Silverblue and Arch. I didn’t check the libpod version on Silverblue but it’s 1.0 on Arch.

The good news is that there’s another supported RStudio image - https://hub.docker.com/r/opencpu/rstudio/. And it works with root podman on Arch. I don’t have rootless containers working on Arch yet; I think I need to set up a configuration or something. And I think I got an error message on Silverblue saying rootless containers couldn’t forward ports. But root containers definitely work.


#15

Got it up and running with podman right now. Used this command sudo podman run -t -p 80:80 -p 8004:8004 opencpu/rstudio and the instructions for browsing to rstudio seem to work on Silverblue, I just browsed to this address http://localhost:8004/rstudio/ and there it is.
[Edit} Post run indicates there are issues since everything is giving me and error regarding the R session, specifically not being able to establish a connection to one. I think I would need to set up some environment variables to fix that.


#16

Hmmm … do you get the same errors with Docker?


#17

I don’t know. I could layer docker on my Silverblue I guess. It is for any command in Rstudio like create a new project, open a project, basically anything that could involve R I think causes the error dialog.
One other thing is that the r-base container I used earlier worked, giving a session which you could interact with. On this container, it looks like this when I go to enter help() at the prompt.
rsessionerr
This is the same message I see in the dialog window popping up when I try to do pretty much anything from within the container.


#18

It’s working here on Arch Linux - haven’t tried it on Silverblue yet. What version of podman do you have?

$ podman --version
podman version 1.0.0

#19

My podman is version 1.0.0 same as yours I guess.


#20

Hmmm … it’s working for me on Silverblue too. I think I’m going to make a podman branch in https://github.com/znmeb/data-science-pet-containers.git now that I know I can get RStudio via the opencpu/rstudio image.