Installing and using docker library tips?

docker
python

#1

I'm trying to use splashr in R, so I'm working on making a virtual environment "docker" with python, to ultimately use in R.

Anyone have tips? I'm going crazy trying to do this. Docker seems to be working, but the whole python part isn't. The tutorial I've been trying to follow is here:

https://cran.r-project.org/web/packages/docker/vignettes/Getting_Started_with_Docker.html

The part I keep getting stuck on is:

mkvirtualenv --python=/usr/bin/python3 docker in Command Prompt

I'd post a reprex if I could, but I don't really know what I could post here. Here's an error message I get when trying to install splashr

library(splashr)
#> Warning: package 'splashr' was built under R version 3.4.4
install_splash()
#> Error in py_call_impl(callable, dots$args, dots$keywords): ConnectionError: HTTPSConnectionPool(host='192.168.99.100', port=2376): Max retries exceeded with url: /v1.35/images/create?tag=3.0&fromImage=scrapinghub%2Fsplash (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000214BEBA8>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))
#> 
#> Detailed traceback: 
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\docker\api\image.py", line 396, in pull
#>     stream=stream, timeout=None
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\docker\utils\decorators.py", line 46, in inner
#>     return f(self, *args, **kwargs)
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\docker\api\client.py", line 190, in _post
#>     return self.post(url, **self._set_request_timeout(kwargs))
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\requests\sessions.py", line 555, in post
#>     return self.request('POST', url, data=data, json=json, **kwargs)
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\requests\sessions.py", line 508, in request
#>     resp = self.send(prep, **send_kwargs)
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\requests\sessions.py", line 618, in send
#>     r = adapter.send(request, **kwargs)
#>   File "C:\Users\eoppe\ANACON~1\lib\site-packages\requests\adapters.py", line 508, in send
#>     raise ConnectionError(e, request=request)

Created on 2018-04-04 by the reprex package (v0.2.0).


#3

Why do you want to use Python with R? Can you clarify what exactly you want to do? Are you planning to use the reticulate package?

A bit of clarification on this....Docker is meant to encapsulate everything for you, ie you shouldn't need to
install Python and R in two separate virtual environments in the same container even though you could do it.
A virtual environment within a Docker container is a bit convoluted, you should only need your container to house everything for the task at hand.

If splashr is built under 3.4.4, then you should be trying to build with R 3.4.4 in your dockerfile.
You could try to install python into your container like this:
https://tlfvincent.github.io//2016/04/30/data-science-with-docker/
You may need the reticulate package to set where the python kernel lives for R to pick it up.

Alternatively, I would just try to docker pull where the image resides on Docker Hub:
https://hub.docker.com/r/hrbrmstr/splashttpd/

and then simply run it with docker run, specifying what ports to run on and any additional configuration parameters.

If you would like more information on using Docker with R, I would check out the following:


#4

thanks for the response! I just tried to follow the tutorial that I linked, as I didn't see any other available ways of using the docker package. So I have no desire to do anything with Python here.

I'll take a closer look at what you sent tomorrow. Thanks again


#5

Can you post your Dockerfile? I think you may need to do the following in your dockerfile to pickup the Python kernel:

sudo groupadd docker
sudo usermod -aG docker $USER

Otherwise, if that does not work, you may want to file an issue on the package's Github.


#6

Apologies for my lack of knowledge, but what exactly is my Dockerfile, and how do I post it?

Thanks for bearing with me


#7

Actually, before you waste your time, I may have figured out how to install splashr. I'll let you know as soon as I know


#8

yeah...nevermind. I thought I got things working but I guess not