Jupyter notebook ValueError: Unable to configure formatter 'console' - jupyter-notebook

I installed Django in a virtual environment. However, the nb_conda gets an error in another virtual env.
I tried to reinstall the nb_conda, and the error message output is:
Enabling: nb_conda
- Writing config: /home/run/.miniconda3/envs/d2l/etc/jupyter
- Validating...
nb_conda 2.2.1 OK
Exception ignored in: <function Application.__del__ at 0x7fa35ad9c3a0>
Traceback (most recent call last):
File "/home/run/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 955, in __del__
File "/home/run/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 945, in close_handlers
File "/home/run/.local/lib/python3.8/site-packages/traitlets/traitlets.py", line 683, in __get__
File "/home/run/.local/lib/python3.8/site-packages/traitlets/traitlets.py", line 657, in get
File "/home/run/.local/lib/python3.8/site-packages/traitlets/traitlets.py", line 1428, in _notify_observers
File "/home/run/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 273, in _observe_logging_default
File "/home/run/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 278, in _configure_logging
File "/home/run/.miniconda3/envs/d2l/lib/python3.8/logging/config.py", line 808, in dictConfig
File "/home/run/.miniconda3/envs/d2l/lib/python3.8/logging/config.py", line 545, in configure
ValueError: Unable to configure formatter 'console'

Apparently this is a traitlets defect:
https://github.com/ipython/traitlets/issues/722
That has been solved using patch 727
https://github.com/ipython/traitlets/pull/727
So updating traitlets may solved the issue
It did for I when trying to enbale jupytext:
jupyter serverextension enable jupytext
was showing the same error, doing
mamba/conda update traitlets solved the issue by updating traitlets from 5.2 to 5.3

Related

Read the Docs with nbsphinx

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.

Jupyter Notebook: Kernel Error on the Right

I have just installed Anaconda and run Jupyter Notebook through command line by using jupyter notebook command. However, I am facing an issue. On the top right, I see Kernel Error.
When I click on Kernel Error, I see these lines:
Traceback (most recent call last):
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 158, in start_kernel
km.start_kernel(**kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 301, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 248, in pre_start_kernel
self.write_connection_file()
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 474, in write_connection_file
kernel_name=self.kernel_name
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 138, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\jupyter_core\paths.py", line 424, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Shawn\AppData\Roaming\Python\Python37\site-packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: %1 is not a valid Win32 application.
I can't run any Python code on Jupyter Notebook, as I am continuing to get that error.
I have gone through numerous threads on Stack Overflow for several hours. But I can't fix the issue.
Please, help me to solve the issue. I am doing a course on Data Scince with Python. I can't move forward without fixing this issue.
Update 1:
I have visited this Github thread and tried using the following command:
conda install -c conda-forge pywin32
conda install -c anaconda jupyter_client
conda install -c conda-forge jupyter_core
pip install --upgrade pywin32==224
However, the issue is not fixed. Instead, I am getting a new error,
ImportError: DLL load failed: The specified procedure could not be found.
This is really frustrating!
try this way, i fixed my jupyter.
same error site-packages\tornado
command
jupyter kernelspec list
from the shown result
Available kernels:
python3 D:\Programs\Anaconda3\share\jupyter\kernels\python3
open the folder, and edit kernel.json
{
"argv": [
"D:\\Programs\\Anaconda3\\python.exe", //change to your correct path
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
restart jupyter, and it will be ok.
Did you try opening the anaconda navigator from terminal and then create an environment their and install the jupyter notebook in that environment and then open the jupyter notebook from the navigator
Alright. I have managed to fix the issue. I have to write these commands:
conda install -c conda-forge pywin32
conda install -c anaconda jupyter_client
conda install -c conda-forge jupyter_core
pip install --upgrade pywin32==224
Then I got an error.
import win32api pywin32
ImportError: DLL load failed: The specified procedure could not be found.
I solve the issue by writing this command that I got from this github thread:
conda install pywin32
Now, the issue has been completely fixed!

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.

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

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