FluxML / Gym.jl

Gym environments in Julia
MIT License
54 stars 19 forks source link

Cannot precompile #12

Open gpgjoe opened 5 years ago

gpgjoe commented 5 years ago

This just happened. I ran ] add https://github.com/FluxML/Gym.jl as described on Readme, and then I ran using Gym, and I got this:

julia> using Gym
[ Info: Precompiling Gym [56b9baea-2481-11e9-37ae-75904354ad8c]
┌ Warning: Package Gym does not have Random in its dependencies:
│ - If you have Gym checked out for development and have
│   added Random as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Gym
└ Loading Random into Gym from project dependency, future warnings for Gym are suppressed.
WARNING: local variable N conflicts with a static parameter in Type at .julia/packages/Gym/sJrGC/src/Spaces/tuple-space.jl:13.
ERROR: LoadError: LoadError: LoadError: ArgumentError: Package Gym does not have DataStructures in its dependencies:
- If you have Gym checked out for development and have
  added DataStructures as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with Gym
Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:836
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1044
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at .julia/packages/Gym/sJrGC/src/Spaces/Space.jl:1
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1044
 [9] include at ./sysimg.jl:29 [inlined]
 [10] include(::String) at .julia/packages/Gym/sJrGC/src/Gym.jl:1
 [11] top-level scope at none:0
 [12] include at ./boot.jl:317 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1044
 [14] include(::Module, ::String) at ./sysimg.jl:29
 [15] top-level scope at none:2
 [16] eval at ./boot.jl:319 [inlined]
 [17] eval(::Expr) at ./client.jl:393
 [18] top-level scope at ./none:3
in expression starting at .julia/packages/Gym/sJrGC/src/Spaces/dict-space.jl:1
in expression starting at .julia/packages/Gym/sJrGC/src/Spaces/Space.jl:13
in expression starting at .julia/packages/Gym/sJrGC/src/Gym.jl:11
ERROR: Failed to precompile Gym [56b9baea-2481-11e9-37ae-75904354ad8c] to .julia/compiled/v1.0/Gym/Z6zPi.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

EDIT:

julia> versioninfo()
Julia Version 1.0.3
Commit 099e826241 (2018-12-18 01:34 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Pentium(R) 3558U @ 1.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

Let me know if more information would help you.

v-i-s-h commented 5 years ago

The problem is the line here: https://github.com/FluxML/Gym.jl/blob/master/src/Spaces/dict-space.jl#L1 uses DataStructures package, but Project.toml file is not updated to include this.

This can be solved by going to repl and do ] add DataStructures and then using Gym.

@tejank10 Maybe this issue should be renamed to reflect the missing dependencies.

Also, there is this warning which also needs to be taken care of

julia> using Gym
[ Info: Recompiling stale cache file /home/vish/.julia/compiled/v1.1/Gym/Z6zPi.ji for Gym [56b9baea-2481-11e9-37ae-75904354ad8c]
┌ Warning: Package Gym does not have Random in its dependencies:
│ - If you have Gym checked out for development and have
│   added Random as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Gym
└ Loading Random into Gym from project dependency, future warnings for Gym are suppressed.
kraftpunk97-zz commented 5 years ago

@v-i-s-h is it just a matter of dependencies? Updating Project.toml should solve this problem yes?

v-i-s-h commented 5 years ago

I think yes. Adding DataStructures and Random to Project.toml should solve this problem.

kraftpunk97-zz commented 5 years ago

@gpgjoe Pinging to verify if the problem has been solved.

gpgjoe commented 5 years ago

Hey!

Thanks for this.

I'm actually new with Julia. I see that you merged your edits here https://github.com/FluxML/Gym.jl/commit/5ad79762a44d8bbf9e177c1761a7b6af62a584ee. But is there an easy way for me to install this? I've tried ] add https://github.com/FluxML/Gym.jl#5ad79762a44d8bbf9e177c1761a7b6af62a584ee and it seems that Julia understands the command. Pkg says that the installed version is

[56b9baea] Gym v0.1.0 #5ad7976 (https://github.com/FluxML/Gym.jl)

However, when I run using Gym I still get the same error as before. I've tried restarting the REPL.

gpgjoe commented 5 years ago

My issue aside, there's a typo in there.

https://github.com/FluxML/Gym.jl/commit/5ad79762a44d8bbf9e177c1761a7b6af62a584ee

In any case, how is it that's working for you?

kraftpunk97-zz commented 5 years ago

@gpgjoe Ah, it's unfortunate that my band aid fix needs a band aid fix of its own; but #15 should get things working smoothly. I believe it is possible for Julia users to install various versions of the same package. Maybe give that a try?

gpgjoe commented 5 years ago

Installing from your fork worked.

I'm used to Python, and I'm already in love with Julia's package manager.

kraftpunk97-zz commented 5 years ago

@gpgjoe The required changes have been incorporated into the main repository. It'd be better for you to switch to it. Sorry for the unnecessary trouble🙇‍♂️.

gpgjoe commented 5 years ago

Now I get an error trying to run the example:

using Gym
env = CartPoleEnv()

gives me:

UndefVarError: isnothing not defined
Box(::Array{Float32,1}, ::Array{Float32,1}, ::DataType) at box.jl:39
CartPoleEnv() at CartPole.jl:48
top-level scope at none:0

https://github.com/FluxML/Gym.jl/blob/f68b6cb9bc1c4db113bd534fb790cd54337503cf/src/Spaces/box.jl#L39

Again, I don't understand how it's possible that I get this error but you can run it fine.

gpgjoe commented 5 years ago

I think most of the code doesn't really depend on the above. What is the proper way to edit a Julia package? With packages on the main registry I know I can do dev <package name> but as this package has been installed from a repo that doesn't really work (there's a different package named Gym).

gpgjoe commented 5 years ago

I've tried copying Gym to a separate folder and then restart Julia, run prepend!(LOAD_PATH, ["my_new_folder"]) and that didn't work.

gpgjoe commented 5 years ago

Right. Wrong version. I was using Julia 1.0.3. Moved to 1.1.0 and it's working now. isnothing didn't exist in 1.0.3.

anandijain commented 5 years ago

Is anyone getting a cant precompile for Cairo.jl?

Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
[ Info: Precompiling Gym [56b9baea-2481-11e9-37ae-75904354ad8c]
ERROR: LoadError: Cairo not properly installed. Please run
Pkg.build("Cairo")

Output of Pkg.build("Cairo") :

Building LibCURL  `C:\Users\Anand\.julia\packages\LibCURL\lWJxD\deps\build.log`     
Building WinRPM  `C:\Users\Anand\.julia\packages\WinRPM\Y9QdZ\deps\build.log`      
Building Homebrew → `C:\Users\Anand\.julia\packages\Homebrew\s09IX\deps\build.log`             
Building Cairo → `C:\Users\Anand\.julia\packages\Cairo\CXPG1\deps\build.log`       

New to Julia, not sure what's going on, Thanks!

===== update ===== After add Cairo and another Pkg.build("Cairo"), I can now call using Gym.

Any ideas why the initial install of Gym (from github), didn't get this?

kraftpunk97-zz commented 5 years ago

@anandijain can't really say that without knowing what cause Cairo's build process to fail the first time. If you have the complete stacktrace, that could be helpful. Although, Cairo.jl has been acting strangely as of late, even on macOS. It is being looked into.