jupyter-incubator / contentmanagement

Jupyter Content Management Extensions
Other
78 stars 26 forks source link

Cannot import notebook #58

Open dschien opened 7 years ago

dschien commented 7 years ago

Hi

The most recent version of CMS seems broken.

I fail to import notebooks.

I have a small notebook mylib.ipynb

# <api>
var = 1

And a notebook importing:

%load_ext jupyter_cms
from mylib import *

When running this, I get

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-fa824d3044c3> in <module>()
      1 get_ipython().magic('load_ext jupyter_cms')
----> 2 from mylib import *

ModuleNotFoundError: No module named 'mylib'

OSX

Pristine virtual env Python 3.6.1

CMS installed according to instructions

pip install jupyter_cms
jupyter cms quick-setup --sys-prefix

Dependency versions:

appdirs==1.4.3
appnope==0.1.0
bleach==2.0.0
cycler==0.10.0
decorator==4.0.11
entrypoints==0.2.2
et-xmlfile==1.0.1
excel-modelling-helper==0.3.3
html5lib==0.999999999
ipykernel==4.6.1
ipython==6.0.0
ipython-genutils==0.2.0
ipywidgets==6.0.0
jdcal==1.3
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.0.1
jupyter-cms==0.7.0
jupyter-console==5.1.0
jupyter-core==4.3.0
MarkupSafe==1.0
matplotlib==2.0.2
mistune==0.7.4
nbconvert==5.1.1
nbformat==4.3.0
notebook==5.0.0
numpy==1.12.1
openpyxl==2.4.7
packaging==16.8
pandas==0.20.1
pandocfilters==1.4.1
pexpect==4.2.1
pickleshare==0.7.4
prompt-toolkit==1.0.14
ptyprocess==0.5.1
Pygments==2.2.0
pyparsing==2.2.0
pyspark==2.1.0+hadoop2.7
python-dateutil==2.6.0
pytz==2017.2
pyzmq==16.0.2
qtconsole==4.3.0
scipy==0.19.0
simplegeneric==0.8.1
six==1.10.0
terminado==0.6
testpath==0.3
tornado==4.5.1
traitlets==4.3.2
wcwidth==0.1.7
webencodings==0.5.1
Whoosh==2.7.4
widgetsnbextension==2.0.0
xarray==0.9.5
xlrd==1.0.0
parente commented 7 years ago

Are you running multiple notebook servers or have any runtime notebook server metadata lurking in your home directory? jupyter --paths can tell you what runtime directories to check. The files would look like:

-rw-r--r-- 1 parente staff 274 Feb 18 12:52 nbserver-41581.json

The reason I ask is because the extension uses the first one of those config files it finds to determine what root path to use for imports. It's flaky and should at least be written up as a release note here in the README.

Also, you might want to check out https://github.com/ipython/ipynb which has a different implementation of the importing feature and isn't in incubator.

dschien commented 7 years ago

Thanks for the reply. I did have a whole bunch of nbserver-* files. I removed those but without any effect on CMS.

Thanks for the pointer to the ipynb package. That will allow me to continue with my project. Still a real shame the CMS broke on my system... anything else I can do to diagnose?

parente commented 7 years ago

The nbserver files have been the culprit in the past. Did you restart the live notebook server after the cleanup?

I'll try to reproduce here with the latest version.

dschien commented 7 years ago

Restarted but without effect. Thanks