# My Julia function never runs

**URL:** <https://discourse.julialang.org/t/my-julia-function-never-runs/52248>\
**Category:** General Usage\
**Created:** [December 22, 2020, 11:15pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248 "2020-12-22T23:15:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stla/32/20382_2.png) [@stla](https://discourse.julialang.org/u/stla)\
**Post date:** [December 22, 2020, 11:15pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/1 "2020-12-22T23:15:48Z")

</div>

Hello,

I’m currently working on [this package](https://github.com/stla/GFIlogisticRegression.jl/blob/main/src/GFIlogisticRegression.jl).

When I try to run the main function nothing happens.

```julia
julia> y=[0,0,1,1,1]
julia> X = [1 -2; 1 -1; 1 0; 1 1; 1 2]
julia> fidSampleLR(y, X, 5)

```

There’s a `println` at the first line of this function and nothing is printed. Looks like Julia takes an infinite time to compile the function. What’s the problem please?

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [December 22, 2020, 11:38pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/2 "2020-12-22T23:38:02Z")

</div>

Some things come at mind:

1. How much time have you waited? Some seconds or did you let the function run for minutes/hours and nothing happened?
2. Did you try to create a function with just the X first lines, and then incrementally add lines until the problem happens?
3. Are you sure you are running the right version of the code? How do you have the package installed? Do you have it `dev`ed? Add a `println` a change to another function that works (some other function works, right?) and see if the print happens.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [December 22, 2020, 11:41pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/3 "2020-12-22T23:41:17Z")

</div>

Is it stuck in the while loop?

---

<div class="post-metadata">

**Author:** ![stla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stla/32/20382_2.png) [@stla](https://discourse.julialang.org/u/stla)\
**Post date:** [December 22, 2020, 11:43pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/4 "2020-12-22T23:43:23Z")

</div>

I waited more than 20 minutes.

When I remove the CDDLib stuff, it works.

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [December 22, 2020, 11:50pm UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/5 "2020-12-22T23:50:24Z")

</div>

Use Debugger.jl. I installed from your github repo and found that it hangs here (I had to copy/paste an image rather than the REPL text because it froze 😬):

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/8/38bddeb07f0f7304bf73af95832d2ec335f1dff7.png)

---

<div class="post-metadata">

**Author:** ![stla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stla/32/20382_2.png) [@stla](https://discourse.julialang.org/u/stla)\
**Post date:** [December 23, 2020, 12:47am UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/6 "2020-12-23T00:47:16Z")

</div>

Thanks! This debugger looks great, I never tried it.

Will ask to the package maintainer.

---

<div class="post-metadata">

**Author:** ![stla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stla/32/20382_2.png) [@stla](https://discourse.julialang.org/u/stla)\
**Post date:** [December 23, 2020, 2:03am UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/7 "2020-12-23T02:03:00Z")

</div>

This seems to work by replacing `import CDDLib` with `using CDDLib`.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [December 23, 2020, 2:21am UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248/8 "2020-12-23T02:21:51Z")

</div>

This is considerably strange. Just changing `import CDDLib` to `using CDDLib` solves the problem without you changing anything else? Because if your code works with `using CDDLib` it should either work with `import CDDLib` or gives an error saying some functions does no exist (because they were not imported to the current scope). Even if the package is doing type piracy the code should either work on both cases, or error soon in the `import` case.
