saezlab / CARNIVAL

CAusal Reasoning for Network Identification with integer VALue programming in R
https://saezlab.github.io/CARNIVAL/
57 stars 29 forks source link

Writing cplex command file -> error thrown #64

Closed ulrmu closed 3 years ago

ulrmu commented 3 years ago

Oh hai! When running runCARNIVAL, the following error message is thrown:

Writing cplex command file Error in file(file, ifelse(append, "a", "w")) : cannot open the connection

And the warning:

2: In file(file, ifelse(append, "a", "w")) : cannot open file '/cplexCommand_t18_19_31d04_06_2021n19.txt': Permission denied

(In the working directory, both the .lp and .RData files are successfully created.)

Can anyone help to solve this issue? Cheers!

laylagerami commented 3 years ago

I am having the same problem. Works fine when using cbc solver, issue is only with cplex!

ivanovaos commented 3 years ago

Hey @ulrmu Can you share your platform and R version? Also, can you run it with toy example?

Thanks

laylagerami commented 3 years ago
Screenshot 2021-06-07 at 14 22 05

Potentially the issue is that the file is being written to the root directory (where the user may not have write permissions) rather than the current working directory. See how the .lp and .Rdata file names are appended with the cwd, but the .txt file name is not?

ivanovaos commented 3 years ago

Thanks for reporting, I will try to fix it ASAP. In the meantime, I suggest you to use the previous release. https://github.com/saezlab/CARNIVAL/releases/tag/v1.3

ulrmu commented 3 years ago

Hi @ivanovaos , Thanks for looking into this.

I can run the toy example without any problem.

In case it's still relevant, this is my R version and platform: R version 4.1.0 (2021-05-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.2 LTS

ulrmu commented 3 years ago

I tried v.1.3.0 but get the following error: Solving LP problem... sh: 1: /path/to/solver/: Permission denied

I also tried the latest update, but the same error as reported before is thrown.

ivanovaos commented 3 years ago

@ulrmu which solver do you use and what path did you provide for it? can you please post a code snippet?

CosimoCristella commented 3 years ago

Hi, I was experiencing the same issue in v.2.2.0 ( v.1.3.0 works fine) and manged to solve by specifying the full path for cplex solver and working/out directories, eg.: cplexOpt = defaultCplexCarnivalOptions() cplexOpt$solverPath = "/opt/ibm/ILOG/CPLEX_Studio1210/cplex/bin/x86-64_linux/cplex" cplexOpt$outputFolder = '/path/to/outDir/' cplexOpt$dirName = '/path/to/outDir/' cplexOpt$workdir = '/path/to/workDir/' However, I'm still having the issue described in #65

Hope it helps.

sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.2 LTS

ulrmu commented 3 years ago

@ivanovaos I use the cplex solver with this command: carnival_result = runCARNIVAL( #inputObj= iniciators, measObj = tfList$t, netObj = sif,

weightObj = progenylist$score,

                           solverPath = "/path/to/solver/", 
                           solver = "cplex",
                           timelimit=7200,
                           mipGAP=0,
                           poolrelGAP=0,
                           )

Please let me know if this is canonical or not.

@CosimoCristella Thank you for your suggestion! Maybe it's obvious, but how should the cplex options be passed?

CosimoCristella commented 3 years ago

@ulrmu Sorry, I forgot to mention that the options were passed to runInverseCarnival: runInverseCarnival(measurements = meas, priorKnowledgeNetwork = sif, weights = weights, carnivalOptions = cplexOpt )

Cheers!

ulrmu commented 3 years ago

@CosimoCristella Thank you! I get a weird error from the measurements input which I need to investigate further. Did you manage to use the runCARNIVAL function?

CosimoCristella commented 3 years ago

I think you get the input error when you try to pass a data.frame (as it was in v.1.3.0) rather than a named vector for arguments 'measurements' and 'weights'. I don't think this workaround will work for runCARNIVAL as there's no argument in the function to specify the working directory.

ulrmu commented 3 years ago

@CosimoCristella , that explains it, thank you!! I could finally run runInverseCarnival, running into the following error:

cplexOpt = defaultCplexCarnivalOptions() cplexOpt$solverPath = "/path/to/solver/" cplexOpt$outputFolder = '/path/to/dir/' cplexOpt$dirName = '/path/to/dir/' cplexOpt$workdir = '/path/to/dir/'

runInverseCarnival(measurements = meas_vec, priorKnowledgeNetwork = sif,

weights = weights,

               carnivalOptions = cplexOpt

)

sh: 1: /path/to/solver/: Permission denied Saving results... Error in file(file, "rt") : cannot open the connection

You said you managed to get the above function to work using CARNIVAL_2.2.0, right? Did you encounter this problem as well?

CosimoCristella commented 3 years ago

Hi Ulrmu,

I just re-tested runInverseCarnival() with the workaround I suggested above and can confirm it works for CARNIVAL v2.2.0 on my machine. Are providing the full/correct path for the solver? Just follow the example I suggested above since the cplex solver should be located in your opt folder. Be sure to include the solver name 'cplex' and remove the '/' at the end of the path.

ulrmu commented 3 years ago

@CosimoCristella Thank you, I fixed that and could run runInverseCarnival() \o/

However, using the newest CARNIVAL version, the problems with runCARNIVAL remain.

CosimoCristella commented 3 years ago

@ulrmu Glad it helped! I think this new version still requires few adjustments and we should give devs some time to implement them. In the meantime, if you have targets/inputs, why not going for runVanillaCarnival()?

ulrmu commented 3 years ago

@CosimoCristella Good point, thanks!

laylagerami commented 3 years ago

HI @CosimoCristella, did you manage to solve the issue in #65?

CosimoCristella commented 3 years ago

Hi @laylagerami, unfortunately not. Honestly, I haven't looked into details at it. I'm waiting for devs to react and in the meantime using v1.3, as they suggested

kelsi-kw commented 3 years ago

Also having the same issue. Error in file(file, ifelse(append, "a", "w")) : cannot open the connection. In file(file, ifelse(append, "a", "w")) : cannot open file '/cplexCommand_t18_00_47d12_07_2021n26.txt': Read-only file system. Tried changing the permissions on the files and directories and still come up with the same error. I tried using CBC solver, but get no results from Carnival when using the transcript tutorial data (All the same code, just tried to use CBC).

ivanovaos commented 3 years ago

Thanks all for commenting and reporting. The bug was fixed. If it is still persistent in your setup, please, share the code snippet with tiny data sample to reproduce. Thanks!

ulrmu commented 3 years ago

Thank you, @ivanovaos, for fixing the bug! It now works in my setup!

ErickMUO commented 2 years ago

Hi everyone, I got the same error in the 2.4.0 version.

R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.7