CDAT / jupyter-vcdat

A Jupyter Lab extension based on vCDAT.
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Error trying to capture provenance during plot export #44

Closed William-Hill closed 5 years ago

William-Hill commented 5 years ago

Describe the bug An error occurs when passing in provenance=True to a plot export function (such as canvas.png())

To Reproduce Steps to reproduce the behavior:

  1. Load a variable into Jupyter Lab (it's named canvas by default)
  2. Run canvas.png("test_plot", provenance=True)

Expected behavior A plot is exported with provenance captured

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Environment Information

`conda info`

``` active environment : jupyter-vcdat active env location : /Users/hill119/anaconda2/envs/jupyter-vcdat shell level : 1 user config file : /Users/hill119/.condarc populated config files : /Users/hill119/.condarc conda version : 4.5.12 conda-build version : 3.17.6 python version : 2.7.15.final.0 base environment : /Users/hill119/anaconda2 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /Users/hill119/anaconda2/pkgs /Users/hill119/.conda/pkgs envs directories : /Users/hill119/anaconda2/envs /Users/hill119/.conda/envs platform : osx-64 user-agent : conda/4.5.12 requests/2.21.0 CPython/2.7.15 Darwin/17.7.0 OSX/10.13.6 UID:GID : 47256:47256 netrc file : /Users/hill119/.netrc offline mode : False ```

`conda list`

``` appnope 0.1.0 py36_1000 conda-forge asn1crypto 0.24.0 py36_1003 conda-forge attrs 18.2.0 py_0 conda-forge backcall 0.1.0 py_0 conda-forge blas 1.0 mkl bleach 3.1.0 py_0 conda-forge bzip2 1.0.6 h1de35cc_1002 conda-forge ca-certificates 2018.11.29 ha4d7672_0 conda-forge cdat_info 8.1.1 py_0 cdat/label/nightly cdms2 3.1.2.2019.02.09.04.49.g2108edd py36hd5f3a30_0 cdat/label/nightly cdtime 3.1.2.2019.02.09.04.09.gba9e0cb py36hd5f3a30_0 cdat/label/nightly cdutil 8.0.2018.11.12.19.20.g3bd6383 py_0 cdat/label/nightly certifi 2018.11.29 py36_1000 conda-forge cffi 1.12.2 py36h342bebf_0 conda-forge chardet 3.0.4 py36_1003 conda-forge clapack 3.2.1 h1de35cc_1001 conda-forge cryptography 2.5 py36hc2b1221_1 conda-forge curl 7.64.0 heae2a1f_2 conda-forge decorator 4.3.2 py_0 conda-forge distarray 2.12.2 py_1 conda-forge dv3d 8.0.2019.02.27.00.48.g5714b60 py_0 cdat/label/nightly entrypoints 0.3 py36_1000 conda-forge esmf 7.1.0 h5f93626_1004 conda-forge esmpy 7.1.0 py36h24bf2e0_3 conda-forge expat 2.2.5 h0a44026_1002 conda-forge ffmpeg 4.1 heb45b42_1002 conda-forge freetype 2.9.1 h597ad8a_1005 conda-forge future 0.17.1 py36_1000 conda-forge g2clib 1.6.0 h4e57d6e_9 conda-forge genutil 8.1.2018.10.17.14.26.ga5756e2.npy1.14 py36h776bbcc_0 cdat/label/nightly gettext 0.19.8.1 hcca000d_1001 conda-forge ghostscript 9.22 h0a44026_1001 conda-forge gmp 6.1.2 h0a44026_1000 conda-forge gnutls 3.6.5 h53004b3_1001 conda-forge hdf4 4.2.13 hf3c6af0_1002 conda-forge hdf5 1.10.4 nompi_h646315f_1105 conda-forge idna 2.8 py36_1000 conda-forge intel-openmp 2019.1 144 ipykernel 5.1.0 py36h24bf2e0_1002 conda-forge ipython 7.3.0 py36h24bf2e0_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.4.2 jasper 1.900.1 h636a363_1006 conda-forge jedi 0.13.3 py36_0 conda-forge jinja2 2.10 py_1 conda-forge jpeg 9c h1de35cc_1001 conda-forge jsonschema 3.0.0 py36_0 conda-forge jupyter_client 5.2.4 py_1 conda-forge jupyter_core 4.4.0 py_0 conda-forge jupyterlab 0.35.4 py36_0 conda-forge jupyterlab_server 0.2.0 py_0 conda-forge krb5 1.16.3 hcfa6398_1001 conda-forge lame 3.100 h1de35cc_1001 conda-forge lapack 3.6.1 ha44fe06_2 conda-forge lazy-import 0.2.2 libcdms 3.1.2.2019.02.08.19.39.g8f1cefe hdc02c5d_0 cdat/label/nightly libcf 3.0.2018.06.27.19.10.g994aa30 py36h1de35cc_0 cdat/label/nightly libcurl 7.64.0 he376013_2 conda-forge libcxx 7.0.0 h2d50403_2 conda-forge libdrs 3.1.2.2019.02.08.17.22.g0c04b0c hdc02c5d_0 cdat/label/nightly libdrs_f 3.1.2.2019.02.08.17.22.g0c04b0c hdc02c5d_0 cdat/label/nightly libedit 3.1.20170329 hcfe32e1_1001 conda-forge libffi 3.2.1 h0a44026_1005 conda-forge libgfortran 3.0.1 0 conda-forge libiconv 1.15 h1de35cc_1004 conda-forge libnetcdf 4.6.2 h6b88ef6_1001 conda-forge libpng 1.6.36 ha441bb4_1000 conda-forge libsodium 1.0.16 h1de35cc_1001 conda-forge libssh2 1.8.0 hb1dc21d_1004 conda-forge libtiff 4.0.10 h79f4b77_1001 conda-forge llvm-meta 7.0.0 0 conda-forge markupsafe 1.1.1 py36h1de35cc_0 conda-forge mistune 0.8.4 py36h1de35cc_1000 conda-forge mkl 2019.1 144 mkl_fft 1.0.10 py36h1de35cc_1 conda-forge mkl_random 1.0.2 py36h1702cab_2 conda-forge mpi 1.0 mpich conda-forge mpich 3.2.1 h71abe9c_1008 conda-forge nb_conda 2.2.1 py36_0 conda-forge nb_conda_kernels 2.2.1 py36_0 conda-forge nbconvert 5.3.1 py_1 conda-forge nbformat 4.4.0 py_1 conda-forge nbgitpuller 0.6.1 ncurses 6.1 h0a44026_1002 conda-forge netcdf-fortran 4.4.5 h5ce9b53_1000 conda-forge nettle 3.4.1 h3efe00b_1002 conda-forge nodejs 11.10.0 h0a44026_0 conda-forge notebook 5.7.4 py36_1000 conda-forge numpy 1.15.4 py36hacdab7b_0 numpy-base 1.15.4 py36h6575580_0 openh264 1.8.0 hd9629dc_1000 conda-forge openssl 1.1.1b h1de35cc_0 conda-forge ossuuid 1.6.2 h0a44026_1000 conda-forge pandoc 2.6 1 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.3.4 py_0 conda-forge pexpect 4.6.0 py36_1000 conda-forge pickleshare 0.7.5 py36_1000 conda-forge pip 19.0.3 py36_0 conda-forge prometheus_client 0.6.0 py_0 conda-forge prompt_toolkit 2.0.9 py_0 conda-forge ptyprocess 0.6.0 py36_1000 conda-forge pycparser 2.19 py_0 conda-forge pygments 2.3.1 py_0 conda-forge pyopenssl 19.0.0 py36_0 conda-forge pyrsistent 0.14.11 py36h1de35cc_0 conda-forge pysocks 1.6.8 py36_1002 conda-forge python 3.6.7 h8dc6b48_1004 conda-forge python-dateutil 2.8.0 py_0 conda-forge pyzmq 18.0.0 py36h4cc6ddd_0 conda-forge readline 7.0 hcfe32e1_1001 conda-forge requests 2.21.0 py36_1000 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 40.8.0 py36_0 conda-forge sidecar 0.2.0 six 1.12.0 py36_1000 conda-forge sqlite 3.26.0 h1765d9f_1000 conda-forge terminado 0.8.1 py36_1001 conda-forge testpath 0.4.2 py36_1000 conda-forge tk 8.6.9 ha441bb4_1000 conda-forge tornado 5.1.1 py36h1de35cc_1000 conda-forge traitlets 4.3.2 py36_1000 conda-forge udunits2 2.2.27.6 h776b7f1_1001 conda-forge urllib3 1.24.1 py36_1000 conda-forge vcs 8.0.2019.02.27.01.58.gcdc8c04c py_0 cdat/label/nightly vtk-cdat 8.2.0rc2.8.1 py36h258435d_0 cdat/label/nightly wcwidth 0.1.7 py_1 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.33.1 py36_0 conda-forge widgetsnbextension 3.4.2 x264 1!152.20180717 h1de35cc_1001 conda-forge xz 5.2.4 h1de35cc_1001 conda-forge zeromq 4.2.5 h0a44026_1006 conda-forge zlib 1.2.11 h1de35cc_1004 conda-forge ```

Additional context Stack Trace:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-11-66c342ef4705> in <module>
----> 1 canvas.png("manual_test", provenance=True)

~/anaconda2/envs/jupyter-vcdat/lib/python3.6/site-packages/vcs-v8.0_56_gcdc8c04c-py3.7.egg/vcs/Canvas.py in png(self, file, width, height, units, draw_white_background, provenance, **args)
   4906             width, height, units, background=True)
   4907         if provenance is True:
-> 4908             provenance = cdat_info.generateProvenance(history=True)
   4909         if isinstance(provenance, dict):
   4910             metadata = args.get("metadata", {})

~/anaconda2/envs/jupyter-vcdat/lib/python3.6/site-packages/cdat_info-8.0-py3.7.egg/cdat_info/provenance.py in generateProvenance(extra_pairs, history)
     85     }
     86     # Actual environement used
---> 87     p = Popen(shlex.split("conda env export"), stdout=PIPE, stderr=PIPE)
     88     o,e = p.communicate()
     89     prov["conda"]["yaml"] = o.decode("utf-8")

~/anaconda2/envs/jupyter-vcdat/lib/python3.6/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
    707                                 c2pread, c2pwrite,
    708                                 errread, errwrite,
--> 709                                 restore_signals, start_new_session)
    710         except:
    711             # Cleanup if the child failed starting.

~/anaconda2/envs/jupyter-vcdat/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1342                         if errno_num == errno.ENOENT:
   1343                             err_msg += ': ' + repr(err_filename)
-> 1344                     raise child_exception_type(errno_num, err_msg, err_filename)
   1345                 raise child_exception_type(err_msg)
   1346 

FileNotFoundError: [Errno 2] No such file or directory: 'conda': 'conda'
doutriaux1 commented 5 years ago

@William-Hill how come you do not have conda. It might be because the newer conda does not have an actual conda binary (it's a function they inject in the bashrc)! Thanks for reporting this. I'll forward to cdat_info