Spyder won't connect to kernel / iPython console - python

Since my laptop crashed (for unknown reason) last night, Spyder has not been able to connect to a kernel. I am getting this error:
IOError: Could not find u'kernel-1809.json' in ['.', '~/Library/Jupyter/runtime']
(The name of the json file changes each time I attempt to launch an iPython console.)
This does not seem to be related to the matplotlib 1.5 issue, that I have seen elsewhere on here - it is using 1.4.3.
iPython (version 4.0.0) runs fine from the command line.
Mac 10.10.1 (Yosemite). Spyder 2.3.7. Python 2.7.10 64bits, Qt 4.8.7, PyQt4 (API v2) 4.11.3 on Darwin
UPDATED TO INCLUDE LOGS
>>> /Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/nbformat/current.py:19: UserWarning: nbformat.current is deprecated.
- use nbformat for read/write/validate public API
- use nbformat.vX directly to composing notebooks of a particular version
ERROR: 3rd party plugin import failed for `p_pylint`
Traceback (most recent call last):
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/otherplugins.py", line 53, in get_spyderplugins_mods
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/p_pylint.py", line 23, in <module>
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 71, in <module>
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 61, in get_pylint_version
File "subprocess.pyc", line 710, in __init__
File "subprocess.pyc", line 1335, in _execute_child
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 925, in <lambda>
give_focus=give_ipyclient_focus))
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 1033, in register_ipyclient
give_focus=give_focus)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 836, in register_client
self.connect_client_to_kernel(client)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1048, in connect_client_to_kernel
client.password)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1017, in create_kernel_manager_and_client
cf = find_connection_file(connection_file)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/jupyter_client/connect.py", line 185, in find_connection_file
raise IOError("Could not find %r in %r" % (filename, path))
IOError: Could not find u'kernel-2018.json' in ['.', u'/Users/garyspatterson/Library/Jupyter/runtime']
** Further update **
I deleted all files under the .spyder2/ folder in my user directory, reopened Spyder, and it was able to connect to an iPython console. So far, so good. Trouble is, when I added a path to the PYTHONPATH manager (so I could import external modules, such as nltk), I am back to getting the same error.

Had a similar issue and was able to resolve it by creating a new virtualenv with the same dependencies installed.
Now Spyder is working with the PYTHONPATH pointing at lib/python2.7/site-packages of the new environment.

Related

Oct2Py - OSError: Octave not found, please see README - Mac M1

I am aware of this similar question, but that is on Windows and not for Mac M1, and their solution didn't work for me.
Aim
I would like to be able to use the python package oct2py.
Set Up and Problem
I have a new Mac M1. I have installed Anaconda using the 64-Bit (M1) Graphical Installer (316 MB). I have created an environment env-name, activated it, and installed oct2py using the command conda install -c conda-forge oct2py. In Python, when running from oct2py import octave or simply import oct2py it fails with the following traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/__init__.py", line 38, in <module>
octave = Oct2Py()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/core.py", line 83, in __init__
self.restart()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/core.py", line 533, in restart
self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/octave_kernel/kernel.py", line 173, in __init__
self.executable = self._get_executable()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/octave_kernel/kernel.py", line 472, in _get_executable
raise OSError('octave not found, please see README')
OSError: octave not found, please see README

Installing Graphviz for use with Python 3 on Windows 10

So I've had Python 3.6 on my Windows 10 computer for a while now, and today I just downloaded and installed the graphviz 0.8.2 (https://pypi.python.org/pypi/graphviz) package via the admin commandline with:
pip3 install graphviz
It was only after this point that I downloaded the Graphviz 2.38 MSI installer file and installed the program at:
C:\Program Files (x86)\Graphviz2.38
So then I tried to run this simple Python program:
from graphviz import Digraph
dot = Digraph(comment="The round table")
dot.node('A', 'King Arthur')
dot.node('B', 'Sir Bedevere the Wise')
dot.node('L', 'Sir Lancelot the Brave')
dot.render('round-table.gv', view=True)
But unfortunately, I received the following error when I try to run my Python program from commandline:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\graphviz\backend.py", line 124, in render
subprocess.check_call(args, startupinfo=STARTUPINFO, stderr=stderr)
File "C:\Program Files\Python36\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Program Files\Python36\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Program Files\Python36\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\foldername\testing.py", line 11, in <module>
dot.render('round-table.gv', view=True)
File "C:\Program Files\Python36\lib\site-packages\graphviz\files.py", line 176, in render
rendered = backend.render(self._engine, self._format, filepath)
File "C:\Program Files\Python36\lib\site-packages\graphviz\backend.py", line 127, in render
raise ExecutableNotFound(args)
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'round-table.gv'], make sure the Graphviz executables are on your systems' PATH
Notice how what I've asked seems VERY similar to this question asked here:
"RuntimeError: Make sure the Graphviz executables are on your system's path" after installing Graphviz 2.38
But for some reason, adding those paths (suggested in the solutions at the link above) to the system variables isn't working, and I don't know why! I tried restarting the computer after adding the paths as well, still to no success. See the image below:
Although the other suggested solution, which was to add these few lines in front of my Python code, did work:
import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'
But here's the issue: I don't understand why adding to the environment variables didn't work, and this is my primary concern. So my question is this: why did adding those lines of code in front of the Python script work but changing the environment variables didn't? What do I need to do to get my script to run without adding those lines of code in front?
Can you please post the output you get when you type SET in a cmd window after setting the PATH environment variable?
Does it contain C:/Program Files (x86)/Graphviz2.38/bin/ ?
A cmd window must be restarted before updated environment variables become effective!

Canopy is having difficulties updating packages, "AbortedOperationDetected"

I run Canopy version Version: 2.1.3.3542 (64 bit) on Windows 10.
Canopy cant manage to update any package, all results in the same
log output for a numpy update (for example):
Warming up...
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action_worker.py", line 54, in run
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action.py", line 196, in execute
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 626, in <lambda>
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 1051, in _install
File "build\bdist.win-amd64\egg\canopy_platform\cpython_packages_manager.py", line 152, in install_packages_prompt
File "build\bdist.win-amd64\egg\canopy_platform\cpython_packages_manager.py", line 137, in _install_packages_prompt
PackagesInstallationError: installation of packages ['numpy 1.11.3-3'] failed. Details below:
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 64, in wrapper
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 384, in install_command
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 414, in _install_packages_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 124, in decorator
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 219, in install_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 223, in _install_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 549, in _compute_fix_aborted_actions
AbortedOperationDetected: Aborted operation detected in environment 'User'
There is absolutly 0 results on google for this error code, so stackexchange is my last resort
It looks like a previous update was force-aborted, possibly leaving the environment corrupted. Assuming that you are using the standard installer, then it should suffice to
reboot your computer
temporarily disable your anti-virus software if possible (or at least disable its more intrusive / slow functionality, such as online checking each of the tens of thousands of package files that Canopy provides),
from the Canopy Tools menu, select Troubleshoot => Reset Python environment

Error while running a python script in Spyder

I have installed Anaconda (Python 2.7) in Windows 7. Initially, it was a bit problematic to start spyder, but eventually I figured out that by running cmd as administrator, spyder starts. As soon as I ran my first python script in Spyder, it showed me an error in its internal console:
F:\PythonIDE\lib\site-packages\nbformat\current.py:19: UserWarning: nbformat.current is deprecated.
- use nbformat for read/write/validate public API
- use nbformat.vX directly to composing notebooks of a particular version
""")
F:\PythonIDE\lib\pkgutil.py:110: FutureWarning: The pandas.rpy module is deprecated and will be removed in a future version. We refer to external packages like rpy2.
See here for a guide on how to port your code to rpy2: http://pandas.pydata.org/pandas-docs/stable/r_interface.html
__import__(name)
F:\PythonIDE\lib\site-packages\matplotlib\cbook.py:137: MatplotlibDeprecationWarning: The matplotlib.delaunay module was deprecated in version 1.4. Use matplotlib.tri.Triangulation instead.
warnings.warn(message, mplDeprecation, stacklevel=1)
F:\PythonIDE\lib\site-packages\skimage\filter\__init__.py:6: skimage_deprecation: The `skimage.filter` module has been renamed to `skimage.filters`. This placeholder module will be removed in v0.13.
warn(skimage_deprecation('The `skimage.filter` module has been renamed '
Failed to write user configuration file.
Please submit a bug report.
Traceback (most recent call last):
File "F:\PythonIDE\lib\site-packages\spyderlib\plugins\editor.py", line 2066, in run_file
dialog.setup(fname)
File "F:\PythonIDE\lib\site-packages\spyderlib\plugins\runconfig.py", line 349, in setup
self.runconfigoptions = RunConfigOptions(self)
File "F:\PythonIDE\lib\site-packages\spyderlib\plugins\runconfig.py", line 148, in __init__
self.runconf = RunConfiguration()
File "F:\PythonIDE\lib\site-packages\spyderlib\plugins\runconfig.py", line 57, in __init__
self.set(CONF.get('run', 'defaultconfiguration', default={}))
File "F:\PythonIDE\lib\site-packages\spyderlib\userconfig.py", line 387, in get
self.set(section, option, default)
File "F:\PythonIDE\lib\site-packages\spyderlib\userconfig.py", line 446, in set
self._save()
File "F:\PythonIDE\lib\site-packages\spyderlib\userconfig.py", line 136, in _save
raise(e)
WindowsError: [Error 5] Access is denied: u'C:\\Users\\Shubhanshu\\.spyder2\\spyder.ini'
Now, how to rectify this error? I would be really grateful for any help in this regard.

Firefox Add-on SDK error

I try to launch:cfx runbut I'm getting following error:
(C:\Users\michal smoczyk\Downloads\addon-sdk-1.14) C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\my-addon>cfx run
Using binary at 'C:\Program Files\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\michal~1\appdata\local\temp\tmpkcrwv7.mozrunner'.
Traceback (most recent call last):
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\bin\cfx", line 33, in <module>
cuddlefish.run()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\__init__.py", line 928, in run
bundle_sdk=options.bundle_sdk)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 706, in run_app
runner.start()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 529, in start
self.process_handler = run_command(self.command+self.cmdargs, self.env, **self.kp_kwargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 59, in run_command
return killableprocess.Popen(cmd, env=env, **killable_kwargs)
File "C:\Python27\lib\subprocess.py", line 709, in __init__
errread, errwrite)
TypeError: _execute_child() takes exactly 17 arguments (18 given)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
My Firefox version: 26. I've installed Python 2.7. OS: Windows Vista, SDK: 1.14
The current 1.15 version of the Add-on SDK seems to be incomaptible with Python 2.7.6.
I got the same error and downgraded to Python 2.7.5 to solve this issue.
Here are some relevant bug reports:
Bug 950894 - [mozprocess] TypeError under windows evironment in cpython 2.7.6
Bug 958609 - Add-on SDK 1.15 incompatible with Python 2.7.6
Update: The bug has been fixed.
I suggest getting the latest version of the SDK (addon-sdk-1.15.zip) from the Mozilla Developer Hub :: Add-ons for Firefox web page. Also make sure to read an follow the instructions in the README file that comes with it (if you haven't already).
One pertinent thing it says is:
If you get an error when running cfx or have any other problems
getting started, see the "Troubleshooting" guide at:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/troubleshooting.html
try to install add-on sdk 1.15 with python 2.6.6 then do this steps
1- Download cp720
2- unzip the zip file.
3- Copy or Move the file cp720.py into your python encodings folder.
Example: C:\Python26\Lib\encodings\

Categories

Resources