# PackageCompiler - "has no known versions!"

**URL:** <https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435>\
**Category:** General Usage\
**Created:** [February 4, 2019, 4:39pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435 "2019-02-04T16:39:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 4, 2019, 4:39pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/1 "2019-02-04T16:39:14Z")

</div>

I am having difficulties with compiling my own package.

I have my own package “Foo” functional and registered.

```julia
(v1.0) pkg> st
    Status `C:\Users\m136270\.julia\environments\v1.0\Project.toml`
  [537997a7] AbstractPlotting v0.9.4
...
  [dd5dd2d0] Foo v0.1.0 [`N:\My Documents\Programming\Julia\Modules\Foo`]
...

```

`using Foo` runs without problems.

However, `compile_package` fails with a strange error:

```julia
julia> compile_package("Foo")
[ Info: activating new environment at C:\Users\m136270\.julia\packages\PackageCompiler\SGFCk\packages\Reflectivity\Project.toml.
  Updating registry at `C:\Users\m136270\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: LoadError: Unsatisfiable requirements detected for package Reflectivity [dd5dd2d0]:
 Reflectivity [dd5dd2d0] log:
 ├─Reflectivity [dd5dd2d0] has no known versions!
 └─restricted to versions * by an explicit requirement - no versions left

```

So I understand, that the newly created environment somehow fails to find my package. Maybe I am missing something?

Thanks in advance for any hint!

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 5, 2019, 12:17pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/2 "2019-02-05T12:17:42Z")

</div>

I did find the root cause 🙂  
The point is that `snooping.jl` generates a file `run_julia_code.jl` with

```julia
using Pkg, PackageCompiler
Pkg.activate("C:\\Users\\m136270\\.julia\\dev\\PackageCompiler\\packages\\Foo\\Project.toml")
Pkg.instantiate()
# let's wrap the snoop file in a try catch...
# This way we still do some snooping even if there is an error in the tests!
try
    include("N:\\My Documents\\Programming\\Julia\\Modules\\Foo\\test\\runtests.jl")
catch e
    @warn("Snoop file errored. Precompile statements were recorded untill error!", exception = e)
end

```

`Pkg.instantiate` fails because “Foo” is not known to the new environment.  
My current workaround is to add

```julia
Pkg.develop(PackageSpec(path=$(repr(normpath(snoopfile * "\\..\\..")))))

```

before `Pkg.instantiate()` which works for the case that the snoopfile is located in the default test directory, e.g. `runtests.jl`

If I find a more elegant solution, I will leave a message here.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 5, 2019, 12:44pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/3 "2019-02-05T12:44:40Z")

</div>

I think I just figured out the problem… I’m drafting a solution right now!

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 5, 2019, 1:01pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/4 "2019-02-05T13:01:03Z")

</div>

Great! 👍

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 5, 2019, 1:31pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/5 "2019-02-05T13:31:28Z")

</div>

Ok, this PR solves one problem: [https://github.com/JuliaLang/PackageCompiler.jl/pull/179](https://github.com/JuliaLang/PackageCompiler.jl/pull/179)  
I’m writing some tests right now, to verify that it also solves your problem.  
Let me know if it already works for you 🙂  
Btw, I suggest using `compile_incremental(:Foo)`!

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 5, 2019, 2:44pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/6 "2019-02-05T14:44:26Z")

</div>

Hi Simon,  
thanks for your quick reply. Unfortunately, this PR doesn’t fix my problem, because `Pkg.instantiate()` still doesn’t know my local package.  
I also realised earlier that `compile_package` or `compile_incremental` are not aware of my normal environment, e.g. the standard ImageMagick.jl is taken instead of master, although in my standard environment I have done `add ImageMagick#master`. Maybe, both things have the same origin?  
Unfortunately, I am not enough low-level Julian to come up with a general solution.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 5, 2019, 2:46pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/7 "2019-02-05T14:46:05Z")

</div>

Yeah sorry, it still wasn’t not solved 😉 But I think I got it now! I’ll push when local tests pass!

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 5, 2019, 2:51pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/8 "2019-02-05T14:51:14Z")

</div>

pushed the fix to the same branch!

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 5, 2019, 3:08pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/9 "2019-02-05T15:08:50Z")

</div>

Works like a charm … and it solves the problem that a package working with your local setup can be compiled!  
You are my hero 😉

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 7, 2019, 4:03pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/10 "2019-02-07T16:03:16Z")

</div>

Btw, today I tried to get compile\_incremental(:Makie) running.  
The process succeeds and writes a sys.dll, I can successfully call julia -Jsys.dll, and do a very quick `using Makie` 🙂  
Alas, `scene=Scene()` answers on the console and doesn’t open up a Makie window.

Any proposal?

P.S.: I added some lines to `snooping.jl` iin order to maintain the same versions of the packages:

```julia
command *= """
  empty!(Base.LOAD_PATH)
  # Take LOAD_PATH from parent process
  append!(Base.LOAD_PATH, $(repr(Base.LOAD_PATH)))
  sourceManifest = joinpath(dirname($(repr(Base.active_project()))), "Manifest.toml")
  Pkg.activate($(repr(tomlpath))) 
  targetManifest = joinpath(dirname(Base.active_project()), "Manifest.toml")
                         
  Pkg.instantiate()
  cp(sourceManifest, targetManifest; force = true)
  Pkg.resolve()
"""
@info command

```

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 7, 2019, 8:30pm UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/11 "2019-02-07T20:30:09Z")

</div>

Try `AbstractPlotting. __init__ ()`

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 8, 2019, 7:10am UTC](https://discourse.julialang.org/t/packagecompiler-has-no-known-versions/20435/12 "2019-02-08T07:10:54Z")

</div>

😀
