Spyder/Pythonxy crashes - scipy

Upon installing python xy 2.7.5 on my laptop, I tried to launch the Spyder IDE. This yielded the following error:
C:\Python27\Scripts>spyder.exe
Traceback (most recent call last):
File "C:\Python27\Scripts\spyder-script.py", line 9, in
load_entry_point('spyder==2.2.0', 'console_scripts', 'spyder')()
File "C:\Python27\lib\site-packages\spyderlib\start_app.py", line 72, in main
from spyderlib import spyder
File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 112, in
from spyderlib.plugins.ipythonconsole import IPythonConsole
File "C:\Python27\lib\site-packages\spyderlib\plugins\ipythonconsole.py", line 31, in
from IPython.frontend.qt.kernelmanager import QtKernelManager
File "C:\Python27\lib\site-packages\IPython\frontend\qt\kernelmanager.py", line 9, in
from IPython.zmq.kernelmanager import KernelManager, SubSocketChannel, \
File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 67, in
check_for_zmq('2.1.4')
File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 51, in check_for_zmq
import zmq
File "C:\Python27\lib\site-packages\zmq\__init__.py", line 35, in
_libzmq = ctypes.CDLL(bundled[0], mode=ctypes.RTLD_GLOBAL)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 127] Die angegebene Prozedur wurde nicht gefunden
Using a python console, I was able to run python code as well as matplotlib and numpy code. Ipython works, however Ipython (Qt) does not work. what could be the reason for this?
The host OS is Windows XP.

This is actually a problem with the most recent builds of zeromq, which are messaging libraries that are required for IPython, and not with Spyder itself. The latest zeromq builds are not compatible with Win XP. This is a know issue with recent versions of Python(x,y) on Win XP which can be solved by following the guidance in this bug report.

It works by installing
https://pythonxy.googlecode.com/files/pyzmq-13.0.2-4_py27.exe
and
http://h5py.googlecode.com/files/h5py-2.1.3.win32-py2.7.msi
,
As it is posted in http://code.google.com/p/pythonxy/issues/detail?id=670

Related

Anaconda 3 throwing error when installed in Linux Mint 19

I had a previous version of Anaconda 2 (working with Python 2.7), which I uninstalled to newly install Anaconda 3 (to work with Python 3.x).
While the previous Anaconda 2 was working fine, the newly installed Anaconda 3 throws the following error:
Traceback (most recent call last):
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/main_window.py", line 541, in setup
self.post_setup(conda_data=conda_data)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/main_window.py", line 578, in post_setup
self.tab_home.setup(conda_data)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/tabs/home.py", line 169, in setup
self.set_applications(applications, packages)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/tabs/home.py", line 204, in set_applications
apps = self.api.process_apps(applications, prefix=self.current_prefix)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/anaconda_api.py", line 848, in process_apps
app = app(config=self.config, process_api=self._process_api, conda_api=self._conda_api)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py", line 48, in __init__
**kwargs
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/base.py", line 43, in __init__
self.init()
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/base.py", line 60, in init
SUBDIR, INST_EXT, INST_DIR = self._find_linux_install_dir()
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py", line 168, in _find_linux_install_dir
if DISTRO_NAME in ['ubuntu', 'debian']:
UnboundLocalError: local variable 'DISTRO_NAME' referenced before assignment
Any help to get started with the new installation will be much appreciated.
I am using Linux Mint 19 with the following info:
...$ cat /etc/linuxmint/info
RELEASE=19
CODENAME=tara
EDITION="Xfce"
DESCRIPTION="Linux Mint 19 Tara"
DESKTOP=Gnome
TOOLKIT=GTK
NEW_FEATURES_URL=http://www.linuxmint.com/rel_tara_xfce_whatsnew.php
RELEASE_NOTES_URL=http://www.linuxmint.com/rel_tara_xfce.php
USER_GUIDE_URL=help:linuxmint
GRUB_TITLE=Linux Mint 19 Xfce
...$
A quick google search showed that an issue was open about your problems few days ago in github
Fortunately a workaround was posted:
Editing the file: ".../anaconda3//lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py"
By declaring the variable outside the loop.
Just add the line:
DISTRO_NAME = None
on Line 159 and indent it in line with the if above it (Outside it)
I got a similar experience this morning. But I was able to resolve mine by typing this into my command-line interface(CLI).
conda update anaconda-navigator
I hope this work for you.

Running canopy-script.pyw gives traceback "No module named canopy.app.bootstrap"

I am trying to follow instruction from Enthought support website To test of what I have done i run line:
_python.exe canopy-script.pyw -d
Unfortunately this gives Traceback:
Traceback (most recent call last):
File "canopy-script.pyw", line 776, in <module>
File "canopy-script.pyw", line 336, in bootstrap
File "canopy-script.pyw", line 363, in chainload
File "canopy-script.pyw", line 762, in _chainload
File "C:\Users\User\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.7.4.3348.win-x86_64\Canopy-script.pyw", line 7, in <module>
from canopy.app.bootstrap import main
ImportError: No module named canopy.app.bootstrap
After "Search" I can see many of bootstrap.py files on the disc.
What would be the solution for this problem?
The current version of Canopy is 2.1.9. (You are running v 1.7.4).
To update Canopy, and for a link to release notes, please see "Installing a new Canopy version".
After you update, see:
https://support.enthought.com/hc/en-us/articles/360021798791--UnresolvableRequirements-or-Conflicting-requirements-when-installing-or-updating-packages

how to fix import error in terminal, but in eclipse works fine

I got this estructure, that works in eclipse, but I got a import error in cmd. I tried sys.append.path but it does not works.
I´m running main.py
python main.py
In eclipse running the same code, ctrl+f11, it works fine.
Principal\__init__.py
Principal\lib\_init__.py
Principal\lib\functions.py
Principal\App_user\__init__.py
Principal\App_user\main.py
Principal\App_user\controller\__init__.py
Principal\App_user\controller\User_Controller.py
I got in User_Controller.py, from Principal.lib import funcionesDB it works in eclipse but it doesn't in cmd.
Traceback (most recent call last):
File "main.py", line 175, in <module>
main()
File "main.py", line 119, in main
from controlller.User_controller import User_Controller
File "C:\Users\NCB-APD\Desktop\Proyects\Apps\Aplicaciones\Principal\App_User\controller\User_Controller.py", line 21, in <module>
from Principal.lib import funcionesDB
ImportError: No module named Principal.lib
you may need to change you directory to where you code is, and then run it in cmd line like: python main.py, or you may need to specify the directory of your code just like: python "path of code"/print_test.py.

google-cloud-storage library from nosetests using testbed

I have google-cloud-storage pip installed into a lib directory and vendored in. It's running just fine locally during development of my python appengine app. However, when trying to run unit tests via nose and testbed I'm getting "The 'google-cloud-core' distribution was not found and is required by the application". Here is the stack:
Traceback (most recent call last):
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/jason/dev/gain-data/data/storage/__init__.py", line 4, in <module>
from google.cloud.storage import Blob, Client
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/__init__.py", line 42, in <module>
from google.cloud.storage.batch import Batch
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/batch.py", line 30, in <module>
from google.cloud.storage.connection import Connection
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/connection.py", line 17, in <module>
from google.cloud import connection as base_connection
File "/Users/jason/dev/gain-data/lib/google/cloud/connection.py", line 31, in <module>
get_distribution('google-cloud-core').version)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 557, in get_distribution
dist = get_provider(dist)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 431, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
DistributionNotFound: The 'google-cloud-core' distribution was not found and is required by the application
Any thoughts?
I had the same issue with google-cloud-translate, I was forced to also install the package "globally", i.e. pip install google-cloud-translate.
After struggling a lot with this same issue I found out that the error was because the vendor pip lib wasn't in the PYTHONPATH before calling the nosetests.
Try adding the vendor lib to the PYTHONPATH and then run the tests.
export PYTHONPATH="$(HOME)/Projects/myproject/pip_lib:$$PYTHONPATH"; \
nosetests .

Using Gurobi solver in the Enthought Canopy Editor on Linux

I am currently working with Gurobi solver using python. Previously, I have just been using a mix of a text editor and the terminal to write and run my models but I am currently experimenting with using Enthought Canopy Editor. I have a model that is works when I run in in the terminal using python model.py but when I try doing%run model.py in Canopy's iPython shell I get:
%run /home/cdhagmann/Copy/Code_Env/Farmer/model.py
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/cdhagmann/Canopy/appdata/canopy-1.0.1.1189.rh5-x86_64/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
181 else:
182 filename = fname
--> 183 __builtin__.execfile(filename, *where)
/home/cdhagmann/Copy/Code_Env/Farmer/model.py in <module>()
----> 1 from gurobipy import *
2 from data_IO import read_data,currency
3 import time
4
5 # Import model data
ImportError: No module named gurobipy
My guess is that the terminal and Canopy look for modules in different places but I don't know how to rectify it. I found this reference on the Gurobi group site about Enthought Canopy and Gurobi on OS X 10.8 but didn't know how much those instruction would differ from doing it on Linux and even what he meant about installing Gurobi in Canopy's site-packages.
UPDATE: Based on information found the first link I clicked on, I did in fact leave the boxed clicked making Canopy my default directory. You have to manually prepend the PATH variable, which I missed them saying that I had to do. So I did that. I now have Canopy's version of iPython running in my terminal (check by using sys.path); however, I get a huge list of errors when I try run python.
cdhagmann#Crispin ~ $ python
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 563, in <module>
main()
File "/usr/lib/python2.7/site.py", line 545, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 272, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 247, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python2.7/site.py", line 237, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 578, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 505, in get_config_vars
import re
File "/usr/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/usr/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/usr/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/usr/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
Suggestions?
And to answer #Jonathan questions:
sys.prefix = '/usr'
sys.path:
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
gurobipy.__file__ = '/usr/local/lib/python2.7/dist-packages/gurobipy/gurobipy.so'
If the terminal is correctly configured for Canopy Python, then python in terminal and Canopy Python should be looking for modules in the same places. If during installation, you disabled "make Canopy be default Python", or if you have not restarted terminal since installation, then it won't automatically be configured correctly.
These articles should help you understand and configure:
http://docs.enthought.com/canopy/configure/faq.html#where-are-all-of-the-python-packages-in-my-user-python-environment
https://support.enthought.com/entries/23646538-Make-Canopy-s-Python-be-your-default-Python-i-e-on-the-PATH-
https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line
If these articles do not suffice for you to solve this, then please report -- when you run python from terminal, what are these?
sys.prefix
sys.path
gurobipy.__file__