Hy,
Trying to use qooxdoo with debian lenny.
qooxdoo sdk 1.2
create-application.py ok but I've got a problem with generate.py :
/demo/qooxdoo/hello1$ ./generate.py source-all
Traceback (most recent call last):
File "/demo/qooxdoo-1.2-sdk/tool/bin/generator.py", line 26, in <module>
from generator.Generator import Generator
File "/demo/qooxdoo-1.2-sdk/tool/bin/Generator.py", line 31, in <module>
#import warnings
File "/demo/qooxdoo-1.2-sdk/tool/bin/Generator.py", line 31, in <module>
#import warnings
ImportError: No module named code.Class
I do think I'm missing some debian packages
Do please help me. Ta.
This stack trace is a tad weird. For a basic thing, the referenced code line (Generator.py:31) imports from "generator.code.Class", and the ImportError indicates that it doesn't find the "code" subpackage under "generator". But the "#import warnings" line is actually generator.py line 31, as if it would be mixing generator.py and Generator.py.
This is furthered by the fact that the stack trace references /demo/qooxdoo-1.2-sdk/tool/bin/Generator.py, which should really be /demo/qooxdoo-1.2-sdk/tool/pylib/generator/Generator.py
I don't have a lenny handy to check if the package itself is alright, but I get the feeling there is some basic flaw with how the qooxdoo SDK is installed on your machine.
I recommend that you simply download the qooxdoo-1.2-sdk from sourceforge and unpack it to a suitable directory. Then re-run the create-application.py from this package to create a new skeleton, or edit the config.json of your existing skeleton so that the QOOXDOO_PATH macro points to the new SDK. Then you should be all set.
I agree with zamnut6. I've had the same problem when I extracted the qooxdoo SDK package on a a virtualbox shared HFS filesystem. The problem is something to do with file name casing incompatibility between two file systems.
Extracting the SDK on a normal Linux directory (if your development environment is Linux) should solve this issue.
I ran into this problem too when I had unpacked the zip file in a virtual box shared directory (host XP, guest Ubuntu), the share caused this issue when I ran ./generate.py source within the shared directory.
When I unpacked the zip to a normal Linux directory, I had no problems.
Related
I'm using PyGObject/GTK+ with Python3.7 on Windows and is worried about how to package my app. With official Python ecosystem, it's easy to use freezers and venvs. However, the PyGObject and GTK+ on Windows requires the MingW environment to run.
Does this mean that I have to package the entire MingW, along with GTK+?
How should I freeze the app?
Since no one cares soon enough, I'll report my findings here. The short answer, as of the date I write this post, is: The PyGObject eco-system is not commercial-ready on Windows, although nothing stops you from shipping a functional app.
The deal-breaker is the lack of functional freezers on Windows for PyGOBject. So you can't really ship a closed-source commercial product with it (although one could argue that the entire Python eco-system is not made for that). The freezers that I tried:
The officially recommended PyInstaller right now does not install with the officially recommended msys/MingGW universe; Even after building PyInstaller from source, the frozen .exe crashes with complaints about missing modules. Below is the crash report from a hello-world app.
$ app.exe
[8340] mod is NULL - structTraceback (most recent call last):
File "C:/Apps/msys64/mingw64/lib/python3.7/struct.py", line 13, in <module>
from _struct import *
ModuleNotFoundError: No module named '_struct'
[8340] mod is NULL - pyimod02_archiveTraceback (most recent call last):
File "C:/Apps/msys64/mingw64/lib/python3.7/site-packages/pyinstaller-3.5-py3.7.egg/PyInstaller/loader/pyimod02_archive.py", line 28, in <module>
import struct
ModuleNotFoundError: No module named 'struct'
[8340] mod is NULL - pyimod03_importersTraceback (most recent call last):
File "C:/Apps/msys64/mingw64/lib/python3.7/site-packages/pyinstaller-3.5-py3.7.egg/PyInstaller/loader/pyimod03_importers.py", line 24, in <module>
from pyimod02_archive import ArchiveReadError, ZlibArchiveReader
ModuleNotFoundError: No module named 'pyimod02_archive'
Traceback (most recent call last):
File "site-packages/pyinstaller-3.5-py3.7.egg/PyInstaller/loader/pyiboot01_bootstrap.py", line 15, in <module>
ModuleNotFoundError: No module named 'pyimod03_importers'
[8340] Failed to execute script pyiboot01_bootstrap
cx_Freeze, another prominent alternative, does not build/install on MingW, either. You end up with gcc woes, no matter how many gcc variants you install.
py2exe is now abandonware since Python 3.4.
Since a PyGObject app still runs with MinGW python, it's not impossible to ship such an app for Windows. But that means you'll go with the big baggage and figure out a way to pack everything yourself. Let alone maintain the whole mess. Mind you that the procedure will be different on Mac if your app is cross-platform. PyInstaller works on Mac according to my test.
QuodLibet provides an example of how to ship an open-source software based on PyGObject. Unfortunately, as of today, the upstream's packaging procedure fails at the build.sh run on my Windows 10:
copying data/quodlibet.zsh -> E:\_dev\quodlibet\win_installer\_build_root\mingw64\share\zsh\vendor-completions\_quodlibet
Traceback (most recent call last):
File "E:/_dev/quodlibet/win_installer/misc/depcheck.py", line 141, in <module>
main(sys.argv)
File "E:/_dev/quodlibet/win_installer/misc/depcheck.py", line 130, in main
libs = get_things_to_delete(sys.prefix)
File "E:/_dev/quodlibet/win_installer/misc/depcheck.py", line 108, in get_things_to_delete
for lib in get_dependencies(path):
File "E:/_dev/quodlibet/win_installer/misc/depcheck.py", line 66, in get_dependencies
data = data.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 72: invalid start byte
This turns out to be an easy fix: locale issue on non-UTF8 Windows.
A trivial patch would be replacing "utf-8" with locale.getdefaultlocale(). After that, the build succeeds.
However, the global distribution issues remain challenging:
Bloated pipeline: The officially recommended msys2 build system basically drags the entire GNOME universe and much of the Python universe to your machine, while you may already have a Python environment on your native Windows. It proves hard to cherry-pick the necessary dependencies among this whole pile of stuff.
Extra C pipeline required to build the executable. To build a Windows executable without a freezer, you must create your app as a Python package (big hassle), install it to your msys2-Python site-packages (another setup.py hassle), and then build a wrapper C application using the Python C API (opaque hassle). The process is not transparent, especially when Python packaging system is sensitive to working directory and path differences. Launching the executable can easily go wrong without much debug info.
Manual stripping. As mentioned above, you must manually cherry-pick dependencies or your app would be shipped with basically the entire msys2/MinGW universe that's worth 100MB+ for a hello-world app.
I get a warning message while trying to create exectable file using pyinstaller. This warning appeared after installing Pillow. Previously i nevre got any warnings and was able to make it through.
the warning i get by pyinstaller is:
7314 INFO: Analyzing main.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/hooks/hook-PIL.Image.py:14: RuntimeWarning: Parent module 'PyInstaller.hooks.hook-PIL' not found while handling absolute import
from PyInstaller.hooks.shared_PIL_Image import *
Also when i tried to run the executable's exe/consol version of my code that lies inside the dist folder created by the pyinstaller (dist/main/main), these are displayed..
Traceback (most recent call last):
File "<string>", line 26, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/PIL.PngImagePlugin", line 40, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/PIL.Image", line 53, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/FixTk", line 74, in <module>
OSError: [Errno 20] Not a directory: '/Users/.../dist/main/tcl'
logout
[Process completed]
so, i tried by uninstalling pillow, installing tk tcl dev version. And then installed pillow. Even that didnt helped.
I also tried reinstalling pyinstaller,. didnt help too
Update 1:
It seems Pyinstaller.hooks.hook-PIL.py file was missing in the Pyinstaller/hooks directory. And it was missing on all platforms(Mac, windows and linux). This is the warning/error message that i get on windows, which is the same i got on mac and on linux.
Later i found a link which said, its just to need Python import machinery happy. so i created as said so. Then i dont get the same error on all platforms, But on mac i still get the PILImagePlugin,Image and FixTk errors
Solution for tcl:
I found what was going wrong,.. Every problem that i faced on OSX was the OS itself(exactly the macport). Python by default comes with the mac OS. And this version of python may be useful for just learning basic python, but is not suitable for Development purpose.
Installing brew's python helped. I followed this SO link. After doing these i was still getting errors. Later i had to change the paths on /etc/paths. Basically rearranging them should work. But still then i wasn't getting it right.
Then i had to change the .bash_profile, which worked for most users, But still i was getting mac's version of python and pip, not the brews version of python.
Finally i had to restart the machine for a couple of times and do the /etc/paths and .bash_profile steps repeatedly to get the system wide effect to accept brews version of python and pip
Solution for PIL:
just adding a file called hook-PIL.py with an empty content would serve the purpose. I found a link which was having the hook files content of pyinstaller.
The location to create
for mac : /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/hooks/ Actually for mac this step wouldn’t be required. When we install python through brew and change the path, everything that you try to install later either through pip install or from source packages tend to choose a different path. And everything will be taken care of.
for windows:C:\Python27\lib\site-packages\PyInstaller-2.1.1.dev0-py2.7.egg\PyInstaller\hooks
**Please check if this is a valid path on your machine before creating the file and then create the file. And im not sure or i don't know if just adding an empty file is the right way. But it worked for me
I'm currently trying to make cx_freeze to work on a Solaris workstation I have to work with, in order to make an executable from a Python script I have. Problem is, I'm not administrator of this machine, and installation of cx_freeze requests write to site-packages, which is read-only for me.
So, obviously, I get this error:
creating /usr/local/lib/python2.6/site-packages/cx_Freeze
error: could not create '/usr/local/lib/python2.6/site-packages/cx_Freeze': Read-only file system
And if I try to run it anyway, it fails:
bash-3.00$ python /home/xxxx/cx_freeze-4.2.3/cxfreeze --target-dir cx_dist src/p_tool.py
Traceback (most recent call last):
File "/home/xxxx/cx_freeze-4.2.3/cxfreeze", line 5, in <module>
main()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/main.py", line 187, in main
silent = options.silent)
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 91, in __init__
self._VerifyConfiguration()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 371, in _VerifyConfiguration
self._GetInitScriptFileName()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 283, in _GetInitScriptFileName
raise ConfigError("no initscript named %s", name)
cx_Freeze.freezer.ConfigError: no initscript named Console
Obviously, this is linked to the failed installation. So, here's my question:
Without installation of virtualenv, could I avoid the writing to site-packages, and make cx_freeze to execute from my home folder?
EDIT I had a look at site.py documentation, and PYTHONPATH filling should be equivalent to use of site-packages. So my question is now more something like: what is the path to be added to PYTHONPATH, so that cx_freeze could be executed from any location?
Notes:
I would like to avoid to deal with virtualenv, as I'm already struggling to understand the executable tools...
I saw this question, but this still requires access to site-packages folder, plus it's not user-specific;
I tried adding the following path to PYTHONPATH, but this does not work: /home/xxxx/cx_freeze-4.2.3/build/lib.solaris-2.10-sun4v-2.6;
I'm also trying to use PyInstaller but have dependency problems (and the administrator is not really helping me).
This works like a charm for me :
$ python setup.py install --home=$HOME
Run in the source directory of cx_freeze found on the Sourceforge download page.
I'm building my first GeoDjango project but I'm kinda desperate.
I'v installed PostgreSQL 9 and PostGis 1.5 through one-click installer on Windows. So everthing is there. I set GEOS_LIBRARY_PATH to the full path of libgeos_c-1.dll in settings.py. But when I run manage.py syncdb, I encounter the following errors:
File "C:\Python25\lib\site-packages\django\contrib\gis\geometry\backend\geos.py", line 1, in <module>
from django.contrib.gis.geos import \
File "C:\Python25\Lib\site-packages\django\contrib\gis\geos\__init__.py", line 6, in <module>
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
File "C:\Python25\Lib\site-packages\django\contrib\gis\geos\geometry.py", line 14, in <module>
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
File "C:\Python25\Lib\site-packages\django\contrib\gis\geos\coordseq.py", line 9, in <module>
from django.contrib.gis.geos.libgeos import CS_PTR
File "C:\Python25\lib\site-packages\django\contrib\gis\geos\libgeos.py", line 51, in <module>
lgeos = CDLL(lib_path)
File "C:\Python25\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
So I open libgeos.py and check the line specified. It's just a simple "CDLL(lib_path)". Apparently lib_path is GEOS_LIBRARY_PATH.
So I create a simple test:
from ctypes import CDLL
lgeos = CDLL('libgeo's path')
Still have the same problem. So it's simply not able to use CDLL to load this dll at all with python. At this stage, I don't know what to do. Please help.
Aparently after set GEOS_LIBRARY_PATH variable using doble '\' slashes works for me, but now launches this error 'module' object has no attribute 'OSMGeoAdmin'
I just run into the same problem after installing Postgresql 9.1 and postgis 2.0 via Windows installers. No need to download anything else. All you have to do is adding this directory into the Windows path: C:\PostgreSQL\9.1\bin or wherever the libgeos_c-1.dll file lives. You may need to reboot if you want the new environment variables to take effect for your IDE. For command lines, just open a new command prompt.
Doing this this way makes setting GEOS_LIBRARY_PATH optional since the required files are already in Windows path.
This may not have worked for the OP back in 2010 but for others who run into the same problem in 2012 going forward, it's probably the simplest solution.
Different things come to my mind, the most obvious being: You did paste the path to the DLL file in there, not just the folder it resides in? No offense meant, just to be on the safe side.
Then, you might also get this error if there are unresolved dependencies, i.e. the DLL's LoadLibrary fails because it is missing another library it depends on. You can easily find that out using Dependency Walker. Load libgeos with depends and look for missing modules, error messages etc. - you might be missing libgeos-X-Y-Z.dll, for example.
Same issue here. Could you maybe be so kind as to share the correct DLL? If that indeed solves the problem. Or is installing OSGeo4W the only way?If so what installation procedure did you follow?
I had the same issue and solved it by:
Reinstalling http://trac.osgeo.org/osgeo4w/ (my installation folder is C:\OSGeo4W64\)
adding the line:
GEOS_LIBRARY_PATH = 'C:\OSGeo4W64\bin\geos_c.dll'
to settings.py
(following this answer: https://stackoverflow.com/a/21495785/2314737)
This is also mentioned in the official documentation:
When GeoDjango can’t find GEOS, this error is raised:
ImportError: Could not find the GEOS library (tried "geos_c"). Try
setting GEOS_LIBRARY_PATH in your settings. The most common solution
is to properly configure your Library environment settings or set
GEOS_LIBRARY_PATH in your settings.
I cannot use sqlite3 (build python package), for the reason that _sqlite3.so file is missing. I found that people had the same problem and they resolved it here. To solve my problem I have to "install sqlite3 and recompile Python". I also found out that the problem can be solved by "building from source and moving the library to /usr/lib/python2.5/lib-dynload/".
As I have been told to here, I have to install sqlite from the source and copy newly compiled files to my Python directory (nothing was said about "recompile Python"). Well, I have installed sqlite and now I have to copy something to my /lib-dynload/ directory.
I am not sure what exactly I should copy. In my /lib-dynload/ directory I have only .so files. And in my sqlite-3.6.18 I do not have any *.so files (it makes me suspicious). I had this problem since I did not have _sqlite3.so file in /lib-dynload/. By compilation of sqlite I got some new files (for example sqlite3.o and sqlite3.lo) but not _sqlite3.so.
P.S. Some details:
1. I use Python 2.6.2 (which I installed locally).
2. I do not have root permissions.
3. I had already sqlite installed globally on the machine by root.
4. I just installed sqlite locally.
5. My OS is CentOS release 5.3 (Final).
6. When I type in Python command line import sqlite3 I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/loctopu/opt/lib/python2.6/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/home/loctopu/opt/lib/python2.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I don't have exact answer, but few hints here
To install python from source, you don't need to be root, you can always install at /home/USERNAME/usr, for example when you do configure, do like ./configure --prefix=/home/USERNAME/usr
Installing sqlite binaries does not mean its included python extension (instead, sqlite dev files are needed when you compile python)
proper import usage of sqlite3 is import sqlite3