iocaml icon indicating copy to clipboard operation
iocaml copied to clipboard

Cannot find file "topfind"

Open cprieto opened this issue 8 years ago • 2 comments

I am learning OCaml right now and using a Python notebook for that is awesome, thanks iocaml exists!, so if I am doing something stupid please tell me...

Installed a new ocaml/opam installation, created a new switch for iocaml:

opam switch -A 4.03.0 iocaml
eval `opam config env`
opam install iocaml
opam install core

To make sure everything is ok, I created a new virtualenv for Python and installed the supported IPython:

mkvirtualenv iocaml && pip install 'ipython[all]==1.1.0'

Followed the instructions at the wiki and tried the new kernel:

ipython notebook --profile=iocaml

It runs, it highlights, it evaluates my expressions, nice. Now, it doesn't load/require/use core or anything, so #use "topfind" results in 'File not found' error, so #require "core" is not going to work because #require is not recognised and open Core.Std is unbound...

Yes, I created an ~/.iocamlinit file as suggested by #14 and it looks pretty much like this:

(* Added by OPAM. *)
let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
    with Not_found -> ()
    ;;
#use "topfind";;
#thread;;
#camlp4o;;

and no, it is not working.

What am I doing wrong?

cprieto avatar Apr 25 '17 12:04 cprieto

You shouldn't need to use ipython

iocaml notebook.ipynb

If you really want to use ipython, does adding


let () = Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")```;;

into a cell in the notebook make topfind work?

On Tue, Apr 25, 2017 at 1:58 PM, Cristian Prieto [email protected] wrote:

I am learning OCaml right now and using a Python notebook for that is awesome, thanks iocaml exists!, so if I am doing something stupid please tell me...

Installed a new ocaml/opam installation, created a new switch for iocaml:

opam switch -A 4.03.0 iocaml eval opam config env opam install iocaml opam install core

To make sure everything is ok, I created a new virtualenv for Python and installed the supported IPython:

mkvirtualenv iocaml && pip install 'ipython[all]==1.1.0'

Followed the instructions at the wiki https://github.com/andrewray/iocaml/wiki/ipython_install and tried the new kernel:

ipython notebook --profile=iocaml

It runs, it highlights, it evaluates my expressions, nice. Now, it doesn't load/require/use core or anything, so #use "topfind" results in 'File not found' error, so #require "core" is not going to work because #require is not recognised and open Core.Std is unbound...

Yes, I created an ~/.iocamlinit file as suggested by #14 https://github.com/andrewray/iocaml/issues/14 and it looks pretty much like this:

(* Added by OPAM. *) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; #use "topfind";; #thread;; #camlp4o;;

and no, it is not working.

What am I doing wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andrewray/iocaml/issues/61, or mute the thread https://github.com/notifications/unsubscribe-auth/AFqzI_4uA0zcc1Wl8mgBbNkMs024CDUwks5rze3tgaJpZM4NHcck .

andrewray avatar Apr 25 '17 14:04 andrewray

iocaml notebook worked like a charm, though let () = Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") doesn't because for some reason they cannot see the environment variable (and I actually tried setting it up manually, but no luck).

I was following the instructions in the wiki, do you still need to install IPython then?

I will need to update the instructions in the Wiki, I was following them line by line 😞

cprieto avatar Apr 25 '17 23:04 cprieto