Not able to log model or artifact to Mlflow - r

I have a MLFlow remote server and I am able to log things from rstudio like:
mlflow_log_param("param1", 5)
mlflow_log_param("param2", 5)
mlflow_log_metric("foo", 1)
mlflow_log_metric("foo", 2)
mlflow_log_metric("foo", 3)
But when I try to log things like:
writeLines("Hello world!", "output.txt")
mlflow_log_artifact("output.txt")
I have this error:
2020/04/01 21:45:27 INFO mlflow.store.artifact.cli: Logged artifact from local file output.txt to artifact_path=None
Root URI: ./mlruns/12/3256cfd3cd1b44b99334040bd5c7c9ee/artifacts
And when I try to log a model:
mlflow_log_model(predictor, "model1")
I have next error:
2020/04/01 21:56:44 INFO mlflow.store.artifact.cli: Logged artifact from local dir D:/user/AppData/Local/Temp/RtmpcBwDOP/model1 to artifact_path=model1
Root URI: ./mlruns/12/07d84e0f252a4248bb2473229297d318/artifacts
# A tibble: 0 x 0
Warning message:
In value[[3L]](cond) :
Logging model metadata to the tracking server has failed, possibly due to older server version. The model artifacts have been logged successfully. In addition to exporting model artifacts, MLflow clients 1.7.0 and above attempt to record model metadata to the tracking store. If logging to a mlflow server via REST, consider upgrading the server version to MLflow 1.7.0 or above.
The server is updated and also the client.

Related

Installing a package from private GitLab server on Windows

I am struggling with installing a package from a GitLab repository on a Windows computer.
I found different hints but still have problems to install my package from GitLab. First of all, I generated a public and private key with puttygen.exe. The files need to be changed afterwards, I had to remove comments and stuff so they look like my the file on my Unix system. So now, both public and private key files have just a single line.
I tried to install my package via devtools::install_git which takes very long and I get the error message
Error: Failed to install 'unknown package' from Git:
Error in 'git2r_remote_ls': Failed to authenticate SSH session: Unable to send userauth-publickey request
And with devtools::install_gitlab I get a different error message and I somehow have the feeling, the link which gets generated doesn't fit to my GitLab server.
Error: Failed to install 'unknown package' from GitLab:
cannot open URL 'https://gitlab.rlp.net/api/v4/projects/madejung%2FMQqueue.git/repository/files/DESCRIPTION/raw?ref=master'
My complete code to test at the moment is
creds <- git2r::cred_ssh_key(publickey="~/.ssh/id_rsa_gitlab.pub",
privatekey="~/.ssh/id_rsa_gitlab")
devtools::install_git(
url='git#gitlab.rlp.net:madejung/MQqueue.git',
quiet=FALSE,
credentials=creds)
devtools::install_gitlab(
repo='madejung/MQqueue.git',
host='gitlab.rlp.net',
quiet=FALSE,
credentials=creds
)
My id_rsa_gitlab.pub file looks like this and is just a single line:
ssh-rsa AAAA....fiwbw== rsa-key-20200121
The id_rsa_gitlab file has just the code:
AAABA.....3WNSIAGE=
Update
On my Mac system it works as expected after installing the libssh2 library via homebrew and and recompiling git2r with install.packages("git2r", type = "source").
So the working code on my machine is:
creds <- git2r::cred_ssh_key(publickey="~/.ssh/id_rsa_gitlab.rlp.net.pub",
privatekey="~/.ssh/id_rsa_gitlab.rlp.net")
devtools::install_git(
url='git#gitlab.rlp.net:madejung/MQqueue.git',
quiet=FALSE,
credentials=creds
)
For some strange reason, the devtools::install_git call needs about a minute to fail in the end. I have no idea where the problem here is.
After struggling for almost a day, I found a solution I can live with...
I first created a PAT (Personal Access Token) in my gitlab account and granted full API access. For some reason the read_only access didn't worked and I am now tired to figure out what the problem is.
After this I had still problems to install my package and for some reason, the wininet setting for downloading doesn't work.
I used the command capabilities("libcurl") to check if libcurl is available on my windows, which was and tried to overwrite wininet to libcurl by using method='libcurl' in the install function. Somehow, this was not enough so I overwrote the options variable download.file.method directly.
options("download.file.method"='libcurl')
devtools::install_gitlab(
repo='madejung/MQqueue',
auth_token='Ho...SOMETHING...xugzb',
host='gitlab.rlp.net',
quiet=FALSE, force=TRUE
)

R language. Private GitLab. Unable to send userauth-publickey request Error

I can successfully access gitlab project using Git Bash or via R-studio with my credentials.
But when I try to install project using devtools it returns error.
Here is my code
creds = git2r::cred_ssh_key(publickey = "C:\\Users\\user\\.ssh\\id_rsa.pub", privatekey = "C:\\Users\\user\\.ssh\\id_rsa")
devtools::install_git("git#gitlab.mycompany.com:my_project.git", credentials = creds)
Here is log:
Downloading git repo git#gitlab.mycompany.com:my_projects/my_project.git
Installation failed: Error in 'git2r_clone': Failed to authenticate SSH session: Unable to send userauth-publickey request
I use R-Studio, Windows 7.
Issue was fixed by recreation of key

H2O .savemodel on network path not working

We have h2o cluster on linux machine (ran through command line), and we are connecting it from our local machine (Windows) which is on the same network.
When we try to call saveModel we are getting errors.
ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://10.0.0.4:54321/99/Models.bin/)
//Code to load model from local machine,IDE- Rstudio
ModelName <- "GLM_model_R_1522217891094_1279"
modelpath <-file.path("file://dsvm-dev/Models",ModelName)
Model.h2o <- h2o.loadModel(modelpath)
//to save model
h2o.saveModel(object = best_model,path = "file://dsvm-dev/Models2/",force = TRUE)
Please suggest any alternate ways to save model to local machine(Windows) instead of on server. Also while saving it on server it saves to library folder, because we do not have access to machine.

proxy problems for install_keras with Anaconda and RStudio

I'm trying to install Keras by following the instructions here https://keras.rstudio.com/ when I'm using my office/work laptop.
When I get to this line install_keras() and it fails with this rather long error message shown here in its entirety:
Creating r-tensorflow conda environment for TensorFlow installation...
Fetching package metadata ...
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
<https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on
your way.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io',
port=443): Max retries exceeded with url: /pkgs/main/win-6
/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.',
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at
0x000001ACD38FB780>: Failed to establish a new connection: [Errno 11001]
getaddrinfo failed',)))",),)
Error: Error 1 occurred creating conda environment r-tensorflow
In addition: Warning message:
running command '"C:\PROGRA~3\ANACON~1\Scripts\conda.exe" "create" "--
yes" "--name" "r-tensorflow" "python=3.6"' had status 1
and it says something about Anaconda. So I dutifully install the entire Anaconda beast from this Anaconda distribution.
Now when I try install_keras() I get this new error message about a proxy:
Using r-tensorflow conda environment for TensorFlow installation
Determining latest release of TensorFlow...Error in
open.connection(con, "rb") :
Unsupported proxy 'https://proxy-server.mycompanyname.com:8080', libcurl
is built without the HTTPS-proxy support.
I reviewed Jeroen's libcurl suggestion which yields the following responses:
curl::ie_proxy_info()
$AutoDetect
[1] FALSE
$AutoConfigUrl
[1] "http://mcd-server/mcd/proxy.pac"
$Proxy
NULL
$ProxyBypass
NULL
and this
curl::ie_get_proxy_for_url()
[1] "proxy-server:8080"
So I seem to have a good connection to the internet through RStudio but not when using Anaconda's software.
I have verified that I have a good internet connection using this:
httr::BROWSE("https://www.ibm.com")
It appears that libcurl is built without HTTPS-proxy support, apparently.
Any suggestions?
SOLVED!
1) Step 1: allow Anaconda to access the internet by adding proxy info with a new file named .condarc exactly as detailed in this answer. You can verify this works ok by typing conda update conda into the Anaconda Prompt app.
2) Step 2: allow R and RStudio to access the internet by adding these 2 lines into the .Renviron file (in my case this was found in C:\Users\USERNAME\Documents for Windows 10):
http_proxy=http://proxy-server:8080
https_proxy=http://proxy-server:8080
You can now run this to install Keras:
library(keras)
install_keras()

install.keras() in RStudio fails with http connection error

I've been trying to install and run keras in RStudio (Windows) in vain.
i installed keras package using normal package "keras"
(didn't use github)
I've installed latest python (3.6) and Anaconda.
then i use
> library(keras)
> install.keras()
and i get this error:
Creating r-tensorflow conda environment for TensorFlow installation...
Fetching package metadata ... CondaHTTPError: HTTP 000 CONNECTION
FAILED for url
https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2
Elapsed: -
An HTTP error occurred when trying to retrieve this URL. HTTP errors
are often intermittent, and a simple retry will get you on your way.
ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io',
port=443): Max retries exceeded with url:
/pkgs/main/win-64/repodata.json.bz2 (Caused by
ConnectTimeoutError(, 'Connection to repo.continuum.io timed out.
(connect timeout=9.15)'))",),)
Error: Error 1 occurred creating conda environment r-tensorflow In
addition: Warning message: running command
'"C:\PROGRA~3\ANACON~1\Scripts\conda.exe" "create" "--yes" "--name"
"r-tensorflow" "python=3.6"' had status 1
I've looked up everywhere on the web and can't figure out how to install keras and tensorflow properly. Using latest version of R (3.4.2)
Every method fails somewhere.
just to add to misery, i've also tried:
> devtools::install_github("rstudio/keras")
and i get this error:
Installation failed: Timeout was reached: Connection timed out after
10015 milliseconds
I am not behind any authenticated proxies. So, after multiple failure, i just downloaded the zip file from github and manually installed it using the zip file.
i also tried install.packages("keras") and that didn't give me any error either.
when i call the library i don't get any errors (as shown above)
UPDATE: I was able to install and use the package very easily on another computer that doesn't have python/anaconda installed on it already.
UPDATE 2: my proxy does not need authentication and there is no https_proxy either.
OK,, FINALLY found a solution.
Turns out RStudio uses a lot of default proxy settings, so i needed to change all that and set up my own proxy settings.
First step:
Rstudio --> Tools --> Global Options --> packages --> uncheck both "Use secure download method for HTTP" and "Use Internet Explorer librayr/proxy for HTTP"
Second step, in RStudio type:
> file.edit('./.Renviron')
Either an empty file or some file with already existing proxy settings will open. (Mine was empty). Then I included the following two:
http_proxy=http://myusename:password#proxy.server.com:port/
https_proxy=http://myusename:password#proxy.server.com:port/
(a few notes: I didn't have a https_proxy setting but I still needed to use the http_proxy details for my https_proxy setting. This was one of the culprits for my issue. Also, I needed to include the username:password even though my proxy doesn't need secure authentication. Same thing goes with the port. Port number had to be included, otherwise it wouldn't work.
Step 3:
Saved the new changes in .Renviron file and restarted RStudio.
I checked my proxy settings in RStudio after restart by typing:
> Sys.getenv("http_proxy")
> Sys.getenv("https_proxy")
The first few times i did this i realised that the proxy settings were not being changed in RStudio because i was editing the wrong .Renviron file. So, it's best to use file.edit('~/.Renviron') in step 2 to make sure it's the right file.
After all this, when i ran install.keras(), it installed successfully, including installing Tensorflow. Again, initially i had skipped step 1 so keras started being installed but it failed at installing tensorflow.
It was only going through all the steps that i was able to install both keras and tensorflow successfully over a proxy. Hope this helps.
Uninstalling Anaconda3 and installing Anaconda2 (i.e. Python 2.7) did the trick for me: https://www.anaconda.com/download/

Resources