I have just installed Anaconda3-2.3.0-Windows-x86_64. Previously I was using
Anaconda-2.0.1-Windows-x86 (32-bit). I have both Anaconda and Anaconda3 folders (this is a machine at work, so I need to keep both for backward compatibility).
Then, I set in Spyder's Console Preferences to have it look for python.exe and scientfic_startup.py in the Ananconda3 folder, instead of Anaconda.
Then, when I start Spyder, it gets the following error related to zmq. It seems to keep looking for files in the old Anaconda folder, and not in the new Anaconda3 folder. Will the problem go away if it looks for things in Anaconda3, and, if so, how can I get Spyder to look for it in Anaconda3?
"C:\AppData\Local\Continuum\Anaconda\lib\site‑packages\spyderlib\widgets\externalshell\start_ipython_kernel.py", line 167, in from IPython.kernel.zmq.kernelapp import IPKernelApp
File "C:\AppData\Local\Continuum\Anaconda\lib\site‑packages\IPytho \kernel\__init__.py", line 4, in from . import zmq
File "C:\AppData\Local\Continuum\Anaconda\lib\site‑packages\IPytho \kernel\zmq\__init__.py", line 8, in check_for_zmq('13', 'IPython.kernel.zmq')
File "C:\AppData\Local\Continuum\Anaconda\lib\site‑packages\IPytho\utils\zmqrelated.py", line 10, in check_for_zmq import zmq
File "C:\Users\O629626\AppData\Local\Continuum\Anacond\lib\site‑packages\zmq\__init__.py", line 42, in _libsodium = ctypes.cdll.LoadLibrary(bundled_sodium[0])
File "C:\Users\O629626\AppData\Local\Continuum\Anaconda3\lib\ctypes\__init__.py", line 429, in LoadLibrary
return self._dlltype(name)
File "C:\Users\O629626\AppData\Local\Continuum\Anaconda3\lib\ctype \__init__.py", line 351, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Opening the default Spyder associated with the specific Anaconda resolved the issue.
Related
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!
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.
If I type the following at the python.exe command prompt...
>>>help('modules')
...I get a list of available modules as expected.
However when I type the same thing in the IDLE environment (idle.pyw), it throws an error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
help('modules')
File "C:\Python27\ArcGIS10.1\lib\site.py", line 467, in __call__
return pydoc.help(*args, **kwds)
File "C:\Python27\ArcGIS10.1\lib\pydoc.py", line 1727, in __call__
self.help(request)
File "C:\Python27\ArcGIS10.1\lib\pydoc.py", line 1766, in help
elif request == 'modules': self.listmodules()
File "C:\Python27\ArcGIS10.1\lib\pydoc.py", line 1887, in listmodules
ModuleScanner().run(callback, onerror=onerror)
File "C:\Python27\ArcGIS10.1\lib\pydoc.py", line 1938, in run
for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
File "C:\Python27\ArcGIS10.1\lib\pkgutil.py", line 105, in walk_packages
for importer, name, ispkg in iter_modules(path, prefix):
File "C:\Python27\ArcGIS10.1\lib\pkgutil.py", line 147, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "C:\Python27\ArcGIS10.1\lib\pkgutil.py", line 211, in iter_modules
for fn in os.listdir(path):
WindowsError: [Error 5] Access is denied: 'C:\\WINDOWS\\system32\\Msdtc/*.*'
Why does Windows say "Access is denied" to IDLE but not the command line? I have tried using "Run as Administrator" on IDLE without success. Do I need to reconfigure IDLE in some way?
For information:
My installation of Python 2.7.2 (32-bit version running on a Windows 7 64-bit machine) came bundled with ArcGIS 10.1, which uses Python as a scripting language and certain numerical operations (via Numpy). Could this have something to do with the differing behaviour in the prompt and IDLE?
The root Python directory is: C:\Python27\ArcGIS10.1\.
IDLE is installed at C:\Python27\ArcGIS10.1\Lib\idlelib\idle.pyw.
The Python command prompt is installed at: C:\Python27\ArcGIS10.1\python.exe.
I just successfully ran help('modules') in both 2.7.8 and 3.4.2. The response depends on sys.path. It appears than ArcGIS adds C:/Windows/System32/Msdtc to the path, but you could check before running help. In any case, accessing that folder cannot be done through Windows Explorer, even when running as an admin. It requires special user action through a 'security tab'. Since MS does not want me poking around there, I did not pursue getting access. I don't know why the difference betweeon console and Idle.
This is probably a simple problem. But I downloaded the pywiiuse library from here and I also downloaded the examples. However when I try to run one of the examples I end up with import issues. I'm not certain I have everything configured properly to run. One error I receive when trying to run example.py:
Press 1&2
Traceback (most recent call last):
File "example.py", line 73, in <module>
wiimotes = wiiuse.init(nmotes)
File "/home/thed0ctor/Descargas/wiiuse-0.12/wiiuse/__init__.py", line 309, in init
dll = ctypes.cdll.LoadLibrary('libwiiuse.so')
File "/usr/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libwiiuse.so: cannot open shared object file: No such file or directory
I'm really just starting out with this library and don't really see any documentation on how to configure pywiiuse so any help is much appreciated.
The pywiiuse library is a Python wrapper for the wiiuse C library.
Before you can use the wrapper you will first need to install the library it wraps, choose the newest version from this download page and download the appropriate installation package for you system (probably the .tar.gz since you appear to be on Linux).
add the link of libwiiuse.so to /usr/local/lib.
I also ran into this situation, I konw why it happies, but I don't konw the deep reason.
I installed cocos2d today on OS X Lion, but whenever I try to import cocos in the Python interpreter, I get a bunch of import errors.
File "", line 1, in File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/init.py",
line 105, in
import_all() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/init.py",
line 89, in import_all
import actions File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/actions/
init.py", line 37, in
from basegrid_actions import * File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/actions/
basegrid_actions.py", line 62, in
from pyglet.gl import * File "build/bdist.macosx-10.6-intel/egg/pyglet/gl/init.py", line 510,
in File
"build/bdist.macosx-10.6-intel/egg/pyglet/window/init.py", line
1669, in File
"build/bdist.macosx-10.6-intel/egg/pyglet/window/carbon/
init.py", line 69, in File "build/bdist.macosx-10.6-intel/egg/pyglet/lib.py", line 90, in
load_library File
"build/bdist.macosx-10.6-intel/egg/pyglet/lib.py", line 226, in
load_framework File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/ctypes/init.py", line 431, in LoadLibrary
return self._dlltype(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/ctypes/init.py", line 353, in init
self._handle = _dlopen(self._name, mode) OSError: dlopen(/System/Library/Frameworks/QuickTime.framework/ QuickTime, 6):
no suitable image found. Did find:
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
Since I can't fix it, I'd like to remove cocos2d entirely. The problem is that I can't seem to find a guide anywhere that details how to remove it from the Python installation.
Any help regarding either of these problems is greatly appreciated.
You could fix it.
The problem comes from the fact that cocos2D is built on top of Pyglet, and the stable release of pyglet does not yet support Mac OS X 64 bits architecture. You have to use the 1.2 release of pyglet or later, which by now is not released yet.
A workaround is to remove any existing Pyglet install:
pip uninstall piglet
Then install the latest Pyglet from the mercurial repository
pip install hg+https://pyglet.googlecode.com/hg/