Groups 153 of 99+ julia-users › Deprecation of require 13 posts by 6 authors Eduardo Lenz 7 23 15 Hi I just downloaded the last nightly build and I am receiving a new deprecation message: Warning, require is deprecated, use using or import instead. My question is: I am using require due to the need to automatically import these functions for all workers in a cluster. As long as I know, to accomplish this task I have to use require and also provide the correct path of the corresponding -jl files. How can I do this same thing using using or import ? I tried to use it as I was using require and it is not working as expected. Thanks for your help and sorry for the dumb question. Tim Holy 7 31 15 If MyModule-jl is on your LOAD_PATH, everywhere import MyModule should work. You can add push! LOAD_PATH, my code repository to your .juliarc-jl file. This has been deprecated because of precompilation; it was felt that the string version left it too ambiguous about whether you wanted to load the raw file or the cached version. Best, --Tim Eduardo Lenz 7 31 15 Other recipients: tim.... gmail.com Thanks for your help Tim ! Christopher Fisher 9 17 15 I am using .4.0-rc1 and have encountered a similar situation and have fairly basic questions about the way .4 loads files. I normally use require to load a file of functions from my working directory in to Julia on a local computer or a cluster of computers. I was hoping someone would be willing to answer a few related questions. First, where can I find the .juliarc-jl file? Second, is there an easier way to load a -jl file from my working directory into Julia onto a local computer or cluster of computers that does not require editing the .juliarc.fil file? Editing this file for every project seems a little inconvenient . Third, will the code loaded from a -jl always be precompiled in .4? If not, how do I choose whether it is precompiled or not? Thanks in advance and my apologies for the basic questions;I'm not a programmer per se Chris Michele Zaffalon 9 17 15 I answer your first question only: First, where can I find the .juliarc-jl file? It's in the HOME directory. Alternatively in Windows in the directory pointed to by HOMEDRIVE\HOMEPATH Christopher Fisher 9 17 15 Thanks Michele. I found the file and I think I figured out part of the issue. If I understand correctly, I can use push! LOAD_PATH, my code repository within my script instead of hard coding it into the .juliarc-jl file, which would only be useful if I want to search that directory every start up. Is that true? Steven G. Johnson 9 22 15 On Friday, July 31, 2015 at 7:30:44 AM UTC-4, Tim Holy wrote: If MyModule-jl is on your LOAD_PATH, everywhere import MyModule Actually, the right thing is just: import MyModule That will import it on all workers everywhere is redundant , and is actually better than everywhere because if the module needs to be re-precompiled then it will be compiled only once. David Smith 10 16 15 I'm also wondering how to replace 'require' without modifying the LOAD_PATH. I can't expect my users to know how to make any path changes. 'using' and 'import' doesn't work for my parallel processes even though I'm loading a registered package DCEMRI . I get this error. WARNING: Module DCEMRI not defined on process 2 fatal error on 2: ERROR: UndefVarError: DCEMRI not defined I have just a small bit of code in a separate file in the DCEMRI package directory that I need each worker to load. What is the preferred way to enable this in 0.4? Christopher Fisher 10 16 15 Hi David- I've been having similar difficulties. I do not know how to avoid modifying LOAD_PATH, but last code I attached provides a working example: https: groups.google.com forum !searchin julia-users christopher$20fisher 7Csort:date julia-users jgT47LBBtWk Caje1PhiAwAJ My best guess is that you are not doing this after initializing the procs: using MyModule everywhere using MyModule It seems odd to call using twice but it seems to work. Nonetheless, I also would be interested in alternative methods that do not require modifying LOAD_PATH. David Smith 10 16 15 Thanks for your reply, but that doesn't work for me. All of my code is run from functions, and when I try 'using' inside a function, I get this: ERROR: error compiling fitdata: error compiling fitdata: unsupported or misplaced expression using in function fitdata in demo at home dss .julia v0.4 DCEMRI src demo-jl:7 in demo at home dss .julia v0.4 DCEMRI src demo-jl:2 Tim Holy 10 16 15 On Friday, October 16, 2015 01:07:49 PM David Smith wrote: I'm also wondering how to replace 'require' without modifying the LOAD_PATH. I can't expect my users to know how to make any path changes. You can do this: thisdir splitdir __FILE__ 1 if !any LOAD_PATH . thisdir push! LOAD_PATH, thisdir end Whatever file has this code snippet in it will cause its enclosing folder to be added to the LOAD_PATH. You may also be running up against https: github.com JuliaLang julia issues 9245. Better but more awkward than everywhere using DCEMRI would be for p in workers remotecall_fetch p, eval, : using DCEMRI end On julia 0.3, that has to be remotecall_fetch p, eval, Expr :using, :DCEMRI --Tim David Smith 10 16 15 Thanks, Tim. I feel like I'm getting closer, but I tried either and both of those and nothing worked. In every case I get this: WARNING: Module DCEMRI not defined on process 2 fatal error on 2: ERROR: UndefVarError: DCEMRI not defined in deserialize at serialize-jl:500 in handle_deserialize at serialize-jl:461 in deserialize at serialize-jl:519 in handle_deserialize at serialize-jl:461 in deserialize at serialize-jl:694 in deserialize_datatype at serialize-jl:647 in handle_deserialize at serialize-jl:461 in message_handler_loop at multi-jl:847 in process_tcp_streams at multi-jl:836 in anonymous at task-jl:63 Worker 2 terminated. It doesn't seem to be quite the same problem as 9245, but rather the entire module is not able to be found. Tim Holy 10 17 15 Hard to say without a more complete example of what you're trying to do. Another candidate for your troubles is https: github.com JuliaLang julia issues 3674 --Tim