Read the Docs with nbsphinx - restructuredtext

I created my own docs for Read the Docs. See my repository
Some of my docs files are jupyter notebook so I used nbshpinx for it.
In my computer I installed all the dependencies and it works great when I use make html.
However, Read the docs throws the error:
Running Sphinx v1.8.5
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
mod = __import__(extname, None, None, ['setup'])
ModuleNotFoundError: No module named 'nbsphinx'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 475, in load_extension
raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension nbsphinx (exception: No module named 'nbsphinx')
Extension error:
Could not import extension nbsphinx (exception: No module named 'nbsphinx')
Following this tutorial I created two yml files and the error changed to:
Error
Problem in your project's configuration. Invalid "conda.environment": environment not found

Solved it!
I followed this tutorial
I added in readthedocs.yml:
python:
version: 3
install:
- requirements: docs/requirements.txt
system_packages: true
And then in docs/requirements.txt:
ipykernel
nbsphinx
If questions you can always check the repository where I do it.

Related

iprof and iprof_totals profiling error

I get this error after trying :
openmdao iprof x.py
or
openmdao iprof_totals x.py
on my terminal. Any idea why it could be? Do we have a simple sample code where the iprof works smoothly.
Traceback (most recent call last):
File "/home/user/miniconda3/bin/openmdao", line 11, in
sys.exit(openmdao_cmd())
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/utils/om.py", line 403, in openmdao_cmd
options.executor(options)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 373, in _iprof_totals_exec
_iprof_py_file(options)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 429, in _iprof_py_file
_finalize_profile()
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 183, in _finalize_profile
qfile, qclass, qname = find_qualified_name(filename, int(line), cache, full=False)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprof_utils.py", line 73, in find_qualified_name
with open(filename, 'Ur') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'packages/openmdao/jacobians/jacobian.py'
I looked into this and there is currently a bug when using 'openmdao iprof' and 'openmdao iprof_totals' on a version of OpenMDAO that was not installed from an OpenMDAO repository using 'pip install -e'. I put a story in our bug tracker to fix it.

How to add a custom parser to logster?

I want to track the HTTP response codes returned by my nginx web-server, using logster.
1) I found and installed logster. I also pip-installed pygtail, which is required for logster.
https://github.com/etsy/logster
2) I found a python script that parses nginx access_log and placed it in the parsers subdir.
https://github.com/metabrainz/logster/blob/master/musicbrainz/logster/NginxStatus.py
...but when I run the logster command, I get a python exception:
Traceback (most recent call last):
File "/usr/local/bin/logster", line 5, in <module>
pkg_resources.run_script('logster==0.0.1', 'logster')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 505, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1245, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 449, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 380, in main
module = __import__(module_name, globals(), locals(), [parser_name])
ImportError: No module named NginxStatus1
````
What am I doing wrong?
The exception error was rather misleading: the file was placed in the right place (the parsers subdir), but - as it turns out- logster must be re-setup after a new parser is added (this isn't documented, unfortunately). so just run:
sudo python setup.py install
in the logster directory and things should start working correctly.

Syntax Error running bin/buildout on Plone 3.2.3

I get the folowing error when I run bin/buildout.
I´ve check this issue here on Plone.org and they say that it ´s not dangerous
but they do not say how to resolve it.
I want to skip this error in order to execute bin/buildout withouth errors, til now I´m updating my products manually. How can I solve this?
root#sevilla2:/var/plone/zinstance# bin/buildout
While:
Installing.
Getting section precompile.
Initializing section precompile.
Loading zc.buildout recipe entry plone.recipe.precompiler:default.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 1509, in main
getattr(buildout, command)(args)
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 357, in install
[self[part]['recipe'] for part in install_parts]
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 888, in __getitem__
options._initialize()
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 969, in _initialize
recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
File "/var/plone/buildout-cache/eggs/zc.buildout-1.1.2-py2.4.egg/zc/buildout/buildout.py", line 932, in _install_and_load
return pkg_resources.load_entry_point(
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 277, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 2180, in load_entry_point
return ep.load()
File "/var/plone/buildout-cache/eggs/setuptools-0.6c9-py2.4.egg/pkg_resources.py", line 1913, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/var/plone/buildout-cache/eggs/plone.recipe.precompiler-0.6-py2.4.egg/plone/recipe/precompiler/__init__.py", line 7, in ?
from pythongettext.msgfmt import Msgfmt
File "/var/plone/buildout-cache/eggs/python_gettext-2.1-py2.4.egg/pythongettext/msgfmt.py", line 265
except Exception as msg:
^
SyntaxError: invalid syntax
I came from a migration of my site (successfully completed but builded without buildout)
Plone 3.2.3
CMF 2.1.2 Zope (Zope 2.10.7-final, python 2.4.5, linux2)
Python 2.4.5 [GCC 4.4.5]
PIL 1.1.6
You'll need to pin python-gettext to use a version before version 2.0. That version introduced syntax that requires Python 2.6 or newer (to make the package work on Python 3 as well).
In your buildout versions section, add:
python-gettext = 1.2

How to compile Google Closure code in modules using closure_builder.py?

How can I compile Google Closure code in multiple modules using closure_builder.py?
I tried this command:
python closurebuilder.py
--root closure/closure-library
--root closure/client
--namespace="client.start"
--output_mode=compiled
--compiler_jar=compiler.jar
--output_file closure/compiled.js
--compiler_flags=--compilation_level=ADVANCED_OPTIMIZATIONS
--compiler_flags=--module base:1
--compiler_flags=--js=closure/modules/base.js
--compiler_flags=--module editor:1
--compiler_flags=--js=closure/modules/editor.js
--compiler_flags=--module maps:1
--compiler_flags=--js=closure/modules/maps.js
--compiler_flags=--module uploader:1
--compiler_flags=--js=closure/modules/uploader.js
--compiler_flags=--module visualization:1
--compiler_flags=--js=closure/modules/visualization.js
--compiler_flags=--output_wrapper="(function() {%output%})();"
But the following error is thrown:
closurebuilder.py: Scanning paths...
Traceback (most recent call last):
File "closurebuilder.py", line 256, in <module>
main()
File "closurebuilder.py", line 196, in main
sources.add(_PathSource(js_path))
File "closurebuilder.py", line 167, in __init__
super(_PathSource, self).__init__(source.GetFileContents(path))
File "source.py", line 110, in GetFileContents
fileobj = open(path)
IOError: [Errno 2] No such file or directory: 'base:1'
I actually just ran into a similar issue, except that it wasn't 'base:1' but 'Files'. Turns out, i was executing the script from C:\Program Files (x86)... and those extra spaces messed with the Closure script and how it resolves JS files.
Executing it from a path with no space solved it, hope you can fix it as well, maybe try adding quotes over arguments
Fabien

plone Assertion error in themes

Iam new to Plone. I installed Plone 4 and i have gone through http://noenieto.com/blog/theming-plone-4 and created theme product.
When i run ./bin/buildout,
iam getting the error as
Develop: '/usr/local/Plone/zinstance/src/plonetheme.hanging'
error in plonetheme.hanging setup command: Distribution contains no modules or packages for namespace package 'plonetheme'
While:
Installing.
Processing develop directory '/usr/local/Plone/zinstance/src/plonetheme.hanging'.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 1683, in main
getattr(buildout, command)(args)
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 417, in install
installed_develop_eggs = self._develop()
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 657, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/usr/local/Plone/buildout-cache/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/easy_install.py", line 895, in develop
*args) == 0
AssertionError
Can anyone help me to rectify this error?
Create a module or package for namespace package 'plonetheme', e.g.:
mkdir -p src/plonetheme.hanging/plonetheme/hanging
touch src/plonetheme.hanging/plonetheme/__init__.py
touch src/plonetheme.hanging/plonetheme/hanging/__init__.py
src/plonetheme.hanging/plonetheme/__init__.py should contain something like:
from pkg_resources import declare_namespace
declare_namespace(__name__)

Resources