ellisk42 / ec

MIT License
482 stars 138 forks source link

MacOS Installation #67

Closed Sharad24 closed 3 years ago

Sharad24 commented 3 years ago

Hi,

Thanks for making the code open source! Awesome project!

I'm trying to configure the project on macOS for research purposes. From what I understand, this would require building the OCaml binaries again. Please correct me if I'm wrong and there is a way to run the python files without building the libraries.

I face an issue after following the instructions mentioned in the "Building OCaml libraries" section. After the setup instructions of opam, when I run make I'm running into the following error:

File "logoLib/VGWrapper.ml", line 99, characters 62-63:
Error: The function applied to this argument has type
         w:int -> h:int -> Cairo.Surface.t
This argument cannot be applied without label
      ocamlc geomLib/.geomLib.objs/geomLib__Renderer.{cmi,cmo,cmt} (exit 2)

This seems like a technical bug in OCaml and I'm unable to figure out the reason for the same. Here is the output of the complete command:

rm -f data/geom/logoDrawString
cd solvers && \
      jbuilder build solver.exe && \
      jbuilder build versionDemo.exe && \
      jbuilder build helmholtz.exe && \
      jbuilder build logoDrawString.exe && \
      jbuilder build protonet-tester.exe && \
      jbuilder build compression.exe && \
      cp _build/default/compression.exe ../compression && \
      cp _build/default/versionDemo.exe ../versionDemo && \
      cp _build/default/solver.exe ../solver && \
      cp _build/default/helmholtz.exe ../helmholtz && \
      cp _build/default/protonet-tester.exe ../protonet-tester && \
      cp _build/default/logoDrawString.exe \
        ../logoDrawString && \
      ln -s ../../logoDrawString \
        ../data/geom/logoDrawString
      ocamlc logoLib/.logoLib.objs/logoLib__VGWrapper.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /Users/sharadchitlangia/.opam/4.06.1+flambda/bin/ocamlc.opt -w -40 -g -bin-annot -I logoLib/.logoLib.objs -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/cairo2 -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/gg -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/vg -no-alias-deps -open LogoLib -o logoLib/.logoLib.objs/logoLib__VGWrapper.cmo -c -impl logoLib/VGWrapper.ml)
File "logoLib/VGWrapper.ml", line 23, characters 13-15:
Warning 3: deprecated: Vg.>>
Use |> instead.
File "logoLib/VGWrapper.ml", line 26, characters 37-39:
Warning 3: deprecated: Vg.>>
Use |> instead.
File "logoLib/VGWrapper.ml", line 26, characters 12-14:
Warning 3: deprecated: Vg.>>
Use |> instead.
File "logoLib/VGWrapper.ml", line 28, characters 37-39:
Warning 3: deprecated: Vg.>>
Use |> instead.
File "logoLib/VGWrapper.ml", line 28, characters 12-14:
Warning 3: deprecated: Vg.>>
Use |> instead.
File "logoLib/VGWrapper.ml", line 99, characters 62-63:
Error: The function applied to this argument has type
         w:int -> h:int -> Cairo.Surface.t
This argument cannot be applied without label
      ocamlc geomLib/.geomLib.objs/geomLib__Renderer.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /Users/sharadchitlangia/.opam/4.06.1+flambda/bin/ocamlc.opt -w -40 -g -bin-annot -I geomLib/.geomLib.objs -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/cairo2 -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/gg -I /Users/sharadchitlangia/.opam/4.06.1+flambda/lib/vg -no-alias-deps -open GeomLib -o geomLib/.geomLib.objs/geomLib__Renderer.cmo -c -impl geomLib/Renderer.ml)
File "geomLib/Renderer.ml", line 30, characters 64-65:
Error: The function applied to this argument has type
         w:int -> h:int -> Cairo.Surface.t
This argument cannot be applied without label
make: *** [all] Error 1

Thanks!

@ellisk42 @mathias-sm

jabo17 commented 3 years ago

Hey @Sharad24, (how) did you solve it? I tried the installation on a Google Colab instance and came up with the same error message.

Sharad24 commented 3 years ago

This was fixed for me with the changes in the OCaml files in 2efa6b745ff99e747830c48314fb896bfeb19a7c

madhavk98 commented 3 years ago

Hey @Sharad24, I'm also installing on a Mac system but upon running python3 bin/text.py -t 20 -RS 5000D, I get the following. I built the Ocaml libraries, installed the requirements.txt and the extra packages listed for MacOS. Is this due to not having a CUDA compatible GPU or something else? Any help would be greatly appreciated, thanks!

Failure to load pregex. This is only acceptable if using pypy
Failure to load pregex. This is only acceptable if using pypy
CUDA is available?: False
using cuda?: False
Generated 128 tasks
Split tasks into 0/128 test/train
Got 108 challenge PBE tasks
Including map as a primitive? True
Including length as a primitive? True
Including unfold as a primitive? True
Running EC on Madhavs-MacBook-Pro.local @ 2021-07-14 13:09:37.273691 with 8 CPUs and parameters:
     noConsolidation  =  False
     biasOptimal  =  False
     contextual  =  False
     iterations  =  10
     enumerationTimeout  =  20
     reuseRecognition  =  False
     ensembleSize  =  1
     recognitionTimeout  =  7200
     recognitionSteps  =  5000
     helmholtzRatio  =  0.5
     topk_use_only_likelihood  =  False
     pseudoCounts  =  30.0
     aic  =  1.0
     structurePenalty  =  10.0
     arity  =  3
     taskReranker  =  default
     storeTaskMetrics  =  True
     rewriteTaskMetrics  =  False
     maximumFrontier  =  5
     solver  =  ocaml
     topK  =  2
     evaluationTimeout  =  0.0005
     cuda  =  False

Currently using this much memory: 105230336
Currently using this much memory: 105234432
Using a waking task batch of size: 128
(python) Launching list(char) -> list(char) (104 tasks) w/ 4 CPUs. 0.000000 <= MDL < 1.500000. Timeout 20.000000.
(python) Launching list(char) -> list(char) -> list(char) (24 tasks) w/ 4 CPUs. 0.000000 <= MDL < 1.500000. Timeout 20.000000.
Failure to load pregex. This is only acceptable if using pypy
Failure to load pregex. This is only acceptable if using pypy
Failure to load pregex. This is only acceptable if using pypy
Failure to load pregex. This is only acceptable if using pypy
Process Process-2:
Process Process-1:
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/../dreamcoder/utilities.py", line 333, in _launchParallelProcess
    [f, a, k] = PARALLELPROCESSDATA
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/binTypeError: cannot unpack non-iterable NoneType object
/../dreamcoder/utilities.py", line 333, in _launchParallelProcess
    [f, a, k] = PARALLELPROCESSDATA
TypeError: cannot unpack non-iterable NoneType object

^CTraceback (most recent call last):
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/text.py", line 25, in <module>
    main(arguments)
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/../dreamcoder/domains/text/main.py", line 269, in main
    for result in generator:
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/../dreamcoder/dreamcoder.py", line 406, in ecIterator
    topDownFrontiers, times = wake_generative(grammar, wakingTaskBatch,
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/../dreamcoder/dreamcoder.py", line 552, in default_wake_generative
    topDownFrontiers, times = multicoreEnumeration(grammar, tasks,
  File "/Users/madhavkhirwar/Desktop/RESEARCH 2021/ec-master/bin/../dreamcoder/enumeration.py", line 181, in multicoreEnumeration
    message = Bunch(dill.loads(q.get()))
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/queues.py", line 103, in get
    res = self._recv_bytes()
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 221, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 419, in _recv_bytes
    buf = self._recv(4)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 384, in _recv
    chunk = read(handle, remaining)
KeyboardInterrupt 
Sharad24 commented 3 years ago

I dont think its due to anything CUDA related. cuda is set as False in your run, so seems like something else.

R1704 commented 2 years ago

@madhavk98 I'm having the same issue. Did you ever solve it?

R1704 commented 2 years ago

@madhavk98 I'm having the same issue. Did you ever solve it?

Apparently, downgrading python from 3.9 to 3.6 solved it.