## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Alexander Nozik
@altavir
Is there a way yet to export notebook with beakerx plots to html from notebook or lab?
ares fisher
@aresfishy_gitlab
hi! is there a way to import scala packages into beakerx scala notebooks? i couldn't get the method described here: https://nbviewer.jupyter.org/github/twosigma/beakerx/blob/master/doc/groovy/ClasspathMagicCommands.ipynb
(.. to work)
for clarity, i mean locally installed packages and not those provided with beakerx :)
Joe Pallas
@jpallas
@aresfishy_gitlab What flavor of "locally installed" do you mean? In the default Java path, in some other path, in the local maven repository?
ares fisher
@aresfishy_gitlab

i don't think they are in the default Java path, they are in separate folders (cloned from github). does building them with sbt add them to the java path? i'm obviously very new to scala and the jvm ecosystem. i can add the packages as sbt dependencies in the console and/or intellij, but i'm not sure how to configure them in a more intelligent way. i didn't get this to work by adding them to local maven repositories yet. would that do the job and make them accessible to the beakerx scala kernel?

thanks!

Joe Pallas
@jpallas
If you're new to both Scala and the JVM, there's probably a certain amount of unavoidable confusion ahead. And some of it will hinge around the fact that there are two popular dependency management tools, Ivy and Maven. This matters when you are trying to use locally built libraries, as the local repository layout is different.
I have to go, more later.
Joe Pallas
@jpallas
SBT uses Ivy for dependencies, and its publishLocalwill write to the local Ivy repository. There is apparently an undocumented publishM2 command that writes to the local Maven repository, instead. This may require the SBT build file to set publishMavenStyle to true, which a lot of projects do.
Alexander Nozik
@altavir
You forgot about gradle. It uses both Ivy and maven for resolution and its own local cache. I am not sure it used much in scala though.
Tim Paine
@timkpaine
@scottdraves I noticed your twosigma/beakerx#6955, has there been any talk of cutting out other pieces?
ares fisher
@aresfishy_gitlab
@jpallas Thanks for your input! as you anticipated, i'm still thoroughly confused. Let's say i want to import this package https://mvnrepository.com/artifact/com.cra.figaro/figaro_2.12/5.0.0.0 to my Scala notebook. Typing %classpath add mvn com.cra.figaro figaro 5.0.0 returns "unable to resolve dependencies for. com.cra.figaro... ".
ares fisher
@aresfishy_gitlab
the furthest i've gotten is when i'm in a project directory where the figaro package was added with Maven, %classpath add mvn com.cra.figaro:figaro_2.12:5.0.0.0 starts downloading, but soon returns an error: java.nio.file.NoSuchFileException: ....\AppData\Local\Temp\beaker1369027586355713128\mvnJars\mavenclasspathfilename.txt
thanks for your patience by the way!
Joe Pallas
@jpallas
@aresfishy_gitlab I'm afraid that last one sounds like #7780, a Windows-specific problem that was fixed just a few days ago.
Another important point: the BeakerX kernel uses Scala 2.11, not 2.12, so your artifact name should be figaro_2.11.
Joe Pallas
@jpallas
%classpath add mvn com.cra.figaro figaro_2.11 5.0.0.0 seems to work on Mac and Linux. I know that's not entirely useful if you are using Windows, until there is a release with the fix (or you do your own build).
ares fisher
@aresfishy_gitlab
@jpallas wow thanks a lot! i really appreciate you putting time into this. I get the same error on Windows with the 2_11 version, but it works like a charm on WSL!
Joe Pallas
@jpallas
Curtis Rueden
@ctrueden
Does anyone here know whether the %classpath magic has a feature to exclude transitive dependencies? Analogous to Groovy Grape's @GrabExclude feature?
Thijs Broersen
@ThijsBroersen
@ctrueden why do you need it? conflicts? if so, have you tried importing the conflicting dependencies in separate cells? It seems they are then isolated from eachother.. (I am using the Scala-kernel)
Curtis Rueden
@ctrueden
@ThijsBroersen The projects I work on have an extensible plugin mechanism where plugins are loaded from what's on the classpath. Sometimes, it is desirable to not have certain plugins installed into a particular environment. Thanks for the comment on version conflicts—that is very useful to know!
Jonas Jarutis
@jarutis
Hi
Is it possible to share notebooks with table and plot outputs? If I open the same notebook in other browser i get error: Error rendering Jupyter widget: missing widget manager
Curtis Rueden
@ctrueden
Is there a way to do dependency imports (i.e. a "bill of materials" where compatible versions are all declared in a <dependencyManagement> block) using %classpath and/or Groovy Grape?
rickhg12hs
@rickhg12hs

I'm having troubles getting started ... I just want to display a table in a Python Jupyter notebook...

import pandas as pd
from beakerx import *
from beakerx.object import beakerx
beakerx_table

There are no errors, but there is also no apparent output. Unfortunately a side-effect is that normal Jupyter Notebook output is also suppressed. I.e., later in the notebook, df.head() shows nothing.

What is the correct way to do this?

rickhg12hs
@rickhg12hs
... posted question on StackOverflow
Tim Paine
@timkpaine
@rickhg12hs did you install the beakerx JavaScript extensions?
rickhg12hs
@rickhg12hs

@timkpaine In a python3 -m venv virtual environment I did python3 -m pip install -UI beakerx and beakerx install.

It looks like there were install problems?

$jupyter nbextension enable beakerx --py --sys-prefix Enabling tree extension beakerx/tree... - Validating: problems found: - require? X beakerx/tree Enabling notebook extension beakerx/extension... - Validating: problems found: - require? X beakerx/extension rickhg12hs @rickhg12hs @timkpaine Hmmm, I beakerx uninstall and then beakerx install ... Now a table appears. I'll work with it and see how it goes. Peter Rose @pwrose Is there a way to specify a local repository with %classpath? Joe Pallas @jpallas @pwrose %classpath config resolver mvnLocal rickhg12hs @rickhg12hs How can beakerx be enabled for only specific jupyter notebooks? Can beakerx be enable/disabled from within the notebook? Peter Rose @pwrose @jpallas Thanks, I tried that, but I get a kernel error (using Java kernel) when I run %classpath config resolver mvnLocal. I have hundreds of dependencies in my ~/.m2/repository directory, could that be an issues? Curtis Rueden @ctrueden @pwrose You could try moving aside your existing ~/.m2/repository and building up a new one, to see if the problem persists. Peter Rose @pwrose @ctrueden @jpallas I created a fresh ~/.m2/repository, now when I run %classpath config resolver mvnLocal it points to /private/var/folders/fs/tlp3yk093qs8clwh1s3gb6540000gn/T/beaker6058009716743700773/outDir instead of ~/.m2/repository. Joe Pallas @jpallas @pwrose It copies files from the repo into its private area. Peter Rose @pwrose @jpallas The private area is empty. So apparently the copying from ~/.m2/repository doesn't seem to work. Joe Pallas @jpallas @pwrose In case it wasn't clear, the copying happens only when you do %classpath add mvn. Configuring the resolver doesn't trigger any copying, it just makes the maven resolution look in your local repository when you do an add mvn. Peter Rose @pwrose @jpallas Thanks for the clarifications. It works! Joe Pallas @jpallas Hurray! :tada: Peter Rose @pwrose I've setup a notebook using the Java kernel: https://github.com/sbl-sdsc/biojava-notebooks. Next, I've tried to setup travis-ci for this project. Since travis use pip install as the default, I tried to install beakerx with pip, however, travis-ci can find the java kernel. Does anyone have experience with setting up travis-ci with a beakerx project? Maarten Breddels @maartenbreddels I'd use (ana/mini)conda I believe then the beakerx kernels are installed automatically Peter Rose @pwrose @maartenbreddels Thanks, I got travis-ci working using miniconda, but my tests fail, but that's a different issue. Peter Rose @pwrose Why doesn't Spark work with the Java Kernel? I get: "ERROR: java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.package$".
Curtis Rueden
@ctrueden
I asked this back in October (see above), but I am looking for a way to import a bill of materials into a BeakerX notebook. Maven has a serious bug surrounding <dependencyManagement> whereby a project P may itself believe it depends on version X of someLibrary transitively, but if a downstream project Q depends on P, it will pull in version Y of someLibrary instead. (See this SO post for details if interested.) The workaround is to import the project P with import scope so that its dependency management is also used in project Q. Unfortunately, I cannot currently use this workaround in BeakerX notebooks because %classpath does not (directly) support importing BOMs. Would the development team be interested in receiving a PR adding this feature? If so, what syntax would be preferred? %classpath import mvn my.org my.bom 1.2.3 might make sense. (There could theoretically also be %classpath import pom '/path/to/local/pom.xml' although personally I would not need this.)
Joe Pallas
@jpallas
My personal opinion is that the classpath handling in BeakerX should stay as simple as possible. Beyond a certain point, we just end up creating a new language for specifying a POM, when Maven already has one. Faced with a problem like the above, I’d suggest generating a fat jar (“uber jar”) with the correct versions using Maven (or Ivy or sbt or whatever).
Curtis Rueden
@ctrueden
@jpallas Thanks for responding. I definitely appreciate the desire to keep things simple. However, I think the solution of creating an uber-JAR to work around limitations in Maven is untenable. There are serious issues with uber-JARs in many deployment scenarios. I also think it is unreasonable to require creating a new artifact just to use a library in a notebook. The "bill of materials" concept is well established in Maven, and adding a way to import one via %classpath is natural. Gradle also added support for this since it is a very useful feature.
I guess I should file an issue on the tracker, so there can be a more persistent discussion.