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

jupytext command throws NameError: name '_' is not defined in a conda environment #75

Closed
bnjasim opened this issue Sep 12, 2018 · 4 comments

Comments

@bnjasim
Copy link

bnjasim commented Sep 12, 2018

jupytext is installed and the paired notebooks is working great. (As I update the notebook, the associated .py file is also updated automatically. cool!). But running any of the commands jupytext notebook.ipynb --to md --output - throws a NameError.

Here is the stacktrace:
Traceback (most recent call last): File "/home/binu.jasim/miniconda3/envs/pytorch/bin/jupytext", line 7, in <module> from jupytext.cli import jupytext File "/home/binu.jasim/miniconda3/envs/pytorch/lib/python3.6/site-packages/jupytext/__init__.py", line 26, in <module> from .contentsmanager import TextFileContentsManager File "/home/binu.jasim/miniconda3/envs/pytorch/lib/python3.6/site-packages/jupytext/contentsmanager.py", line 11, in <module> from notebook.services.contents.filemanager import FileContentsManager File "/home/binu.jasim/miniconda3/envs/pytorch/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 22, in <module> from .manager import ContentsManager File "/home/binu.jasim/miniconda3/envs/pytorch/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 39, in <module> class ContentsManager(LoggingConfigurable): File "/home/binu.jasim/miniconda3/envs/pytorch/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 73, in ContentsManager untitled_notebook = Unicode(_("Untitled"), config=True, NameError: name '_' is not defined

conda list shows:
# packages in environment at /home/binu.jasim/miniconda3/envs/pytorch: _nb_ext_conf 0.4.0 py36_1 alabaster 0.7.10 py36h306e16b_0 anaconda-client 1.6.14 py36_0 asn1crypto 0.24.0 py36_0 babel 2.5.3 py36_0 backcall 0.1.0 py36_0 bleach 2.1.3 py36_0 boto 2.49.0 <pip> boto3 1.9.0 <pip> botocore 1.12.0 <pip> bz2file 0.98 <pip> bzip2 1.0.6 h9a117a8_4 ca-certificates 2018.03.07 0 certifi 2018.4.16 py36_0 certifi 2018.8.24 <pip> cffi 1.11.5 py36h9745a5d_0 chardet 3.0.4 py36h0f667ec_1 clyent 1.2.2 py36h7e57e65_1 cmake 3.9.4 h142f0e9_0 colorama 0.3.9 <pip> cryptography 2.2.2 py36h14c3975_0 curl 7.59.0 h84994c4_0 cycler 0.10.0 py36h93f1223_0 cymem 1.31.2 <pip> cytoolz 0.9.0.1 <pip> dbus 1.13.2 h714fa37_1 decorator 4.3.0 py36_0 dill 0.2.8.2 <pip> docutils 0.14 py36hb0f60f5_0 en-core-web-sm 2.0.0 <pip> entrypoints 0.2.3 py36h1aec115_2 expat 2.2.5 he0dffb1_0 fontconfig 2.12.6 h49f89f6_0 fr-core-news-sm 2.0.0 <pip> freetype 2.8 hab7d2ae_1 gensim 3.5.0 <pip> gitdb2 2.0.4 <pip> GitPython 2.1.11 <pip> glib 2.56.1 h000015b_0 gmp 6.1.2 h6c8ec71_1 googletrans 2.3.0 <pip> gst-plugins-base 1.14.0 hbbd80ab_1 gstreamer 1.14.0 hb453b48_1 html5lib 1.0.1 py36h2f9c1c0_0 icu 58.2 h9c2bf20_1 idna 2.7 <pip> idna 2.6 py36h82fb2a8_1 imagesize 1.0.0 py36_0 intel-openmp 2018.0.0 8 ipykernel 4.8.2 py36_0 ipython 6.3.1 py36_0 ipython_genutils 0.2.0 py36hb52b0d5_0 ipywidgets 7.2.1 py36_0 jedi 0.12.0 py36_0 jinja2 2.10 py36ha16c418_0 jmespath 0.9.3 <pip> jpeg 9b h024ee3a_2 jsonschema 2.6.0 py36h006f8b5_0 jupyter-tensorboard 0.1.7 <pip> jupyter_client 5.2.3 py36_0 jupyter_core 4.4.0 py36h7c827e3_0 jupytext 0.6.4 <pip> kiwisolver 1.0.1 py36h764f252_0 libcurl 7.59.0 h1ad7b7a_0 libedit 3.1 heed3624_0 libffi 3.2.1 hd88cf55_4 libgcc-ng 7.2.0 hdf63c60_3 libgfortran-ng 7.2.0 hdf63c60_3 libpng 1.6.34 hb9fc6fc_0 libsodium 1.0.16 h1bed415_0 libssh2 1.8.0 h9cfc8f7_4 libstdcxx-ng 7.2.0 hdf63c60_3 libuv 1.20.0 h14c3975_0 libxcb 1.13 h1bed415_1 libxml2 2.9.8 hf84eae3_0 magma-cuda90 2.3.0 1 pytorch Markdown 2.6.11 <pip> markupsafe 1.0 py36hd9260cd_1 matplotlib 2.2.2 py36h0e671d2_1 mistune 0.8.3 py36h14c3975_1 mkl 2018.0.2 1 mkl-include 2018.0.2 1 mkl_fft 1.0.1 py36h3010b51_0 mkl_random 1.0.1 py36h629b387_0 mock 2.0.0 <pip> msgpack 0.5.6 <pip> msgpack-numpy 0.4.3.1 <pip> murmurhash 0.28.0 <pip> nb_anacondacloud 1.4.0 py36_0 nb_conda 2.2.1 py36h8118bb2_0 nb_conda_kernels 2.1.0 py36_0 nbconvert 5.3.1 py36hb41ffb7_0 nbdime 1.0.2 <pip> nbformat 4.4.0 py36h31c9010_0 nbpresent 3.0.2 py36h5f95a39_1 ncurses 6.0 h9df7e31_2 notebook 5.4.1 py36_0 numpy 1.14.2 py36hdbf6ddf_1 numpy 1.15.1 <pip> numpydoc 0.8.0 py36_0 openssl 1.0.2o h14c3975_1 packaging 17.1 py36_0 pandas 0.23.3 py36h04863e7_0 pandoc 1.19.2.1 hea2e7c5_1 pandocfilters 1.4.2 py36ha6701b7_1 parso 0.2.0 py36_0 pbr 4.2.0 <pip> pcre 8.42 h439df22_0 pexpect 4.5.0 py36_0 pickleshare 0.7.4 py36h63277f8_0 Pillow 5.1.0 <pip> pip 9.0.3 py36_0 plac 0.9.6 <pip> preshed 1.0.1 <pip> prompt_toolkit 1.0.15 py36h17d85b1_0 protobuf 3.6.0 <pip> ptyprocess 0.5.2 py36h69acd42_0 pycparser 2.18 py36hf9f622e_1 pygments 2.2.0 py36h0d3125c_0 pyopenssl 17.5.0 py36h20ba746_0 pyparsing 2.2.0 py36hee85983_1 pyqt 5.9.2 py36h751905a_0 pysocks 1.6.8 py36_0 python 3.6.5 hc3d631a_0 python-dateutil 2.7.3 <pip> python-dateutil 2.7.2 py36_0 pytz 2018.4 py36_0 PyYAML 3.13 <pip> pyyaml 3.12 py36hafb9ca4_1 pyzmq 17.0.0 py36h14c3975_0 qt 5.9.5 h7e424d6_0 readline 7.0 ha6073c6_4 regex 2017.4.5 <pip> requests 2.18.4 py36he2e5f8d_1 requests 2.19.1 <pip> rhash 1.3.5 hbf7ad62_1 s3transfer 0.1.13 <pip> scipy 1.1.0 <pip> sconce 0.0.2 <pip> send2trash 1.5.0 py36_0 sentencepiece 0.1.3 <pip> setuptools 39.0.1 py36_0 simplegeneric 0.8.1 py36_2 sip 4.19.8 py36hf484d3e_0 six 1.11.0 py36h372c433_1 smart-open 1.6.0 <pip> smmap2 2.0.4 <pip> snowballstemmer 1.2.1 py36h6febd40_0 spacy 2.0.12 <pip> sphinx 1.7.3 py36_0 sphinxcontrib 1.0 py36h6d0f590_1 sphinxcontrib-websupport 1.0.1 py36hb5cb234_1 sqlite 3.23.1 he433501_0 tensorboard 1.10.0 <pip> tensorboardX 1.2 <pip> terminado 0.8.1 py36_1 testfixtures 6.3.0 <pip> testpath 0.3.1 py36h8cadb63_0 thinc 6.10.3 <pip> tk 8.6.7 hc745277_3 toolz 0.9.0 <pip> torch 0.5.0a0+21e0fc8 <pip> torchfile 0.1.0 <pip> torchtext 0.3.0 <pip> tornado 5.0.2 py36_0 tqdm 4.23.0 py36_0 traitlets 4.3.2 py36h674d592_0 typing 3.6.4 py36_0 ujson 1.35 <pip> Unidecode 1.0.22 <pip> urllib3 1.23 <pip> urllib3 1.22 py36hbe7ace6_0 visdom 0.1.8.4 <pip> wcwidth 0.1.7 py36hdf4376a_0 webencodings 0.5.1 py36h800622e_1 websocket-client 0.48.0 <pip> Werkzeug 0.14.1 <pip> wheel 0.31.0 py36_0 widgetsnbextension 3.2.1 py36_0 wrapt 1.10.11 <pip> xz 5.2.3 h55aa19d_2 yaml 0.1.7 had09818_2 zeromq 4.2.5 h439df22_0 zlib 1.2.11 ha838bed_2

@grst
Copy link
Contributor

grst commented Sep 12, 2018

The problem is associated with an old version of the notebook package and can probably be fixed
by inserting

from notebook import transutils

in the code.

cf. rossant/ipymd#87

@bnjasim
Copy link
Author

bnjasim commented Sep 12, 2018

@grst Thanks. That solved it.

Edited the ~/miniconda3/envs/pytorch/lib/python3.6/site-packages/notebook/services/contents/manager.py file and added from notebook import transutils and it works now.

@bnjasim bnjasim closed this as completed Sep 12, 2018
mwouts added a commit that referenced this issue Sep 13, 2018
mwouts added a commit that referenced this issue Sep 13, 2018
@mwouts
Copy link
Owner

mwouts commented Sep 13, 2018

Thanks @bnjasim for reporting.

For some reason I had incorrectly changed the order of imports. This is now corrected in version 0.6.5.

@bnjasim , would you mind to

  1. revert the local change you mentionned above,
  2. test that your reproduce the issue,
  3. and then install the new version with
pip install jupytext==0.6.5

and confirm that the issue is gone? Thanks!

@bnjasim
Copy link
Author

bnjasim commented Sep 13, 2018

@mwouts Cool. It works now!

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

No branches or pull requests

3 participants