On 2014-02-23 08:44, Johan Råde wrote:
Hi everyone,
I'm trying to get PySide to run with PyPy using the Python C-API. I'm able to build and install PySide under PyPy on Windows, without any errors, but the installed libraries do not work. I'm working on it.
Maybe I'm making some progress. Here is what happens now when I try to import PySide.QtCore:
import PySide.QtCore Fatal error in cpyext, CPython compatibility layer, calling PyDict_SetItemString Either report a bug or consider not using this particular extension <OpErrFmt object at 0x2467e24> RPython traceback: File "pypy_module_cpyext_api_2.c", line 17110, in PyDict_SetItemString File "pypy_module_cpyext_pyobject.c", line 1136, in BaseCpyTypedescr_realize File "pypy_objspace_std_objspace.c", line 4657, in allocate_instance__W_ObjectObject File "pypy_objspace_std_typeobject.c", line 3911, in W_TypeObject_check_user_subclass
Does this trace contain any useful information? I'm using the official 2.2.1 release of PyPy. ------------------------------------------------------------------------------------------- Updated instructions for building and installing PySide 1.2.1 with PyPy 2.2.1 on Windows: 1. Install the prerequisites: * CMake * Qt 4.x.y, with x >= 6, compiled with Visual Studio 2008 (I used Qt 4.8.5, the latest Qt 4 version.) Binaries can be downloaded from http://qt-project.org/downloads * iconv, libxml2, libxslt. (Not sure if they are needed.) 2. The sphinx package can cause problems. If you don't have sphinx installed or if you have sphinx 1.1.3 installed, then you are fine. But if you have sphinx 1.2.1 (the latest version) installed, then the build will fail. 3. Download the file c-api-extra.h here: https://dl.dropboxusercontent.com/u/525329/PySide/c-api-extra (It contains definitions of some required C-API functions that are missing from PyPy.) Copy the file c-api-extra.h to <pypy-prefix>/include and add the statement #include "c-api-extra.h" somewhere towards the end of <pypy-prefix>/include/Python.h 4. The definiton of PyMODINIT_FUNC in <pypy-prefix>/include/modsupport.h will not work on Windows. Change it to #define PyMODINIT_FUNC __declspec(dllexport) void 5. Create a directory <pypy-prefix>/libs and copy <pypy-prefix>/include/python27.lib there. 6. Download the following patched version of the PySide installation package: https://dl.dropboxusercontent.com/u/525329/PySide/PySide-1.2.1-patched.zip (I have fixed some bugs in the PySide code.) Unzip and copy the directory PySide-1.2.1-patched to a suitable location; the path to PySide-1.2.1-patched must not contain any spaces. 7. Build PySide: Open a Visual Studio 2008 command prompt. Change the current directory to PySide-1.2.1-patched. Run the command: pypy setup.py bdist_egg --qmake=c:/Qt/4.8.5/bin/qmake.exe (Modify the path to qmake.exe if needed.) On my laptop, the build takes about 20 minutes. 8. If you get errors such as "mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "shiboken.exe". The process cannot access the file because it is being used by another process." during the build, then you should turn off your anti-virus software and try again. 9. Install PySide: Change the current directory to PySide-1.2.1-patched/dist Run the command easy_install PySide-1.2.1-py2.7.egg 10. Go to directory <pypy-prefix>/site-packages/PySide-1.2.1-py2.7.egg/PySide. There you find 18 files with the file extension .pyd. Change these file extensions to .pypy-22.pyd. 11. Add the directory <pypy-prefix>/site-packages/PySide-1.2.1-py2.7.egg/PySide to the system path. Reboot. --Johan