Opened 13 years ago
Last modified 4 years ago
#267 closed defect
ctypes version conflict with numpy — at Version 1
Reported by: | davidfawcett | Owned by: | |
---|---|---|---|
Priority: | major | Component: | Package |
Version: | Keywords: | python ctypes numpy | |
Cc: |
Description (last modified by )
When I try to import numpy, I get the below error. It appears that it looks for ctypeslib.py in the right spot, but then it goes to the path for my 'system python', which is Python 2.5 for ctypes\init.py.
I just ran the OSGeo4W installer to update all of the packages.
GDAL 1.8.1, released 2011/07/09
H:\>python Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\OSGeo4W\apps\Python27\lib\site-packages\numpy\__init__.py", line 154, in <module> import ctypeslib File "C:\OSGeo4W\apps\Python27\lib\site-packages\numpy\ctypeslib.py", line 60, in <module> import ctypes File "D:\Python25\lib\ctypes\__init__.py", line 20, in <module> raise Exception, ("Version number mismatch", __version__, _ctypes_version) Exception: ('Version number mismatch', '1.0.2', '1.1.0') >>>
Note:
See TracTickets
for help on using tickets.
David, the system python variables needs to be removed from the environment before starting the o4w python. To see the existing python env, open a command prompt and type:
If you see something like the below you'll have a conflict with the Osgeo4W python:
To fix this you'll need to remove the existing python settings from the system default ([Winkey]-[pause/break] > Advanced > Environment) or take care to always start python from inside a new shell which resets those variables, e.g. from a batch file: