Skip to content

A package's build environment should include run dep paths as well as build dep paths#3347

Closed
krafczyk wants to merge 5 commits intospack:developfrom
krafczyk:fix/npm-bug
Closed

A package's build environment should include run dep paths as well as build dep paths#3347
krafczyk wants to merge 5 commits intospack:developfrom
krafczyk:fix/npm-bug

Conversation

@krafczyk
Copy link
Copy Markdown
Contributor

@krafczyk krafczyk commented Mar 3, 2017

Fixes #3345.

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented Mar 3, 2017

@certik Could you pull this branch and confirm if it solves your problem?

@certik
Copy link
Copy Markdown
Contributor

certik commented Mar 3, 2017

I applied the following patch:

+certik@redhawk:~/repos/spack(develop)$ git diff
diff --git a/var/spack/repos/builtin/packages/npm/package.py b/var/spack/repos/builtin/packages/npm/package.py
index 500674d..6196da4 100644
--- a/var/spack/repos/builtin/packages/npm/package.py
+++ b/var/spack/repos/builtin/packages/npm/package.py
@@ -36,7 +36,7 @@ class Npm(AutotoolsPackage):
     version('3.10.9', 'ec1eb22b466ce87cdd0b90182acce07f')
     version('3.10.5', '46002413f4a71de9b0da5b506bf1d992')
 
-    depends_on('node-js')
+    depends_on('node-js', type=('build', 'run'))
 
     def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
         npm_config_cache_dir = "%s/npm-cache" % dependent_spec.prefix

but still the same problem:

+certik@redhawk:~$ spack install -j16 py-jupyter-notebook %[email protected]
==> Installing py-jupyter-notebook
==> Installing npm
==> node-js is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/node-js-7.1.0-qiwhfgccrcfmkgc4m7jx3nkqzmkicw2s
==> Using cached archive: /home/certik/repos/spack/var/spack/cache/npm/npm-3.10.9.tgz
==> Staging archive: /home/certik/repos/spack/var/spack/stage/npm-3.10.9-iukblzfg6e5szeiv2hx6frftl7in4n4q/npm-3.10.9.tgz
==> Created stage in /home/certik/repos/spack/var/spack/stage/npm-3.10.9-iukblzfg6e5szeiv2hx6frftl7in4n4q
==> Ran patch() for npm
==> Building npm [AutotoolsPackage]
==> Executing phase : 'autoreconf'
==> Executing phase : 'configure'
==> Executing phase : 'build'
==> Executing phase : 'install'
==> Successfully installed npm
  Fetch: 0.03s.  Build: 16.82s.  Total: 16.85s.
[+] /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/npm-3.10.9-iukblzfg6e5szeiv2hx6frftl7in4n4q
==> py-ipykernel is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-ipykernel-4.5.0-t7irkijqivrpi5sftt5tpuurxwyhojqs
==> py-nbconvert is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-nbconvert-4.2.0-i2gzxungrqq63y5vh4znnpdl7l2buwgo
==> py-traitlets is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-traitlets-4.3.1-ndrwnw254vls42fyziwyzje5bt6egex6
==> py-ipython-genutils is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-ipython-genutils-0.1.0-erlina4ulsiyua6kvek6jxrg47jjbhon
==> py-jupyter-client is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-client-4.4.0-iacniz2tlakoo7p6u2i2x7krqzyzaxnm
==> py-nbformat is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-nbformat-4.1.0-3yi463eaoljgpszmye4ckrddzpwwvk4b
==> python is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu
==> py-tornado is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-tornado-4.4.0-6hrsmmcsggsmp25ozqy3gtuvh5fhfk5u
==> py-jupyter-core is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-core-4.2.0-2jjfbcjpfsoqc3ov2lmiucgogeoeavuv
==> py-setuptools is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-setuptools-34.2.0-cudzrdzpou7mif2zw3fmmuwhdngfm2x6
==> py-jinja2 is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jinja2-2.8-4ddiwza25irn35vhb6kck6zfyur4xbow
==> py-jupyter-console is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-console-5.0.0-dm2s57qafex64yne4tbqm4rbsqsza2im
==> Using cached archive: /home/certik/repos/spack/var/spack/cache/py-jupyter-notebook/py-jupyter-notebook-4.2.3.tar.gz
==> Staging archive: /home/certik/repos/spack/var/spack/stage/py-jupyter-notebook-4.2.3-rkbpngcvfiepja6w64zxwovymjw5ms4j/4.2.3.tar.gz
==> Created stage in /home/certik/repos/spack/var/spack/stage/py-jupyter-notebook-4.2.3-rkbpngcvfiepja6w64zxwovymjw5ms4j
==> No patches needed for py-jupyter-notebook
==> Building py-jupyter-notebook [PythonPackage]
==> Executing phase : 'build'
==> Error: ProcessError: Command exited with status 1:
    '/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/bin/python' 'setup.py' '--no-user-cfg' 'build'
/home/certik/repos/spack/lib/spack/spack/build_systems/python.py:110, in python:
     109      def python(self, *args):
  >> 110          inspect.getmodule(self).python(*args)

See build log for details:
  /home/certik/tmp/spack-stage/spack-stage-UDMQdl/notebook-4.2.3/spack-build.out
+certik@redhawk:~$ cat /home/certik/tmp/spack-stage/spack-stage-UDMQdl/notebook-4.2.3/spack-build.out
==> '/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/bin/python' 'setup.py' '--no-user-cfg' 'build'
running build
running build_py
running jsversion
running css
running jsdeps
installing build dependencies with npm
> npm install
/usr/bin/env: ‘node’: No such file or directory
rebuilding js and css failed. The following required files are missing: ['notebook/static/components', 'notebook/static/notebook/js/main.min.js', 'notebook/static/tree/js/main.min.js', 'notebook/static/edit/js/main.min.js', 'notebook/static/terminal/js/main.min.js', 'notebook/static/auth/js/main.min.js', 'notebook/static/style/ipython.min.css', 'notebook/static/style/style.min.css']
Traceback (most recent call last):
  File "setup.py", line 198, in <module>
    main()
  File "setup.py", line 195, in main
    setup(**setup_args)
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/python-2.7.13-5gx5sb5s5ns2cmne3qwnl632omokfdqu/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/certik/tmp/spack-stage/spack-stage-UDMQdl/notebook-4.2.3/setupbase.py", line 549, in run
    raise e
subprocess.CalledProcessError: Command '['npm', 'install']' returned non-zero exit status 127
+

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented Mar 3, 2017 via email

@certik
Copy link
Copy Markdown
Contributor

certik commented Mar 3, 2017

Thanks @krafczyk.

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented Mar 5, 2017

@certik try this branch again, you'll need to force pull fix/npm-bug because I've rebased it on develop.

Thanks for reporting this, it turns out this was a more subtle bug than I had anticipated. There was a fairly serious bug hiding here, and I believe we've fixed it.

@davydden Let me know your opinion here, It turns out that the bin dirs of only build deps were being added to the environment. To fix this bug, I had to add run dependency bin dirs as well as bin dirs of the build dependencies.

@citibeth I vaguely remember discussing where ${npm_config_cache} should point and that you thought it shouldn't point to npm's prefix. When fixing this bug, I've found that npm actually doesn't work properly unless it points to npm's prefix. The original computer I was using when adding node and npm had node installed as a system program which hid these bugs from being discovered earlier.

env.set('SPACK_COMPILER_EXTRA_RPATHS', extra_rpaths)

# Add bin directories from dependencies to the PATH for the build.
bin_dirs = reversed(filter(os.path.isdir, [
Copy link
Copy Markdown
Member

@davydden davydden Mar 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a python guru, but it looks to me that the original code should have added bin dir of node-js.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does for npm, but not for packages that depend on npm. The bin dirs are only added for explicit build dependencies. I don't think that package maintainers should have to specify that a package depending on npm also depends on node-js. That ought to come with using npm as a build dependency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see

for item in bin_dirs:
env.prepend_path('PATH', item)
# Add bin directories from dependencies to the PATH for the build or run.
def add_dir_to_list(bin_dir, list):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we generally do not define functions within other functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It makes the following code much easier to comprehend.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you misunderstood me, i meant to move the definition outside.

run_bin_dirs = []
for d in pkg.spec.traverse(root=False, deptype='run'):
add_dir_to_list("%s/bin" % d.prefix, run_bin_dirs)
run_bin_dirs = filter(os.path.isdir, ['%s/bin' % d.prefix for d in pkg.spec.traverse(root=False, deptype='run') ])
Copy link
Copy Markdown
Member

@davydden davydden Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you set this list already above. This line and the next can be removed.

if bin_dir not in list:
list.append(bin_dir)
build_deps = [ d for d in pkg.spec.dependencies(deptype='build') ]
build_bin_dirs = []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a short comment above build_bin_dirs = [], run_bin_dirs = [] and bin_dirs = [] what those are meant to contain.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(one can of course get it from the code, but I think it makes the function easier to read. It also makes it clear what is the intention here)

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented Mar 7, 2017

@davydden I've pushed a new commit to clean up the code I've added a bit. I tried to address your concerns, Please have another look.

Copy link
Copy Markdown
Member

@davydden davydden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, but I am sure others would like to have a look.


# Add all bin directories which build dependencies and their
# run dependencies require.
for bdep in [ d for d in pkg.spec.dependencies(deptype='build') ]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this line equivalent to the simpler

for bdep in pkg.spec.dependencies(deptype='build'):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I've added a new commit fixing this.

@krafczyk krafczyk changed the title node-js is a runtime dependency of npm. A package's build environment should include run dep paths as well as build dep paths Mar 8, 2017
krafczyk added 5 commits April 4, 2017 14:30
Currently only build dep bin dirs are added to the environment.
This patch adds the bin dirs of run deps as well as run deps
of the build deps. This fixes situations when a build dep is
a kind of script such as npm which requires a run time binary like node.
If it isn't, node can't find npm or any other installed npm packages.
@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented Apr 4, 2017

@becker33 I've rebased and addressed your concerns. Could we get this merged?

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about weighing in late on this!

That being said IMO this will be good if all you do is remove the lines which add run dependencies to the build-time PATH


# Add all bin directories which run dependencies require.
for rdep in pkg.spec.traverse(root=False, deptype='run'):
add_dir_to_list("%s/bin" % rdep.prefix, bin_dirs)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO if the user wants a package to be part of the path when doing an install they should mark that package as a build dependency. This may be useful later since Spack in the future will try to concretize build dependencies separately (so if a package is 'run' but not 'build' that can help it avoid conflicts).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with removing these lines is that a package's build dependencies are not made available to packages which depend on it. Example:

C^(B^A(build))
Only B will be added to 'C's' path. Now if 'A' is required for 'C' to run, it will fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, if A is required for 'B' to work, then C will fail when trying to run 'B' since 'A' will not be available. (more clear description)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If A is required for B to work post-installation, doesn't that mean it should be a run dependency, not a build dependency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah that's true.. Hmm I remember adding those lines because I was having a problem with NPM, maybe I was actually having a problem with my node-js and npm package. I'll take another look this weekend.

Copy link
Copy Markdown
Member

@scheibelp scheibelp Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If C needs A to run, IMO C should specify a run dependency on C directly (this is probably restating what was already said)

Sorry, if A is required for 'B' to work, then C will fail when trying to run 'B' since 'A' will not be available.

You added logic earlier (specifically line 339) which adds the transitive run dependencies of any build dependencies, so your earlier logic should handle the building of C if

C -[b]-> B -[r]-> A

Copy link
Copy Markdown
Member

@scheibelp scheibelp Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as setting up the run-time environment I can see that transitive run dependencies should be included, for example:

X -[r]-> Y -[r]-> Z

Y and Z should be made visible for X at run-time. However, I figure that is not the concern of this function ( as it is called "set_build_environment_variables"). If this function is being used elsewhere to set up run-time environment and I'm overlooking that let me know.

@citibeth
Copy link
Copy Markdown
Member

citibeth commented Apr 8, 2017

I would encourage us to look at #3768 and try to figure out these issues once and for all.

@scheibelp scheibelp mentioned this pull request Apr 25, 2017
@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented May 1, 2017

Hey folks, sorry for the long delay.

I've taken a second look at this problem with the current develop, and I'm now unable to reproduce the problem.

@certik Could you try to install py-jupyter-notebook again with a clean spack from the current develop, and let me know if it fails for you again? Also, can you make sure that node-js and npm aren't installed on your system, or if they are, aren't available through PATH or LD_LIBRARY_PATH?

@certik
Copy link
Copy Markdown
Contributor

certik commented May 1, 2017

I checked out this PR and installed using:

$ spack install -j16 py-jupyter-notebook %[email protected]

and it finished.

I then tried to run it:

$ spack load py-jupyter-notebook %[email protected]
$ jupyter-notebook 
Traceback (most recent call last):
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/bin/jupyter-notebook", line 3, in <module>
    from notebook.notebookapp import main
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/lib/python2.7/site-packages/notebook/__init__.py", line 25, in <module>
    from .nbextensions import install_nbextension
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/lib/python2.7/site-packages/notebook/nbextensions.py", line 23, in <module>
    from jupyter_core.paths import (
ImportError: No module named jupyter_core.paths

and it failed.

How do you actually run it?

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented May 1, 2017

@certik, Can you please try it again, but without this PR? Try cloning a new spack version and using that to install py-jupyter-notebook.

git clone https://github.com/llnl/spack spack
python spack/bin/spack install py-jupyter-notebook

If the install is successful, you need to do two things to make use of packages installed in spack,

  1. Install environment-modules (or dotkit) spack install environment-modules
  2. Make the module command available following these instructions: https://spack.readthedocs.io/en/latest/getting_started.html#environment-modules

I'm trying to make this process easier with the spack bootstrap command in PR #3057.

@certik
Copy link
Copy Markdown
Contributor

certik commented May 1, 2017

Ok, I checked the latest master and did:

$ spack install py-jupyter-notebook %[email protected]
==> Installing py-jupyter-notebook
==> Installing npm
==> Installing node-js
==> Installing python
==> bzip2 is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/bzip2-1.0.6-j5voaqmu4spaacvtcb7ieunhx3ko3jdr
==> ncurses is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a
==> zlib is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.10-4tpn2be4nksv6mhxqclnichuuklr4js5
==> Installing openssl
==> zlib is already installed in /home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.10-4tpn2be4nksv6mhxqclnichuuklr4js5
==> Fetching ftp://openssl.org/source/openssl-1.0.2j.tar.gz

curl: (78) RETR response: 550
==> Fetching from ftp://openssl.org/source/openssl-1.0.2j.tar.gz failed.
==> Error: FetchError: All fetchers failed for openssl-1.0.2j-gkrxtghh5fjh7akzv7idd7x4mbex2d5f
/home/certik/repos/spack/lib/spack/spack/package.py:943, in do_fetch:
     916      def do_fetch(self, mirror_only=False):
     917          """
     918          Creates a stage directory and downloads the tarball for this package.
     919          Working directory will be set to the stage directory.
     920          """
     921          if not self.spec.concrete:
     922              raise ValueError("Can only fetch concrete packages.")
     923  
     924          start_time = time.time()
     925          if spack.do_checksum and self.version not in self.versions:
     926              tty.warn("There is no checksum on file to fetch %s safely." %
     927                       self.spec.format('$_$@'))
     928  
     929              # Ask the user whether to skip the checksum if we're
     930              # interactive, but just fail if non-interactive.
     931              ck_msg = "Add a checksum or use --no-checksum to skip this check."
     932              ignore_checksum = False
     933              if sys.stdout.isatty():
     934                  ignore_checksum = tty.get_yes_or_no("  Fetch anyway?",
     935                                                      default=False)
     936                  if ignore_checksum:
     937                      tty.msg("Fetching with no checksum.", ck_msg)
     938  
     939              if not ignore_checksum:
     940                  raise FetchError("Will not fetch %s" %
     941                                   self.spec.format('$_$@'), ck_msg)
     942  
  >> 943          self.stage.fetch(mirror_only)
     944  
     945          self._fetch_time = time.time() - start_time
     946  
     947          if spack.do_checksum and self.version in self.versions:
     948              self.stage.check()
     949  
     950          self.stage.cache_local()

Let's say it works, as it did with this PR. How do I actually load it? I already have the modules installed. Can you please post the exact modules that are needed to be loaded, so that the following works:

jupyter notebook

That would be very helpful.

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented May 1, 2017

Oops, I forgot that part,

To load and use py-jupyter-notebook, you need to do the following assuming you're using bash or zsh and module is available:
source <(spack module loads -m tcl --dependencies py-jupyter-notebook)

This will load py-jupyter-notebook along with all it's dependencies. You should then be able to run jupyter-notebook from the command line just fine.

I'm concerned that you may not have updated spack properly because the current develop branch has the lastest openssl version 1.0.2k available. Can you do the following:

cd ${SPACK_DIR}; #Directory where spack is located
git clean -fdx;
git checkout develop;
git pull origin develop;
source share/spack/setup-env.sh;
spack install py-jupyter-notebook
source <(spack module loads --dependencies py-jupyter-notebook)
jupyter-notebook

@certik
Copy link
Copy Markdown
Contributor

certik commented May 1, 2017

I switched to the latest develop branch, and got:

$ spack install py-jupyter-notebook %[email protected]
[...]
$ spack module loads --dependencies py-jupyter-notebook %[email protected]                                                        
# [email protected]%[email protected]+pic+shared arch=linux-ubuntu16-x86_64 
module load zlib-1.2.11-gcc-5.4.0-zn23nl6
# [email protected]%[email protected] arch=linux-ubuntu16-x86_64 
module load openssl-1.0.2k-gcc-5.4.0-52wmhxm
# [email protected]%[email protected]~debug~doc~icu4c+openssl+zlib arch=linux-ubuntu16-x86_6
4 
module load node-js-7.1.0-gcc-5.4.0-qiwhfgc
# [email protected]%[email protected]+shared arch=linux-ubuntu16-x86_64 
module load bzip2-1.0.6-gcc-5.4.0-icdmmm2
# [email protected]%[email protected]~symlinks arch=linux-ubuntu16-x86_64 
module load ncurses-6.0-gcc-5.4.0-taazswe
# [email protected]%[email protected] arch=linux-ubuntu16-x86_64 
[...]
$ jupyter-notebook 
Traceback (most recent call last):
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/bin/jupyter-notebook", line 3, in <module>
    from notebook.notebookapp import main
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/lib/python2.7/site-packages/notebook/__init__.py", line 25, in <module>
    from .nbextensions import install_nbextension
  File "/home/certik/repos/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/py-jupyter-notebook-4.2.3-vzgioguh623gvy6wwaonefbgmmrjhptk/lib/python2.7/site-packages/notebook/nbextensions.py", line 23, in <module>
    from jupyter_core.paths import (
ImportError: No module named jupyter_core.paths

I will now try to clone spack to a fresh directory and redo this.

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented May 1, 2017

@certik, spack module loads produces a script for loading the appropriate modules, but does nothing by itself.

You can either direct that output to a file, and then source that file like so:

spack module loads -m tcl --dependencies py-jupyter-notebook > notebook.env
source notebook.env

Or, you can take advantage of bash/zsh's process substitution to avoid creating a file like so:

source <(spack module loads -m tcl --dependencies py-jupyter-notebook)

There are more ways of doing this as mentioned here, but process substitution is my favorite.

@certik
Copy link
Copy Markdown
Contributor

certik commented May 1, 2017

@krafczyk I see. So with the clean develop branch, I saved the output to a file and sourced it. Now it works! Jupyter notebook loads and runs.

So I think that the original problem is now fixed. Thanks for the help!

@krafczyk
Copy link
Copy Markdown
Contributor Author

krafczyk commented May 1, 2017

This is great news!

I'm waiting to hear back from @mikkokotila, but if they can run py-jupyter-notebook as well, I think it may be time to close this PR. and issue #3345.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Nov 11, 2019

Closing, as run dependencies should be used at run-time. If there's a need for a dependency to be used both at run-time and build-time it can be marked as ('run', 'build').

@alalazo alalazo closed this Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jupyter notebook fails to install

8 participants