I'm trying to get Pandas installed with Python 2.5 on a machine running Windows XP.
The installation seems to finish OK, but when I try
from pandas import *
I get the following error:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\__init__.py", line 24, in <module>
from pandas.stats.api import *
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\api.py", line 7, in <module>
from pandas.stats.moments import *
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\moments.py", line 388, in <module>
rolling_max = _rolling_func(_tseries.roll_max, 'Moving maximum')
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\moments.py", line 379, in _rolling_func
def f(arg, window, min_periods=None, time_rule=None):
File "C:\Python25\Lib\functools.py", line 35, in update_wrapper
getattr(wrapper, attr).update(getattr(wrapped, attr))
AttributeError: 'builtin_function_or_method' object has no attribute '__dict__'
As far as I can tell, I've got all of the dependencies installed correctly, and the problem is something to do with functools.py, which is part of the Python Standard Library(?).
Does anyone have any suggestions, please? Pandas is supposed to work with Python 2.5, so I assume it's a problem with my Python configuration.
Is this the Python distro that came with ArcGIS or Python.org? As discussed on the mailing list this does not seem to be an issue with Python 2.5 per se but potentially your environment
Related
I have installed Python Arcade using
pip install arcade
which ran successfully.
When trying to run the example code, or even just trying to import arcade from the Python command line, I receive an error
>>> import arcade
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/brian/.local/lib/python3.8/site-packages/arcade/__init__.py", line 250, in <module>
from .joysticks import get_game_controllers
File "/home/brian/.local/lib/python3.8/site-packages/arcade/joysticks.py", line 1, in <module>
import pyglet.input
File "/home/brian/.local/lib/python3.8/site-packages/pyglet/input/__init__.py", line 179, in <module>
from .evdev import get_devices as evdev_get_devices
File "/home/brian/.local/lib/python3.8/site-packages/pyglet/input/evdev.py", line 509, in <module>
class EvdevControllerManager(ControllerManager, XlibSelectDevice):
File "/home/brian/.local/lib/python3.8/site-packages/pyglet/input/evdev.py", line 583, in EvdevControllerManager
def get_controllers(self) -> list[Controller]:
TypeError: 'type' object is not subscriptable
>>>
Python version is 3.8.10, and OS is Ubuntu 20.04, but I can't get past this error.
This is a known bug in the pyglet library: https://github.com/pyglet/pyglet/issues/614
The code uses list[Controller] which requires Python 3.9 (see PEP 585).
The line was introduced to pyglet in commit 3c2c7de and was fixed in commit 63341c4 (10 days ago as of today), which changes it to List[Controller] (where List is imported from the standard typing module).
Based on the response from #mkrieger1, and the error being shown, I took the following steps:
vim /home/brian/.local/lib/python3.8/site-packages/pyglet/input/evdev.py
added a line below the other import sections at the top
import typing
then went to line 583 (now 584 due to adding above), and changed
def get_controllers(self) -> list[Controller]:
to
def get_controllers(self) -> typing.List[Controller]:
and the example programs are now working.
If anyone else is in the same situation, then hopefully this is a quick fix to try.
I'm attempting to use Xlwings for Python, however having installed Python 3.5, pywin32 extensions and Xlwings I get the following error when starting import:
from xlwings import workbook
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from xlwings import workbook
File "C:\Python 3.5\lib\site-packages\xlwings\__init__.py", line 18, in <module>
from . import _xlwindows as xlplatform
File "C:\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
import pywintypes
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
Try commenting out the asserts (replace them with a pass) and see if it works. Otherwise you're going to need to debug pywintypes.
Felix Zumstein just informed me that the above suggestion won't work:
When you comment out those lines, then it fails further down when doing from pywintypes import TimeType: ImportError: cannot import name 'TimeType'
However, downgrading may solve this problem.
After Much trial and error ive found that downgrading to Python 3.3 works
Thnak you for all the responses
I have successfully installed cherrypy but when I try to import it, I get following error. I am a newbie and have spent quite a bit of time trying to get this to work, so any help would be highly appreciated.
Traceback (most recent call last):
File "unitconverter.py", line 1, in <module>
import cherrypy
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\__init__
.py", line 82, in <module>
from cherrypy import process
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
__init__.py", line 14, in <module>
from cherrypy.process import plugins, servers
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
plugins.py", line 424, in <module>
class PerpetualTimer(threading._Timer):
AttributeError: 'module' object has no attribute '_Timer'
From what I can see, it's a bug with that version of CherryPy. You'd be best upgrading to a more recent version instead.
So I spend last night trying to install nest (and pynest) to use with PyNN, and I am currently stuck. When I try to import nest I get:
>>> import nest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nest/__init__.py", line 52, in <module>
from . import pynestkernel as _kernel
ImportError: cannot import name pynestkernel
However, when I make the make installcheck it passes all the pynest tests.
I am using OS x Yosemite, and I did a new install of python 2.7.9 using macport.
Tried:
easy_install python-nest
Now I am getting a new error.
Getting:
>>> import pyNN.nest as sim
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyNN.nest as sim
File "/Library/Python/2.7/site-packages/pyNN/nest/__init__.py", line 13, in <module>
from pyNN.nest import simulator
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 500, in <module>
state = _State() # a Singleton, so only a single instance ever exists
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 60, in __init__
self._cache_num_processes = nest.GetKernelStatus()['num_processes'] # avoids blocking if only some nodes call num_processes
AttributeError: 'module' object has no attribute 'GetKernelStatus'
Try using setuptools to install nest with easy_install python-nest.
I am trying something similar, with the further goal of having it working with python 3. So far I used the following commands:
git clone https://github.com/nest/nest-simulator.git
cd nest-simulator
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/nest -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib .
make
make install
which runs without errors and I can happily run nest. Iam still having troubles running pyNN (see https://laurentperrinet.github.io/sciblog/posts/2016-06-01-compiling-and-using-pynn-%2B-nest-%2B-python3.html)
I installed pygui and pywin32 for my 64-bit python 2.7 (I installed 64-bit for those too) and when I try to use pygui, which uses pywin32, python gives me this error.
I'm sure that other people might have similar problems.
Traceback (most recent call last):
File "C:\Users\MY_USERNAME_HERE\Dropbox\Python Programs\BlobEdit\BlobEdit.py", line 16, in <module>
from GUI import Application, ScrollableView, Document, Window, Cursor, rgb
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\__init__.py", line 94, in <module>
import GUI.Application
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Application.py", line 11, in <module>
from GUI.GApplications import Application as GApplication
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\GApplications.py", line 14, in <module>
from GUI.Printing import PageSetup, present_page_setup_dialog
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Printing.py", line 11, in <module>
from GUI import Canvas
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Canvas.py", line 15, in <module>
from GUI.StdFonts import application_font
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\StdFonts.py", line 9, in <module>
from GUI import Font
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Font.py", line 56, in <module>
pywin32_info = api.GetFileVersionInfo(api.__file__, '\\')
error: (1813, 'GetFileVersionInfo:GetFileVersionInfoSize', 'The specified resource type cannot be found in the image file.')
Apparently, PyWin32 can't find it's version or something. I wonder why.
I've had this issue, which led me to this question.
I'm using python 3.3 and had already installed pywin32-218, so my solution was this hack in Font.py:
#pywin32_info = api.GetFileVersionInfo(api.__file__, '\\')
pywin32_build = 218 # pywin32_info['FileVersionLS'] >> 16
I've had this issue too, easy solution: install the minimum required pywin32 version 213. Somewhere there a version check happening in pywin32 on some file. Perhaps some day i will dig into it further and post a more detailed post and/or file a bug