Jupyter notebook : Server Error while accessing notebooks - jupyter-notebook

I'm facing the following error while trying to upload or access any file in my Jupyter notebook. NOTE: I'm using an Ubuntu 18.04 VM and Jupyter Notebook 5.7.4.
Server error: Traceback (most recent call last): File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/tornado/web.py",
line 1592, in _execute result = yield result File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/tornado/gen.py",
line 1133, in run value = future.result() File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/tornado/gen.py",
line 326, in wrapper yielded = next(result) File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/notebook/services/contents/handlers.py",
line 112, in get path=path, type=type, format=format, content=content,
File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/notebook/services/contents/filemanager.py",
line 431, in get model = self._dir_model(path, content=content) File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/notebook/services/contents/filemanager.py",
line 337, in _dir_model if self.should_list(name) and not
is_file_hidden(os_path, stat_res=st): File
"/home/abhi1507/anaconda3/lib/python3.7/site-packages/notebook/utils.py",
line 146, in is_file_hidden_posix stat_res = os.stat(abs_path)
OSError: [Errno 40] Too many levels of symbolic links:
'/home/abhi1507/q3.sh' AD

Not sure if it is the same thing, but I suddenly had all my jupyter notebooks in new conda environments start breaking today. Eventually found this worked:
pip uninstall tornado
pip install tornado==5.1.1
Jupyter Notebooks and Tornado both released new versions in the past week (circa 2019-03-01) - I think one or both is the problem. If tornado doesn't work, I'd try the same idea but downgrading jupyter (or both).
Edit: Actual cause/fix described here. Can fix the issue by updating nbconvert to v5.4.1:
pip install --upgrade nbconvert

Related

Fresh Anaconda Navigator install, Jupyter notebook keeps showing connection error

I'm brand new to coding and have downloaded Anaconda to use Jupyter Notebook. However, I keep getting an error, cannot connect to network. I have looked around and tried a bunch of different fixes, none of which have worked. I've reinstalled Anaconda several times, tried opening Jupyter at ip=127.0.0.1 port=9999, VPN on and off. It's been a couple days now so I'm really hoping someone can help. Below is what shows up in Anaconda Prompt when I try to open a notebook. Not sure if it's related but Jupyter Notebook also won't launch from Anaconda Navigator, I HAVE to use Anaconda Prompt to launch it. I'm completely new to coding so any help would be greatly appreciated.
To access the notebook, open this file in a browser:
file:///C:/Users/Gerad%20Collingwood/AppData/Roaming/jupyter/runtime/nbserver-22504-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=2ef67e00adc18a197a353c6807983fc62bd1e5423a3788af
or http://127.0.0.1:8888/?token=2ef67e00adc18a197a353c6807983fc62bd1e5423a3788af`
`[I 11:22:50.281 NotebookApp] Creating new notebook in /Python Codes`
`Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)`
[I 11:22:53.527 NotebookApp] Kernel started: cd50ffe9-3bae-48a6-a2a7-9fccfdf64f3d, name: python3
`Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)`
`Exception in thread Thread-4:`
`Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)`
`Traceback (most recent call last):`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\threading.py", line 932, in _bootstrap_inner
self.run()`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\site-packages\ipykernel\iostream.py", line 78, in _thread_main
self.io_loop.start()`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
self.asyncio_loop.run_forever()`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\asyncio\base_events.py", line 1823, in _run_once
event_list = self._selector.select(timeout)`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)`
`File "C:\Users\Gerad Collingwood\anaconda3\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)`
`OSError: [WinError 10038] An operation was attempted on something that is not a socket

KeyError: 'PROJ_LIB' when trying to run a Python chunk in an Rmd

I think this is a basemap problem , but I really don't know how to fix it.
I tried do update Anaconda , reinstall basemap from there (root , miniconda and reticulate , from pip ...)
The error code is KeyError: 'PROJ_LIB'
Detailed traceback:
File "<string>", line 1, in <module>
File "/Library/Frameworks/R.framework/Versions/4.0/Resources/library/reticulate/python/rpytools/loader.py", line 24, in _import_hook
level=level
File "/Users/someone/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py", line 152, in <module>
pyproj_datadir = os.environ['PROJ_LIB']
File "/Users/someone/Library/r-miniconda/envs/r-reticulate/lib/python3.6/os.py", line 669, in __getitem__
raise KeyError(key) from None
I tried do update Anaconda , reinstall basemap from there (root , miniconda and reticulate , from pip ...)
I'm on MacOS Big Sur 11.1.

Building Plone.4-3.14 gives "need more than 0 values to unpack"

When running buildout with the Plone-4.3.14-version-configs, the errors below are thrown.
Getting distribution for 'feedparser==5.0.1'.
error: Not a recognized archive type: /tmp/tmpuOPdYIget_dist/feedparser-5.0.1.tar.bz2
An error occurred when trying to install /tmp/tmpuOPdYIget_dist/feedparser-5.0.1.tar.bz2. Look above this message for any errors that were output by easy_install.
While:
Installing instance.
Getting distribution for 'feedparser==5.0.1'.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/buildout.py", line 2127, in main
getattr(buildout, command)(args)
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/buildout.py", line 797, in install
installed_files = self[part]._call(recipe.install)
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/buildout.py", line 1557, in _call
return f()
File "/home/ida/.buildout/eggs/plone.recipe.zope2instance-4.2.22-py2.7.egg/plone/recipe/zope2instance/__init__.py", line 114, in install
installed.extend(self.install_scripts())
File "/home/ida/.buildout/eggs/plone.recipe.zope2instance-4.2.22-py2.7.egg/plone/recipe/zope2instance/__init__.py", line 618, in install_scripts
requirements, ws = self.egg.working_set(['plone.recipe.zope2instance'])
File "/home/ida/.buildout/eggs/zc.recipe.egg-1.3.2-py2.7.egg/zc/recipe/egg/egg.py", line 101, in working_set
**kw)
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/easy_install.py", line 924, in install
return installer.install(specs, working_set)
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/easy_install.py", line 726, in install
for dist in self._get_dist(req, ws):
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/easy_install.py", line 570, in _get_dist
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
File "/home/ida/.virtenv/lib/python2.7/site-packages/zc/buildout/easy_install.py", line 1704, in _move_to_eggs_dir_and_compile
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: need more than 0 values to unpack
Took a moment to figure out why, because the explanation does not lie in the last error-message, but the preceding one:
Not a recognized archive type, which hints that easy_install cannot handle bunzip-files.
It means that the required sys-package bzip-devel was not present when installing Python.
So one must either install that package and install Python again, or in this case also commenting out the pin for feedparser lets the build run without errors.
Afterwards noticed that feedparser is not in the eggs-cache-dir, as it used to be in another build with same versions-configs. At a glance cannot tell the difference why, but the errors are resolved.

Kernel Error in R Notebook using Jupyter Notebook

I am trying to use R within the jupyter notebook.
I went to my R shell and ran
install.packages(c('rzmq','repr','IRkernel','IRdisplay'),
repos = c('http://irkernel.github.io/', getOption('repos')))
IRkernel::installspec()
Then I loaded up my ipython notebook and created a new notebook using the now available R extension. How ever when I access the notebook I run into this kernal error:
Traceback (most recent call last):
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\base\handlers.py", line 394, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\sessions\handlers.py", line 53, in post
model = sm.create_session(path=path, kernel_name=kernel_name)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\sessions\sessionmanager.py", line 66, in create_session
kernel_name=kernel_name)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\kernels\kernelmanager.py", line 84, in start_kernel
kernel_name=kernel_name, **kwargs)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\multikernelmanager.py", line 112, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\manager.py", line 240, in start_kernel
**kw)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\manager.py", line 189, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\launcher.py", line 202, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\Nina Kate\Anaconda3\lib\subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "C:\Users\Nina Kate\Anaconda3\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I was having exactly the same error in Windows 7.
I added R to PATH environment variables and I was able to run it on shell but I was still having the kernel error in Jupyter.
The Kernel started working when installed system wide using:
IRkernel::installspec(user = FALSE)
instead of the first installation option:
IRkernel::installspec()
Note that it is necessary to set both parameters, the PATH variable and the R system wide install.
You probably missed the warning up top about a missing index in the irkernel repo:
Warning: unable to access index for repository http://irkernel.github.io/src/contrib:
cannot download all files
The new installation steps worked for me (in R 3.3 console):
install.packages('devtools')
devtools::install_github('IRkernel/IRkernel') # IRkernel-master.tar.gz
IRkernel::installspec() # register kernel in the current R install
IRkernel::installspec(name = 'ir33', displayname = 'R 3.3') # ir32, R 3.2
When you restart jupyter notebook, an "R 3.3" entry should appear in the list of kernels.
If using Windows 10 and not using Anaconda, then try this;
Review your existing kernel file with Notepad. File is located:
~ AppData\Roaming\Jupyter\kernels
This file will show the version of R that was used when Jupyter was installed. If you changed or upgraded the version of R currently being used, then R Kernel will not work in Jupyter.
R Studio -> Tools -> Global Options -> Change , to review versions of R installed on PC. If the current version of R is different than the version in the kernel file, select that other version of R. Close R Studio and reopen to verify version being used. Close R Studio and open Jupyter Notebook and select the R kernel. R kernel should now work.

Plone 4.3 AssertionError Running Buildout

We recently got a new Linux machine that got re-imaged from our older machine where our current plone installation resides. I am trying to run buildout on the new machine but I am getting this AssertionError on our plonetheme src product.
Installing 'buildout.dumppickedversions', 'buildout.sanitycheck'.
We have the distribution that satisfies 'buildout.dumppickedversions==0.5'.
Picked: buildout.sanitycheck = 1.0b1
Develop: '/var/db/zope/plone43/zeocluster/src/products.okctypes'
in: '/var/db/zope/plone43/zeocluster/src/products.okctypes'
/tmp/tmpVPeu_l -q develop -mxN -d /var/db/zope/plone43/zeocluster/develop-eggs/tmp4eer1vbuild
Develop: '/var/db/zope/plone43/zeocluster/src/plonetheme.ourtheme'
in: '/var/db/zope/plone43/zeocluster/src/plonetheme.ourtheme'
/tmp/tmppWGq8Z -q develop -mxN -d /var/db/zope/plone43/zeocluster/develop-eggs/tmpUl2ukSbuild
No local packages or download links found for PasteScript
Traceback (most recent call last):
File "/tmp/tmppWGq8Z", line 11, in <module>
execfile('/var/db/zope/plone43/zeocluster/src/plonetheme.ourtheme/setup.py')
File "/var/db/zope/plone43/zeocluster/src/plonetheme.ourtheme/setup.py", line 37, in <module>
paster_plugins=["ZopeSkel"],
File "/var/db/zope/plone43/Python-2.7/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 580, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 825, in best_match
return self.obtain(req, installer) # try and download/install
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 837, in obtain
return installer(requirement)
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 294, in fetch_build_egg
return cmd.easy_install(req)
File "/var/db/zope/plone43/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/setuptools/command/easy_install.py", line 592, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('PasteScript')
While:
Installing.
Processing develop directory '/var/db/zope/plone43/zeocluster/src/plonetheme.ourtheme'.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/var/db/zope/plone43/buildout-cache/eggs/zc.buildout-1.7.1-py2.7.egg/zc/buildout/buildout.py", line 1866, in main
getattr(buildout, command)(args)
File "/var/db/zope/plone43/buildout-cache/eggs/zc.buildout-1.7.1-py2.7.egg/zc/buildout/buildout.py", line 487, in install
installed_develop_eggs = self._develop()
File "/var/db/zope/plone43/buildout-cache/eggs/zc.buildout-1.7.1-py2.7.egg/zc/buildout/buildout.py", line 727, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/var/db/zope/plone43/buildout-cache/eggs/zc.buildout-1.7.1-py2.7.egg/zc/buildout/easy_install.py", line 1184, in develop
*args) == 0
AssertionError
*************** PICKED VERSIONS ****************
[versions]
*************** /PICKED VERSIONS ***************
Our Product's init.py script contains the following:
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
I've seen a similar error reported here but the answer provided does not apply to our case. We have other products in src but this is the only one causing problems.
Can someone please help us with this error?
Check the setup.py file in your theme package. You'll likely find:
# The next two lines may be deleted after you no longer need
# addcontent support from paster and before you distribute
# your package.
setup_requires=["PasteScript"],
paster_plugins = ["ZopeSkel"],
Remove those lines. They are included in the generated template for your package so that you may use Zopeskel local commands to add new functionality. You don't need it after development, and it's often a source of problems later.
The alternative solution, as mentioned in the comments, is to make sure you have the right egg in your local buildout cache. But why have old development packages sitting around on a live site?

Resources