I'm having trouble running jupyter nbconvert.
It always shows the following error trace (even with a notebook with a few vanilla cells)
Traceback (most recent call last):
File "/home/miguel/.virtualenvs/ipython/bin/jupyter-nbconvert", line 11, in <module>
sys.exit(main())
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/traitlets/config/application.py", line 596, in launch_instance
app.start()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 293, in start
self.convert_notebooks()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 447, in convert_notebooks
self.exporter = cls(config=self.config)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/templateexporter.py", line 151, in __init__
super(TemplateExporter, self).__init__(config=config, **kw)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 101, in __init__
self._init_preprocessors()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 250, in _init_preprocessors
self.register_preprocessor(preprocessor, enabled=True)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 211, in register_preprocessor
preprocessor_cls = import_item(preprocessor)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
TypeError: Item in ``from list'' not a string
It might be related with the nbextensions which I recently installed, since some days ago the jupyter nbconvert command used to work perfectly.
Today, I've been having some trouble installing the nbextensions. I tried using conda, but finally the it worked when I followed the instructions from here.
I had the same problem today. It seems this is a bug in nbconvert, as documented here. The solution is to edit your "jupyter_nbconvert_config.json" file. For me, this was located in my home directory by default: /home/me/.jupyter/jupyter_nbconvert_config.json
There, I changed the preprocessor strings, adding an "r" in front of them:
{
"Exporter": {
"template_path": [
".",
"/usr/lib/python2.7/site- packages/jupyter_contrib_nbextensions/templates"
],
"preprocessors": [
r"jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor",
r"jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor"
]
},
"NbConvertApp": {
"postprocessor_class": "jupyter_contrib_nbextensions.nbconvert_support.EmbedPostProcessor"
},
"version": 1
}
Found a solution here.
Basically, you need to remove or rename your jupyter_nbconvert_config file.
This bug was fixed recently, see the details here. Run a full update for ipython or, to fix manually:
change line 31 in your ipython_genutils/importstring.py from
module = __import__(package, fromlist=[obj])
to
module = __import__(package, fromlist=[str(obj)])
Related
I am trying to generate HTML docs using meson build. I used gnome.gtkdoc() method for this from meson build system.
Following is my meson.build file
project('mydoc', 'c',
version: '0.1.0')
gnome = import('gnome')
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
content_files = [
'docbook-mydoc.xml',
]
gnome.gtkdoc('mydoc',
main_xml : 'main-doc.xml',
src_dir : [
join_paths(meson.source_root())
],
fixxref_args: [
'--html-dir=' + (gnome.gtkdoc_html_dir(meson.project_name())),
'--extra-dir=#0#'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=#0#'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=#0#'.format(join_paths(glib_docpath, 'gio')),
],
content_files: content_files,
install : true,
install_dir: join_paths(meson.source_root(), 'doc')
)
Above meson.build works fine and can generates HTML pages. I have problem when running above meson.build in Yocto. It gives me Permission denied error while do_install operation.
ERROR: ['gtkdoc-mkhtml', '--path=/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/git/:/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/build/', 'mydoc', '../main-doc.xml'] failed with status 1
Traceback (most recent call last):
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/bin/gtkdoc-mkhtml", line 51, in <module>
sys.exit(mkhtml.run(options))
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/share/gtk-doc/python/gtkdoc/mkhtml.py", line 93, in run
quiet] + remaining_args + [gtkdocdir + '/gtk-doc.xsl', document])
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/share/gtk-doc/python/gtkdoc/mkhtml.py", line 42, in run_xsltproc
return subprocess.call(command + args)
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "/home/user/yocto/build-zeus/tmp/work/cortexa7t2hf-neon-fslc-linux-gnueabi/mydoc/1.0.0-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: ''
I am not sure why its gave me permission denied error. Any help will be appreciated.
It's a bit suspicious that you are trying to install into source root directory with
install_dir: join_paths(meson.source_root(), 'doc')
Typically, it's just directory name relative to gtk-doc html dir (gnome.gtkdoc_html_dir()) or not set at all - then directory is module
name. So try just remove it...
Update
You might be missing prefix for project html dir (for --html-dir )and it should look like:
'--html-dir=' + join_paths(get_option('prefix'), gnome.gtkdoc_html_dir(meson.project_name()),
Note. And instead of generating gtk doc path, it should be more reliable to use above mentioned function:
'--extra-dir=' + join_paths(glib_prefix, gnome.gtkdoc_html_dir('glib')),
...
In an older version of Dash, I used to need to be able to say,
supress_callback_exceptions = True
Since I upgraded to the new version of Dash, now I get an error on that line:
Traceback (most recent call last):
File "dash-yahoo_options.py", line 2109, in <module>
app.config.supress_callback_exceptions = True
File "/home/idf/anaconda3/envs/dash_apps_36/lib/python3.7/site-packages/dash/_utils.py", line 81, in __setattr__
self[key] = value
File "/home/idf/anaconda3/envs/dash_apps_36/lib/python3.7/site-packages/dash/_utils.py", line 106, in __setitem__
raise AttributeError(final_msg, key)
AttributeError: ('Invalid config key. Some settings are only available via the Dash constructor', 'supress_callback_exceptions')
(dash_apps_36) idf#ubvm:~/Downloads$ vi dash-yahoo_options.py
(dash_apps_36) idf#ubvm:~/Downloads$ python dash-yahoo_options.py
Traceback (most recent call last):
File "dash-yahoo_options.py", line 2109, in <module>
app.config.supress_callback_exceptions = True
File "/home/idf/anaconda3/envs/dash_apps_36/lib/python3.7/site-packages/dash/_utils.py", line 81, in __setattr__
self[key] = value
File "/home/idf/anaconda3/envs/dash_apps_36/lib/python3.7/site-packages/dash/_utils.py", line 106, in __setitem__
raise AttributeError(final_msg, key)
AttributeError: ('Invalid config key. Some settings are only available via the Dash constructor', 'supress_callback_exceptions')
In case you missed it in the Dash change log, this misspelled fallback was removed in 1.0.0.
The configuration attribute should still supported (as at 1.6.0), you just need to use the right name.
app.config.suppress_callback_exceptions = True
I am new to psychopy and I have written a small piece of code to display fixation point. Everything works fine, if I do not set the option "stereo=True" or "stereo=False"
But the moment I set "stereo=True", it fails with exception
"stereo=True fails with exception "pyglet.window.NoSuchConfigException"
What am I missing here? Any help would be very appreciated.
I need to use this to supports quad buffers.
Complete error:
Traceback (most recent call last): File "fixiation.py", line 3, in
win = visual.Window([1920, 1080], screen=1, units='pix', fullscr=True, stereo=True)#monitor='DVI-I-1', units='pix',
fullscr=True) File
"/usr/lib/python2.7/dist-packages/psychopy/visual/window.py", line
325, in init
self._setupGL() File "/usr/lib/python2.7/dist-packages/psychopy/visual/window.py", line
1425, in _setupGL
self._setupPyglet() File "/usr/lib/python2.7/dist-packages/psychopy/visual/window.py", line
1286, in _setupPyglet
style=style) File "/usr/lib/pymodules/python2.7/pyglet/window/xlib/init.py", line
474, in init
super(XlibWindow, self).init(*args, kwargs) File "/usr/lib/pymodules/python2.7/pyglet/window/__init__.py", line 645, in
__init__
config = screen.get_best_config(config) File "/usr/lib/pymodules/python2.7/pyglet/window/__init__.py", line 291, in
get_best_config
raise NoSuchConfigException()
**pyglet.window.NoSuchConfigException Exception AttributeError: "'Window' object has no attribute 'useNativeGamma'" in > ignored
Here is the sample code
from psychopy import visual, event
win = visual.Window([1920, 1080], screen=1, units='pix', fullscr=True, stereo=True)
fixation = visual.GratingStim(win=win, size=10, pos=[0,0], sf=0, units='pix')
while True:
fixation.draw()
win.update()
if len(event.getKeys()) >0:
break
event.clearEvents()
win.close()
I am trying to setup django-pipeline in my test project, however, I am running into a bug which doesn't have an obvious solution. Here is the pipeline configure in the settings.py
PIPELINE = {
'PIPELINE_ENABLED': True,
'COMPILERS': ('pipeline_browserify.compiler.BrowserifyCompiler', ),
'CSS_COMPRESSOR': 'pipeline.compressors.NoopCompressor',
'JS_COMPRESSOR': 'pipeline.compressors.uglifyjs.UglifyJSCompressor',
'STYLESHEETS': {
# 'animelist_css': {
# 'source_filenames': ( 'animelist/css/style.css', ),
# 'output_filename': 'animelist/css/animelist_css.css',
# }
},
'JAVASCRIPT': {
# 'animelist_js': {
# 'source_filenames': (
# 'animelist/js/bower_components/jquery/dist/jquery.min.js',
# 'animelist/js/bower_components/react/JSXTransformer.js',
# 'animelist/js/bower_components/react/react-with-addons.js',
# 'animelist/js/app.browserify.js',
# ),
# 'output_filename': 'animelist/js/animelist_js.js',
# }
}
}
As you can see from the configuration, this setting will allow collectstatic to run without any problem. However, collectstatic will fail if I were to uncomment those lines. The error is shown below
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/anime/static
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site- packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/storage.py", line 33, in post_process
packager.pack_javascripts(package)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 112, in pack_javascripts
return self.pack(package, self.compressor.compress_js, js_compressed, templates=package.templates, **kwargs)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 105, in pack
paths = self.compile(package.paths, force=True)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 99, in compile
return self.compiler.compile(paths, force=force)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 49, in compile
from concurrent import futures
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/_base.py", line 355
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
Help is greatly appreciated.
Apparently, the error is the result of installing futures backport in pip3. Simply uninstall futures packages in your pip3.
I am trying to use a TokenInputTransformer within an IPython extension module, but it seems that there is something wrong with the standard implementation of token transformers with multiline input. Consider the following minimal extension:
from IPython.core.inputtransformer import TokenInputTransformer
#TokenInputTransformer.wrap
def test_transformer(tokens):
return tokens
def load_ipython_extension(ip):
for s in (ip.input_splitter, ip.input_transformer_manager):
s.python_line_transforms.extend([test_transformer()])
print "Test activated"
When I load the extension in IPython 1.1.0 I get a non-handled exception with multiline input:
In [1]: %load_ext test
Test activated
In [2]: abs(
...: 2
...: )
Traceback (most recent call last):
File "/Applications/anaconda/bin/ipython", line 6, in <module>
sys.exit(start_ipython())
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 545, in launch_instance
app.start()
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 362, in start
self.shell.mainloop()
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 436, in mainloop
self.interact(display_banner=display_banner)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 548, in interact
self.input_splitter.push(line)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/core/inputsplitter.py", line 620, in push
out = self.push_line(line)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/core/inputsplitter.py", line 655, in push_line
line = transformer.push(line)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/core/inputtransformer.py", line 152, in push
return self.output(tokens)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/core/inputtransformer.py", line 157, in output
return untokenize(self.func(tokens)).rstrip('\n')
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/utils/_tokenize_py2.py", line 276, in untokenize
return ut.untokenize(iterable)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/utils/_tokenize_py2.py", line 214, in untokenize
self.add_whitespace(start)
File "/Applications/anaconda/lib/python2.7/site-packages/IPython/utils/_tokenize_py2.py", line 199, in add_whitespace
assert row >= self.prev_row
AssertionError
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev#scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True
Am I doing something wrong or is it really an IPython bug?
It is really an IPython bug, I think. Specifically, the way we handle tokenize fails when an expression involving brackets (()[]{}) is spread over more than one line. I'm trying to work out what we can do about this.
Kinda late answer but, I was trying to use it in my own extension and just had the same problem. I've solved it by simply removing NL from the list (it's not the same as NEWLINE token which end statement), NL token only appears inside [], (), {} so it should be safely removable.
from tokenize import NL
#TokenInputTransformer.wrap
def mat_transformer(tokens):
tokens = list(filter(lambda t: t.type != NL, tokens))
return tokens
If you are looking for full example, I've posted my goofy code there: https://github.com/Quinzel/pymat