Code Monkey home page Code Monkey logo

jupyternim's Issues

build failed on Windows 10

I tried the instructions for installing by cloning the repo (after nimba install jupyternim failed with a similar error).

I'm not sure what to do with this error.

(base) PS C:\git> git clone https://github.com/stisa/jupyternim
Cloning into 'jupyternim'...
remote: Enumerating objects: 77, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 1199 (delta 36), reused 64 (delta 27), pack-reused 1122
Receiving objects: 100% (1199/1199), 976.88 KiB | 5.01 MiB/s, done.
Resolving deltas: 100% (628/628), done.

(base) PS C:\git> cd .\jupyternim\

(base) PS C:\git\jupyternim> nimble.exe install
  Verifying dependencies for jupyternim@0.5.8
      Info: Dependency on zmq@>= 0.3.1 already satisfied
  Verifying dependencies for zmq@0.3.1
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for hmac@0.1.9
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for nimSHA2@0.1.1
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for sha1@1.1
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for nimSHA2@0.1.1
      Info: Dependency on nimPNG@any version already satisfied
  Verifying dependencies for nimPNG@0.3.1
 Installing jupyternim@0.5.8
   Building jupyternim/jupyternim.exe using c backend
       Tip: 14 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: jupyternim
        ... Details:
        ... Execution failed with exit code 1
        ... Command: "C:\programs\nim-1.2.6\bin\nim.exe" c --noNimblePath -d:NimblePkgVersion=0.5.8 -d:release --path:"C:\Users\pexat\.nimble\pkgs\zmq-0.3.1"  --path:"C:\Users\pexat\.nimble\pkgs\hmac-0.1.9"  --path:"C:\Users\pexat\.nimble\pkgs\nimSHA2-0.1.1"  --path:"C:\Users\pexat\.nimble\pkgs\sha1-1.1"  --path:"C:\Users\pexat\.nimble\pkgs\nimSHA2-0.1.1"  --path:"C:\Users\pexat\.nimble\pkgs\nimPNG-0.3.1"  -o:"C:\git\jupyternim\jupyternim.exe" "C:\git\jupyternim\src\jupyternim.nim"
        ... Output: Hint: used config file 'C:\programs\nim-1.2.6\config\nim.cfg' [Conf]
        ... Hint: system [Processing]
        ... Hint: widestrs [Processing]
        ... Hint: io [Processing]
        ... Hint: jupyternim [Processing]
        ... Hint: sockets [Processing]
        ... Hint: zmq [Processing]
        ... Hint: json [Processing]
        ... Hint: hashes [Processing]
        ... Hint: tables [Processing]
        ... Hint: math [Processing]
        ... Hint: bitops [Processing]
        ... Hint: macros [Processing]
        ... Hint: algorithm [Processing]
        ... Hint: strutils [Processing]
        ... Hint: parseutils [Processing]
        ... Hint: unicode [Processing]
        ... Hint: lexbase [Processing]
        ... Hint: streams [Processing]
        ... Hint: parsejson [Processing]
        ... Hint: options [Processing]
        ... Hint: typetraits [Processing]
        ... Hint: os [Processing]
        ... Hint: pathnorm [Processing]
        ... Hint: osseps [Processing]
        ... Hint: winlean [Processing]
        ... Hint: dynlib [Processing]
        ... Hint: times [Processing]
        ... Hint: time_t [Processing]
        ... Hint: osproc [Processing]
        ... Hint: strtabs [Processing]
        ... Hint: cpuinfo [Processing]
        ... Hint: base64 [Processing]
        ... Hint: messages [Processing]
        ... Hint: hmac [Processing]
        ... Hint: md5 [Processing]
        ... Hint: sha1 [Processing]
        ... Hint: nimSHA2 [Processing]
        ... Hint: endians [Processing]
        ... Hint: utils [Processing]
        ... Hint: random [Processing]
        ... Hint: display [Processing]
        ... Hint: mimetypes [Processing]
        ... Hint: nimPNG [Processing]
        ... Hint: buffer [Processing]
        ... Hint: sequtils [Processing]
        ... Hint: nimz [Processing]
        ... Hint: filters [Processing]
        ... Hint: results [Processing]
        ... C:\git\jupyternim\src\jupyternimpkg\sockets.nim(136, 24) Warning: Number of spaces around '/' is not consistent [Spacing]
        ... C:\git\jupyternim\src\jupyternimpkg\sockets.nim(113, 6) Hint: 'startCodeServer' is declared but not used [XDeclaredButNotUsed]
        ... C:\git\jupyternim\src\jupyternimpkg\sockets.nim(393, 6) Hint: 'parseNimsuggest' is declared but not used [XDeclaredButNotUsed]
        ... C:\git\jupyternim\src\jupyternimpkg\sockets.nim(184, 7) Hint: 'MagicsStrings' is declared but not used [XDeclaredButNotUsed]
        ... C:\git\jupyternim\src\jupyternimpkg\sockets.nim(73, 7) Hint: 'codeserver' is declared but not used [XDeclaredButNotUsed]
        ... C:\git\jupyternim\src\jupyternim.nim(2, 21) Error: cannot open file: std/exitprocs

I did download the zeromq files (https://zeromq.org/download/) and put them on my PATH as in the instructions.

Need to update for Nim 0.20

When I tried to build this with nim 0.20, I faced into the following error.

# nim --version
Nim Compiler Version 0.20.0 [Linux: amd64]
Compiled at 2019-06-06
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: e7471cebae2a404f3e4239f199f5a0c422484aac
active boot switches: -d:release
# nimble build 
  Verifying dependencies for [email protected]
      Info: Dependency on zmq@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on python3@any version already satisfied
  Verifying dependencies for [email protected]
   Building jupyternim/jupyternim using c backend
       Tip: 12 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: jupyternim
	... Details:
	... Execution failed with exit code 1
	... Command: "/root/.nimble/bin/nim" c --noBabelPath --path:"/root/.nimble/pkgs/zmq-0.2.2"  --path:"/root/.imble/pkgs/hmac-0.1.7"	--path:"/root/.nimble/pkgs/nimSHA2-0.1.1"  --path:"/root/.nimble/pkgs/sha1-1.1"  --path:"/rot/.nimble/pkgs/nimSHA2-0.1.1"	--path:"/root/.nimble/pkgs/python3-1.3"  -o:"/var/lib/jupyter/jupyternim/jupyternim "/var/lib/jupyter/jupyternim/src/jupyternim.nim"
	... Output: /var/lib/jupyter/jupyternim/src/jupyternim/messages.nim(39, 23) Warning: Deprecated since v0.200; use 'sample' instead; rand is deprecated [Deprecated]
	... /var/lib/jupyter/jupyternim/src/jupyternim/messages.nim(40, 24) Warning: Deprecated since v0.20.0; use sample' instead; rand is deprecated [Deprecated]
	... /var/lib/jupyter/jupyternim/src/jupyternim/sockets.nim(198, 30) Error: \u not allowed in character liteal

So, I modified the code of sockets.nim like the following.

# git diff
diff --git a/src/jupyternim/sockets.nim b/src/jupyternim/sockets.nim
index c84f875..1216b0f 100644
--- a/src/jupyternim/sockets.nim
+++ b/src/jupyternim/sockets.nim
@@ -195,7 +195,7 @@ proc handleExecute(shell: var Shell,msg:WireMessage) =
   let hasFlags = if code.contains("#>flags"): true else: false
   if hasFlags:
     let flagstart = code.find("#>flags")+"#>flags".len+1
-    let nwline = code.find('\u000A',flagstart)
+    let nwline = code.find("\u000A",flagstart)
     let flagend = if nwline != -1: nwline else: code.len
     flags = code[flagstart..flagend].split()
   
@@ -217,7 +217,7 @@ proc handleExecute(shell: var Shell,msg:WireMessage) =
     use_tcc = true
     tcc_path = " --cc:tcc"
     let tccstart = code.find("#>tinycc")+"#>tinycc".len+1
-    let nwline = code.find('\u000A',tccstart)
+    let nwline = code.find("\u000A",tccstart)
     let tccend = if nwline != -1: nwline else: code.len
     if code[tccstart..tccend].len>3: # 3 is arbitrary, C:\ is already 3 chars
       tcc_path&=" -L:"&code[tccstart..tccend]&" "

Then, I could build this.

# nimble build
  Verifying dependencies for [email protected]
      Info: Dependency on zmq@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on python3@any version already satisfied
  Verifying dependencies for [email protected]
   Building jupyternim/jupyternim using c backend

zmq.nim(737, 18) Error: cannot instantiate: 'T'

I ran into the zmq error when I install jupyternim on my MacOS machine. I executed the following command.

nimble install https://github.com/stisa/jupyternim

Environment

  • MacOS Mojave ver.10.14.6
  • Nim Compiler Version 1.2.0 [MacOSX: amd64]
  • nimble v0.11.0
  • zmq: 4.3.2 (4.2 is not published now.)

Error \u allowed in character literal

Nim version

(base) ➜  jupyternim git:(master) nim -v
Nim Compiler Version 1.0.6 [MacOSX: amd64]
Compiled at 2020-01-29
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release -d:useLinenoise
jupyternim git:(master) nimble build
  Verifying dependencies for [email protected]
      Info: Dependency on zmq@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on python3@any version already satisfied
  Verifying dependencies for [email protected]
   Building jupyternim/jupyternim using c backend
       Tip: 14 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: jupyternim
        ... Details:
        ... Execution failed with exit code 1
        ... Command: "/usr/local/Cellar/nim/1.0.6/nim/bin/nim" c --noNimblePath -d:NimblePkgVersion=0.1.7 --path:"/Users/Christopher/.nimble/pkgs/zmq-0.2.2"  --path:"/Users/Christopher/.nimble/pkgs/hmac-0.1.9"  --path:"/Users/Christopher/.nimble/pkgs/nimSHA2-0.1.1"  --path:"/Users/Christopher/.nimble/pkgs/sha1-1.1"  --path:"/Users/Christopher/.nimble/pkgs/nimSHA2-0.1.1"  --path:"/Users/Christopher/.nimble/pkgs/python3-1.3"  -o:"/Users/Christopher/Desktop/dev/dev/nim/jupyternim/jupyternim" "/Users/Christopher/Desktop/dev/dev/nim/jupyternim/src/jupyternim.nim"
        ... Output: /Users/Christopher/Desktop/dev/dev/nim/jupyternim/src/jupyternim/messages.nim(39, 23) Warning: Deprecated since v0.20.0; use 'sample' instead; rand is deprecated [Deprecated]
        ... /Users/Christopher/Desktop/dev/dev/nim/jupyternim/src/jupyternim/messages.nim(40, 24) Warning: Deprecated since v0.20.0; use 'sample' instead; rand is deprecated [Deprecated]
        ... /Users/Christopher/Desktop/dev/dev/nim/jupyternim/src/jupyternim/sockets.nim(198, 30) Error: \u not allowed in character literal

Why requires zmq < 1.3.0 ?

Long before, nim's zmq has upgraded over 1.3.0
For some reasons, I manually install the newer version of nim-zmq,
then during my using jupyter, I havn't found any errors which occured.
Therefore, I just wander what caused the version needs "less than 1.3.0" ('< 1.3.0')

zmq.dll problem

I hope this saves a people a lot of time on Windows

I'm very new to nim, but not that new to VScode or Jupyter Notebooks.

nimble install jupyternim -y got me about 99.99% of the way.

The problem was that zmq.dll couldn't be found. Digging in I found the zmq.dll wasn't compiled:

Installing zmq@>= 1.2.1 & < 1.3.0
Downloading https://github.com/nim-lang/nim-zmq using git
 Verifying dependencies for [email protected]
Installing [email protected]
  Success: zmq installed successfully.

Yeah, no.

I looked for a zmq.dll to download, found https://www.dll-files.com/libzmq.dll.html, but that was the 64bit version.

Found https://www.dll4free.com/libzmq.dll.html, scanned it for bad stuff, renamed it to zmq.dll and put it in the same folder as jupyternim.exe

Now it works in Jupyter Notebooks (Ananaconda version, and VScode)

cant install `jupyternim` on nim 1.4.8

info:
nim version: 1.4.8
os: windows 10
nimble version: 0.13.1

nimble log:

>> nimble install jupyternim -y


Downloading https://github.com/stisa/jupyternim using git
  Verifying dependencies for [email protected]
      Info: Dependency on zmq@>= 0.3.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimcrypto@>= 0.5.4 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimPNG@any version already satisfied
  Verifying dependencies for [email protected]

 Installing [email protected]
   Building jupyternim/jupyternim.exe using c backend
C:\Users\HamidB80\AppData\Local\Temp\nimble_1952\githubcom_stisajupyternim\src\jupyternimpkg\utils.nim(31, 25) Error: undeclared identifier: 'TConnection'
    Prompt: Build failed for '[email protected]', would you like to try installing 'jupyternim@#head' (latest unstable)? -> [forced yes]

Downloading https://github.com/stisa/jupyternim using git
  Verifying dependencies for jupyternim@#head
      Info: Dependency on zmq@>= 0.3.1 & < 0.4.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on hmac@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimcrypto@>= 0.5.4 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on nimPNG@any version already satisfied
  Verifying dependencies for [email protected]
 Installing jupyternim@#head
   Building jupyternim/jupyternim.exe using c backend
    Prompt: jupyternim@#head already exists. Overwrite? -> [forced yes]
    Prompt: Missing directory C:\Users\HamidB80\.nimble\pkgs\jupyternim-#head\src\jupyternimpkg. Continue? -> [forced yes]
    Prompt: Missing directory C:\Users\HamidB80\.nimble\pkgs\jupyternim-#head\src\jupyternimspec. Continue? -> [forced yes]
   Success: jupyternim installed successfully.

could not load: (lib|)zmq.dll
stack trace: (most recent call last)
C:\Users\HamidB80\AppData\Local\Temp\nimblecache-0\nimscriptapi_2641926642.nim(211, 28)
C:\Users\HamidB80\.nimble\pkgs\jupyternim-#head\jupyternim.nimble(26, 9) installAfter
C:\nim-1.4.8\lib\system\nimscript.nim(260, 7) exec
C:\nim-1.4.8\lib\system\nimscript.nim(260, 7) Error: unhandled exception: FAILED: C:\Users\HamidB80\.nimble\pkgs\jupyternim-#head\jupyternim.exe [OSError]
       Tip: 50 messages have been suppressed, use --verbose to show them.
     Error: Exception raised during nimble script execution

Error installing jupyternim from source on macOS

nim -v:

Nim Compiler Version 0.18.0 [MacOSX: amd64]
Copyright (c) 2006-2018 by Andreas Rumpf

active boot switches: -d:release -d:useLinenoise

nimble -v:

nimble v0.8.10 compiled at 2018-03-11 16:16:29
git hash: couldn't determine git hash

OS: macOS High Sierra (10.13.6 (17G65))

What did I do?

  1. Cloned this repo (worked)
  2. ran nimble build (worked)
  3. ran jupyternim (did not work)

What happened?

Error message:

Installing Jupyter Nim Kernel
jupyternim.nim(51)       jupyternim
sysio.nim(409)           writeFile
system.nim(2839)         sysFatal
Error: unhandled exception: cannot open:    Warning: Package 'jupyternim' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'jupyternimpkg', but file 'sockets.nim' is in a directory named 'jupyternim' instead. This will be an error in the future.
      Hint: If 'jupyternim' contains source files for building 'jupyternim', rename it to 'jupyternimpkg'. Otherwise, prevent its installation by adding `skipDirs = @["jupyternim"]` to the .nimble file.
     Error: At least one of the specified packages was not found/jupyternimspec/kernel.json [IOError]

What did expect to happen?

The nim kernel to be installed.

Jupyternim fails to install on macOS

Installation on macOS fails:

 Installing [email protected]
   Building jupyternim/jupyternim using c backend
   Warning: Symlink already exists in /Users/myuser/.nimble/bin/jupyternim. Replacing.
   Success: jupyternim installed successfully.
    Prompt: Missing directory /Users/myuser/.nimble/pkgs/jupyternim-0.8.0/src/jupyternimpkg. Continue? [y/N]
    Answer: y
    Prompt: Missing directory /Users/myuser/.nimble/pkgs/jupyternim-0.8.0/src/jupyternimspec. Continue? [y/N]
    Answer: y

Then when I try to run jupyternim from a shell I get a "command not found" error.

Adding an option to compile a cell/the whole kernel to c/cpp?

First off, I want to thank you for making such an amazing too, many thanks :)
So, I don't think currently there is such a feature. Some libraries require Nim to be compiled in C/C++, because they depend on some C/C++ code. Having an option, possibly a magic command if possible or basically compiling the whole kernel to cpp/c is useful.
I did some digging and it seems like it is possible to set compilation to cpp in src/jupyternimpkg/sockets.nim, with basically changing nim c to nim cpp and it worked. I think it is possible to make such an option so that somebody can choose between different types compilations.

TODO/Help wanted

Some things that would be useful:

  • improve installation experience, eg: wording of messages, checking for libzmq and fail gracefully if not found, etc
    • on macos, look for libraries in homebrew path too: DYLD_LIBRARY_PATH=/opt/homebrew/lib (ref #38)
  • improve the display module
  • example notebooks, eg with numericalnim and arraymancer
  • test message spec against jupyter (with CI too would be nice)
  • documentation
  • readme improvements
  • work on nim compiler and improve hot code reloading
  • rewrite hotcodereloading
    • add option to evaluate in the vm instead of compiling
  • a logo?
  • update zmq to latest

Some of these things may be harder than the rest :)

Other PRs are very welcome too!

edited: from hacktoberfest to general todo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.