Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running scala notebook on Windows failed #1

Closed
chmnoh opened this issue Apr 9, 2015 · 6 comments
Closed

Running scala notebook on Windows failed #1

chmnoh opened this issue Apr 9, 2015 · 6 comments
Labels

Comments

@chmnoh
Copy link

chmnoh commented Apr 9, 2015

Hi, thank you for this great work!

But, I'm having a problem on running this kernel on Windows.
The library seems to find 'connection-file' in wrong place.

It tries to find the file in 'C:**Users\cmoh.ipython\profile_default\secure**C:\Users\cmoh.ipython\profile_default\security\kernel-~~~~~~~~~.json'.
Note the "C:" path string appears twice, and there is no "C:...\profile_default*secure*" directory.(though 'C:...\profile_default*security*' exists.)

I'm using

C:\Users\cmoh\Documents\scala>ipython --version
3.1.0

C:\Users\cmoh\Documents\scala>scala -version
Scala code runner version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL

Here is my running 'ipython notebook --debug' result.

[D 11:26:08.063 NotebookApp] Connecting to: tcp://127.0.0.1:54672
[I 11:26:08.066 NotebookApp] Kernel started: 7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f
[D 11:26:08.066 NotebookApp] Kernel args: {'cwd': u'C:\\Users\\cmoh\\Documents\\scala'}
[D 11:26:08.068 NotebookApp] 201 POST /api/sessions (::1) 69.00ms
[D 11:26:08.069 NotebookApp] 200 GET /api/contents/Untitled12.ipynb/checkpoints?_=1428546367311 (::1) 1.00ms
"C:\Program Files\Java\jdk1.8.0_40\bin\java.exe"   -cp "C:\Users\cmoh\Documents\jupyter-scala-cli-0.2.0-SNAPSHOT\bin\..\lib\*;" -Dprog.home="C:\Users\cmoh\Documents\jupyter-scala-cli-0.2.0-SNAPSHOT\bin\.." -Dprog.version="0.2.0-SNAPSHOT" jupyter.scala.JupyterScala --quiet --connection-file C:\Users\cmoh\.ipython\profile_default\security\kernel-7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f.json
[D 11:26:08.095 NotebookApp] Initializing websocket connection /api/kernels/7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f/channels
[D 11:26:08.098 NotebookApp] Requesting kernel info from 7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f
[D 11:26:08.098 NotebookApp] Connecting to: tcp://127.0.0.1:54669
11:26:10,414 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
11:26:10,414 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
11:26:10,414 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/C:/Users/cmoh/Documents/jupyter-scala-cli-0.2.0-SNAPSHOT/lib/jupyter-scala-cli_2.11-0.2.0-SNAPSHOT.jar!/logback.xml]
11:26:10,415 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
11:26:10,415 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/C:/Users/cmoh/Documents/jupyter-scala-cli-0.2.0-SNAPSHOT/lib/jupyter-scala-cli_2.11-0.2.0-SNAPSHOT.jar!/logback.xml]
11:26:10,415 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/C:/Users/cmoh/Documents/jupyter-scala-cli-0.2.0-SNAPSHOT/lib/jupyter-scala-cli_2.11.6-0.2.0-SNAPSHOT.jar!/logback.xml]
11:26:10,425 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@51827393 - URL [jar:file:/C:/Users/cmoh/Documents/jupyter-scala-cli-0.2.0-SNAPSHOT/lib/jupyter-scala-cli_2.11-0.2.0-SNAPSHOT.jar!/logback.xml] is not of type file
11:26:10,480 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11:26:10,482 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
11:26:10,491 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
11:26:10,540 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@3be4f71 - Will use zip compression
11:26:10,550 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:26:10,573 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: C:\Users\cmoh\AppData\Local\Temp\/jupyter-scala.log
11:26:10,573 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [C:\Users\cmoh\AppData\Local\Temp\/jupyter-scala.log]
11:26:10,575 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:26:10,577 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
11:26:10,579 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:26:10,579 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11:26:10,580 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
11:26:10,580 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:26:10,581 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5c645b43 - Registering current configuration as safe fallback point

Exception in thread "main" java.io.FileNotFoundException: C:\Users\cmoh\.ipython\profile_default\secure\C:\Users\cmoh\.ipython\profile_default\security\kernel-7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f.json (파일 이름, 디렉터리 이름 또는 볼륨 레이블 구문이 잘못되었습니다)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at java.io.PrintWriter.<init>(PrintWriter.java:263)
    at jupyter.kernel.server.Server$.newConnectionFile(Server.scala:54)
    at jupyter.kernel.server.Server$$anonfun$apply$12$$anonfun$apply$13.apply(Server.scala:146)
    at jupyter.kernel.server.Server$$anonfun$apply$12$$anonfun$apply$13.apply(Server.scala:140)
    at scalaz.$bslash$div.flatMap(Either.scala:134)
    at jupyter.kernel.server.Server$$anonfun$apply$12.apply(Server.scala:140)
    at jupyter.kernel.server.Server$$anonfun$apply$12.apply(Server.scala:127)
    at scalaz.$bslash$div.flatMap(Either.scala:134)
    at jupyter.kernel.server.Server$.apply(Server.scala:127)
    at jupyter.kernel.server.ServerApp$.apply(ServerApp.scala:70)
    at jupyter.scala.JupyterScala.delayedEndpoint$jupyter$scala$JupyterScala$1(JupyterScala.scala:22)
    at jupyter.scala.JupyterScala$delayedInit$body.apply(JupyterScala.scala:8)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at caseapp.App$$anonfun$apply$1.apply(App.scala:25)
    at caseapp.App$$anonfun$apply$1.apply(App.scala:24)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
    at caseapp.App$class.apply(App.scala:24)
    at jupyter.scala.JupyterScala.apply(JupyterScala.scala:8)
    at caseapp.AppOf.main(App.scala:62)
    at jupyter.scala.JupyterScala.main(JupyterScala.scala)
[I 11:26:11.063 NotebookApp] KernelRestarter: restarting kernel (1/5)
[D 11:26:11.068 NotebookApp] Connecting to: tcp://127.0.0.1:54672

And jupyter-scala.log file:

2015-04-09 11:19:58 INFO [main] j.k.s.Server$ [Server.scala:141] Connection file: C:\Users\cmoh\.ipython\profile_default\secure\C:\Users\cmoh\.ipython\profile_default\security\kernel-be4ac361-8a94-45ba-9072-fb58b39cef1c.json
2015-04-09 11:22:36 INFO [main] j.k.s.Server$ [Server.scala:141] Connection file: C:\Users\cmoh\.ipython\profile_default\secure\C:\Users\cmoh\.ipython\profile_default\security\kernel-6ae236b3-0ff8-4887-8482-58a69bb5eeeb.json
2015-04-09 11:26:10 INFO [main] j.k.s.Server$ [Server.scala:141] Connection file: C:\Users\cmoh\.ipython\profile_default\secure\C:\Users\cmoh\.ipython\profile_default\security\kernel-7ce6acc0-ee32-4960-9bec-1dbf9b3aa12f.json

I generated kernel.json using jupyter-scala.bat --kernel-spec (C:\Uses\cmoh.ipython\kernels\scala-2.11\kernel.json)(though its initial path-delimiter was wrong.. i corrected manually).

{
  "argv": ["C:\\Users\\cmoh\\Documents\\jupyter-scala-cli-0.2.0-SNAPSHOT\\bin\\jupyter-scala.bat", "--quiet", "--connection-file", "{connection_file}"],
  "display_name": "Scala 2.11",
  "language": "scala",
  "extensions": ["snb"]
}

Please, let me know the way to fix this.

@alexarchambault
Copy link
Member

Yes, I used a kernel from https://github.com/alexarchambault/jupyter-kernel on Windows recently (the "meta" one), and ran into this kind of issues.

Just tested my workaround with the scala-2.11 one, it seems to work:

  • manually edit C:\Users\user\.ipython\kernels\scala-2.11\kernel.json to properly escape the kernel path, and have it point to the bat script rather than the bash one (you already did that appearently),
  • then manually edit the bat script it points to, and in the line
SET CMDLINE=%JAVA_EXE% %JVM_OPT%  -cp "%PROG_HOME%\lib\*;" -Dprog.home="%PROG_HOME%" -Dprog.version="0.2.0-SNAPSHOT" jupyter.scala.JupyterScala %CMD_LINE_ARGS%

change %CMD_LINE_ARGS% at then end by %CMD_LINE_ARGS:\=/% (this is line 92 on the version I have). This is a workaround for https://github.com/alexarchambault/jupyter-kernel/blob/master/kernel/src/main/scala/jupyter/kernel/server/Server.scala#L133-L137.

This is really a quick-and-dirty fix. I'll soon revive my Jupyter projects, and ensure this workaround isn't necessary anymore.

@chmnoh
Copy link
Author

chmnoh commented Apr 9, 2015

The "quick-and-dirty fix" is working! Thank you~ 👍

@melondonkey
Copy link

Just want to add I had this same issue and this fix resolved it for me as well. Thanks!

@alexarchambault
Copy link
Member

This is now fixed:

jupyter-scala 1

@kevinwkc
Copy link

kevinwkc commented Feb 13, 2017

Where I can find instruction for window installation for jupyter-scala?
Thank You for helping...
the work-around link is broken...
or can you upload the scala211 kernel folder, so I can just put it in my kernel folder, it might be easier?

@rvilla87
Copy link

@kevinwkc here you have, hope Alexandre don't mind.

I also had this problem trying to install the kernel in Windows 7. I had to use Windows 10 bash system in order to generate the kernel binaries and now I have scala kernel working in both Windows :)

Thanks Alexandre for your work!

satishkotha pushed a commit to satishkotha/almond that referenced this issue Apr 10, 2022
add rio file to publish almond library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants