Issues in running ipython notebook on Windows Xp - python

I have a 32 bit WinXP system that used to run ipython notebook just fine under the Miniconda distribution (Python 3.4). But recently, when I start the ipython notebook interface in the browser I get a kernel error. The console shows a ZMQError. However, I have no issue working from the ipython console or even from inside PyCharm IDE, where python works fine. I am using a virtual environment, and the details about the error are given below:
Traceback (most recent call last):
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\notebook\base\handlers.py", line 436, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\notebook\services\sessions\handlers.py", line 56, in post
model = sm.create_session(path=path, kernel_name=kernel_name)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 66, in create_session
kernel_name=kernel_name)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 84, in start_kernel
**kwargs)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel
km.start_kernel(**kwargs)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\jupyter_client\manager.py", line 241, in start_kernel
self._connect_control_socket()
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\jupyter_client\manager.py", line 192, in _connect_control_socket
self._control_socket = self.connect_control()
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\jupyter_client\connect.py", line 445, in connect_control
return self._create_connected_socket('control', identity=identity)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\jupyter_client\connect.py", line 417, in _create_connected_socket
sock = self.context.socket(socket_type)
File "F:\Miniconda3\envs\mltestbed\lib\site-packages\zmq\sugar\context.py", line 143, in socket
s = self._socket_class(self, socket_type)
File "zmq/backend/cython/socket.pyx", line 281, in zmq.backend.cython.socket.Socket.__cinit__ (zmq\backend\cython\socket.c:3220)
zmq.error.ZMQError: Connection refused
In need of help as my system contains a lot of code that would be difficult to port.

I am not sure if this helps you, but there seems to be a similar error experienced by some spyder users. This goes back to a problem in binding to a random port for the notebook server using ZeroMQ (see here). The bug in question seems to be fixed in ZeroMQ, but I am not sure if it has made it's way to the other packages you are using.
You could try to update the version of ipython-notebook you are using:
$ conda update ipython-notebook
and if this doesn't work you could fall back to an older version. Try creating a new environment with an older version to keep your (hopefully soon repaired) environment intact:
$ conda create -n fallback ipython-notebook=3 python=3.4
I hope this helps.

Related

Spyder keeps crashing during load in all Anaconda environment

I was running python 2.7 in Anaconda2 in spyder 4 up until today with no problems. But now I keep getting the same error, when I make an environment and install python 2.7 and spyder in it:
Traceback (most recent call last):
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 3557, in run_spyder
main = MainWindow(options)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 426, in init
from spyder.preferences.runconfig import RunConfigPage
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/preferences /runconfig.py", line 482, in
class RunConfigPage(GeneralConfigPage):
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/preferences/runconfig.py", line 487, in RunConfigPage
ICON = ima.icon('run')
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/utils/icon_manager.py", line 394, in icon
directory=_resource['directory'])
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/init.py", line 178, in load_font
return _instance().load_font(prefix, ttf_filename, charmap_filename, directory)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/init.py", line 54, in _instance
'materialdesignicons-webfont-charmap.json')
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/iconic_font.py", line 206, in init
super().init()
TypeError: super() takes at least 1 argument (0 given)
This started happening after I reinstalled the package "pydicom" in the environment, and now nothing works. I have reinstalled anaconda2, used spyder --reset, and all other common suggestions.
Spyder 3.3.6 works in the base environment, but every time I make a new environment and install spyder in this, I get the same error. Any suggestions?
(Spyder maintainer here) To fix this problem, you need to install QtAwesome 0.7.3 in your environment. For that, please use the following command:
conda install qtawesome=0.7.3

How to incorporate matlab into jupyter notebook?

I am trying to integrate MATLAB and jupyter notebook so that I can use MATLAB in the web based notebooks and lab. I am running MATLAB R2020a, python 3.6 (from conda 4.8.2); the computer’s OS is Ubuntu 18.04. I am getting an error saying the MATLAB engine is not installed, though as far as I can tell it has been installed.
I have performed the following steps:
1. I made a conda environment with python 3.6 conda create matlab-conda python=3.6.
2. From there, I installed matlab_kernel using pip by typing in pip install matlab-kernel.
3. If I check that the kernel is installed by keying in jupyter kernelspec list and the view the lists, it says:
Available kernels:
ir /home/computerone/.local/share/jupyter/kernels/ir
matlab
/home/computerone/miniconda3/envs/matlab-conda/share/jupyter/kernels/matlab
python3
/home/computerone/miniconda3/envs/matlab-conda/share/jupyter/kernels/python3
To configure MATLAB, I located the extern/engines/python folder, and from within conda env ran the setup: python setup.py install. This successfully ran.
When I open the juyter notebook or lab, the MATLAB notebook option is there and I can select it, revealing a notebook; however, when I open a MATLABnotebook and type a command (e.g., 2+5), the following error is thrown:
[MetaKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 541, in execute_request
user_expressions, allow_stdin,
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/metakernel/_metakernel.py", line 395, in do_execute
retval = self.do_execute_direct(code)
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/matlab_kernel/kernel.py", line 99, in do_execute_direct
retval = self._execute_async(code)
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/matlab_kernel/kernel.py", line 257, in _execute_async
future = self._matlab.eval(code, **kwargs)
File "/home/computerone/miniconda3/envs/matlab-conda/lib/python3.6/site-packages/matlab_kernel/kernel.py", line 81, in _matlab
""")
ImportError:
Matlab engine not installed:
See https://www.mathworks.com/help/matlab/matlab-engine-for-python.htm

Python gives error in anaconda after update

I have just tried to upgrade everything in my main environment to the latest version (using conda update --all). Everything went completely fine until I actually tried to run python. I got this error message:
Traceback (most recent call last):
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 579, in <module>
main()
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 562, in main
known_paths = venv(known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 494, in venv
addsitepackages(known_paths, [sys.prefix])
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 349, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 159, in addpackage
f = open(fullname, "r")
File "C:\Users\Ayush\Anaconda3\lib\_bootlocale.py", line 12, in getpreferredencoding
if sys.flags.utf8_mode:
AttributeError: 'sys.flags' object has no attribute 'utf8_mode'
As you can see, it looks like a problem with sys.flags. I tried googling this, but I couldn't find anyone with the same issue. I am using python 3.6.7 (python didn't update itself). This error message also appears if I try to run python in the command prompt. Here is the output of running conda update --all. Hope you can help!
EDIT: I found an issue on this issue on github here, but this doesn't give any explanations on how to fix this.
NOTE: I have also tried to install a new version of python using the installer, but that didn't work either.
I somehow did it - I re-installed Python, and then I tried using the command prompt, and it worked. It turned out that if I deleted my idea folder in Pycharm, it would work with the new version!

Kernel Error in Jupyter Notebook, don't know what to do, am new to this

Traceback (most recent call last):
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Kath.000\Anaconda3\lib\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\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Kath.000\Anaconda3\lib\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\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Kath.000\Anaconda3\lib\contextlib.py", line 112, in enter
return next(self.gen)
File "C:\Users\Kath.000\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\Users\Kath.000\AppData\Roaming\jupyter\runtime\kernel-451bd345-5996-4658-8c31-dbdb280931d9.json'
I guess from your log that you also installed Anaconda3. I installed Anaconda 2019.10 for Windows yesterday and I'm having the same error.
Simple answer
Downgrading anaconda to 2019.07 which is the previous version.
How to downgrade anacondafrom Anaconda Emvironments GUI.
Open Anaconda Navigator.
Change to Environments tab.
Right click 'anaconda' in list.
Slide mouse cursor to 'Mark for specific version installation'.
Select '2019.07'.
Apply the downgrade.
2019-10-25 Add: After I tried upgrading anaconda to '2019.10' once again. jupyter_client became ver.5.3.4, not ver.5.3.3.This change solved the problem on my environment.
2019-11-12 Add: The same issue occurred on another PC. I noticed that "Mark specific version installation" is grayed out after a new installation. "Mark specific version installation" is enabled after running "Update Index ...". Although I downgraded anaconda using the same procedure as the last time, you may be able to solve this issue simply by upgrading anaconda.
jupyter_client became ver.5.3.4
Long answer
From here,
Kernel error in jupyter notebook #4909
. The following components seem to be the cause.
jupyter_client 5.3.3
pywin32 223
The solution is mentioned as below.
Downgrading jupyter_client to version 5.3.1.
conda install jupyter_client=5.3.1
Or upgrading pywin32 to version 224.
conda install pywin32=224
I operated them from the GUI of Anaconda Navigator. However both of them are not worked on my anaconda environment. I tried 'conda install pywin32=224' from Terminal but it stopped in the middle of processing. Probably dependencies between packages prevent these operations. I didn't want to spend time to installing software, so I choose to downgrade anaconda to the previous version.
Consideration in taking this solution.
This solution prevents you from installing other latest packages. For example, numpy=1.16.4, scikit-learn=0.21.2 scipy=1.2.1 become unavailable.
I hope that this information is helpful to you.

Kernel Error problem in Jupyter Notebook on PyCharm 2018 IDE

I am struggling with running Jupyter Notebook on PyCharm2018 Community Edition in Windows 10. I created a Virtual Environment with python version 3.6.6 and other necessary packages. I installed jupyter notebook (ipython-7.8.0v, jupyter-1.0.0v) as well following its documentation. As, I am using a specific python version for this application, I want to create a separate ipython kernel (version 5.1.2) for python 3 in a specific path and then add it to jupyter kernelspecs as follows:
ipython kernel install --prefix /tmp
jupyter kernelspec install /tmp/share/jupyter/kernels/python3
When I run an example ipython notebook after following these instructions, the notebook is returning Kernel Error problem stating Could not find a kernel matching Python 2 . I am unable to understand, why its resulting in this. There is no trace of python2 being used anywhere during my installation. I even created python3 kernels separately using above instructions and changed my notebook to kernel to that, but still the same Kernel Error. Virtual Environment I created for this application also uses python3.6 exec file from my Anaconda Installation.
I have looked around similar questions on this problem, but none of them could help me solve this so far. The back trace of this error is as follows.
Traceback (most recent call last):
File "D:\Anaconda3\envs\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Anaconda3\envs\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<D:\***\pycharm_workspace\trail\venv\lib\site-packages\decorator.py:decorator-gen-125>", line 2, in initialize
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel\kernelapp.py", line 472, in initialize
self.write_connection_file()
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel\kernelapp.py", line 199, in write_connection_file
iopub_port=self.iopub_port, control_port=self.control_port)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\jupyter_client\connect.py", line 141, in write_connection_file
with secure_write(fname) as f:
File "D:\Anaconda3\envs\python36\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "D:\**\pycharm_workspace\trail\venv\lib\site-packages\jupyter_core\paths.py", line 404, in secure_write
win32_restrict_file_to_user(fname)
File "D:\**\pycharm_workspace\trail\venv\lib\site-packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
import win32api
**ImportError: DLL load failed: The specified procedure could not be found.**
Thanks in advance for the help.

Categories

Resources