as the title states, on on linux (Wine32) it works perfectly:
http://lh3.ggpht.com/-heB_VObWcwE/VUgfS4bkLkI/AAAAAAAAJAA/tHZzjq2RElw/s642/SIDE_firstPort.png

but on windows (synced code) I get this:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
C:\Documents and Settings\Owner\My Documents\Copy\UMC_v3.0\SIDE.py
['C:\\Documents and Settings\\Owner\\My Documents\\Copy\\UMC_v3.0', 'C:\\Python27\\Lib\\idlelib', 'C:\\WINDOWS\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Documents and Settings\\Owner\\My Documents\\Copy\\UMC_v3.0\\SIDE\\PyQt4-4.11.3-cp27-none-win32.whl', 'SIDE']

Traceback (most recent call last):
  File "C:\Documents and Settings\Owner\My Documents\Copy\UMC_v3.0\SIDE.py", line 2, in <module>
    from SIDE.common import *
  File "C:\Documents and Settings\Owner\My Documents\Copy\UMC_v3.0\SIDE\common.py", line 11, in <module>
    from PyQt4 import QtCore, QtGui, QtOpenGL
ImportError: No module named PyQt4
>>> 

yes, the wheel PyQt4-4.11.3-cp27-none-win32.whl exists in that directory.

anyone have any idea what's going on, and how to fix??

thanks

Recommended Answers

All 12 Replies

You have to install wheel with pip.
On Python 2.7.9 is pip pre-installed.
Put PyQt4-4.11.3-cp27-none-win32.whl in C:\Python27\scripts folder.
Start cmd navigate to C:\Python27\scripts folder,
then do: pip install PyQt4-4.11.3-cp27-none-win32.whl

I got the wheel so I wouldn't have to install

and I just found out why it works on linux...
I didn't realize I had PyQt4 installed on my test interpreter...
(you don't need to install python to run my (not compiled) programs)

what's weird is I have a wheel for lxml set up on another program as an extension used by the program's extended libs for the DAE model format, and I'm not having any issues with that...

is there perhaps an egg I could use, since those seem to work better for portability??

EDIT:
btw, the latest Portable Python is 2.7.6.1
would be nice if there was a more up-to-date build

oh it looks like I have installed 2.7.9... oops
lol

normally I install the non-portable python to match the portable python. :P

so what exactly is the issue, and why do I need PyQt4 installed in this program's directory?

lemme explain a little about the program first...
UMC_SIDE is a Script IDE (a temporary side-program) built specifically for UMC (my main program) and is built using (you guessed it) PyQt4, where the main program will be built off GLFW and OpenGL for it's UI.

PyQt4 is not installed on UMC's portable interpreter as UMC doesn't need it, however, SIDE uses UMC's interpreter to run.

so since SIDE is only temporary, until implemented directly in UMC itself (using GL instead of Qt), I only need PyQt to hold it up until I scrap it.

UMC 3.0a cannot be built with the SIDE implementation, so I need an external program that works between both 3.0a and the rebuilt 3.0

I got the wheel so I wouldn't have to install

Wheel has to installed,also same with older format egg.

(you don't need to install python to run my (not compiled) programs)

You are looking for module/package that can create standalone executables from Python scripts.
Py2exe, cx_Freeze(cross platform), Pynsist, Nuitka

I use Py2exe for my wx_nrk prosject,
has ca 2000 Windows users and ca 300-400 Linux users,
and Windows users do not have to install Python or wxPython,just click on a exe to get it to work.

so what exactly is the issue, and why do I need PyQt4 installed in this >program's directory?

It's not installing into script folder,it's installing like any other module/package you install in Python(into site-packages folder)
The wheel file from scripts folder can be deleted after installing.

I just said you should place it in scripts folder because pip is there in Python 2.7.9.
If you have set up environment variables Path to point to Python27 and Python27/Scripts folder.
Then you do pip install wheel from whatever place you choose.

Wheel has to installed,also same with older format egg.

no they don't, otherwize none of these would work.

here's proof that Pillow works in the egg package:
http://smashboards.com/threads/universal-model-converter-side-development-thread.334292/page-9#post-17965794

lxml works as well
I don't have any proof, but I do have a DAE script that uses my PyCollada library which uses the lxml extension.

it was the devs of Pillow who told me eggs work portably.
and the devs of lxml who pointed me to use a wheel instead of an egg.

You are looking for module/package that can create standalone executables from Python scripts.

no, I've built an exe using GameMaker8 (has an icon and loading banner) which boots Portable Python with python.exe loader.py

It's not installing into script folder

that was a rhetoracle and informational question.
any actual question I ask ends with "??"
___

so ultimately (now that I know it's not using the wheel on linux, but a locally installed pyqt4) it looks like this wheel is broken.

this question will be marked solved when I have a working portable installation.
(I will note this if I find it myself)

I downloaded the current wheel from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

no, I've built an exe using GameMaker8 (has an icon and loading banner) which >boots Portable Python with python.exe loader.py

As usually i think you are doing some strange stuff:)
So you are talking about Portable Python 2.7.6.1
Which has PyQt4 installed,so why do you need to install PyQt4?
Maybe you should explain better,for i think not many will follow this stuff.

EDIT:
btw, the latest Portable Python is 2.7.6.1
would be nice if there was a more up-to-date build

oh it looks like I have installed 2.7.9... oops
lol

normally I install the non-portable python to match the portable python. :P

I have used portable python for many years on different computers,
Portable python closed environment,so i dont know why you want it to match the ordinary Python installation?
I would not use portable python to share code i have made,this it not what's it made for.

so ultimately (now that I know it's not using the wheel on linux, but a >locally installed pyqt4) it looks like this wheel is broken.

this question will be marked solved when I have a working portable >installation.
(I will note this if I find it myself)

I downloaded the current wheel from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

No it's not broken,i have tested that PyQt4 wheel in Virtualenv.
I have used a lot wheel(before all was exe)from Gohlke and stuff has never been broken.

no they don't, otherwize none of these would work.

So you are talking about something that automatic pick up wheel/egg and use it?
Wheel and egg are just binary containers,you can e.g open it Winrar if you want to look at contend.

whl and egg formats are essentially zip formats like jar or pk3, I've known this ever since the Pillow devs told me about the portable method. :P

So you are talking about something that automatic pick up wheel/egg and use it?

I guess...
all you have to do is this automation:

#from current directory
for extension in os.listdir('ext'):
    if any([ extension.endswith(t) for t in ['egg','whl'] ]):
        sys.path.append( sys.argv[0].replace( 
            sys.argv[0].split('\\')[-1], 'ext/%s'%extension) )

^ not tested!
I just wrote it off the top of my head, so it may need fixups and could use improvment...
but that's basically what I'm doing for UMC. (though this has a little more safety)

currently, that txt document I have in the ext directory will crash UMC... lol

so yea, just place the egg or whl in ext/ and import from it easy :)
(UMC's extended libraries require this functionality)

As usually i think you are doing some strange stuff:)

thank you lol
you're not the first who's told me that :P

most expect others to automate an install process or something...
with me, just download and run, and feel free to edit my src and test.

Portable python closed environment,so i dont know why you want it to match the ordinary Python installation?

I don't, I've installed python for IDLE as a testing environment, so I want Python to match P-Python (not the other way around like you're assuming) :P

meaning I'd normally install Python 2.7.6.1 instead of 2.7.9

Which has PyQt4 installed,so why do you need to install PyQt4?

if you optionally choose to install it
(like I stated earlier, UMC's interpreter doesn't need PyQt)
^ only SIDE needs PyQt, so thus I need a portable installation outside of the interpreter.

No it's not broken,i have tested that PyQt4 wheel

ah ok, so it works non-portably, but it doesn't work portably...
ImportError: No module named PyQt4

ok, so the above wasn't tested, but this was :)

>>> [ sys.path.append( sys.argv[0].replace( sys.argv[0].split('\\')[-1], 'ext/%s'%extension ) ) for extension in os.listdir('ext') if any([ extension.endswith(t) for t in ['egg','whl'] ])]
[None, None]
>>> sys.path
['', 'Z:\\media\\tcll\\copy\\UMC_v3.0a', 'C:\\Python27\\Lib\\idlelib', 'C:\\windows\\system32\\python27.zip', 'C:\\python27\\DLLs', 'C:\\python27\\lib', 'C:\\python27\\lib\\plat-win', 'C:\\python27\\lib\\lib-tk', 'C:\\python27', 'C:\\python27\\lib\\site-packages', 'ext/Pillow-2.6.1-py2.7-win32.egg', 'ext/lxml-3.4.1-cp27-none-win32.whl']

and here's what I was using in UMC:

for ext in os.listdir('ext'): sys.path.append('ext/%s'%ext)

Done a little more testing.
Here from wheel doc

Many packages will be properly installed with only the “Unpack” step (simply extracting the file onto sys.path), and the unpacked archive preserves enough information to “Spread” (copy data and scripts to their final locations) at any later time.

Here test with lxml,i use virtualenv so i am sure OS is not affected.

from zipfile import ZipFile

#This get extractet to sys.path
with ZipFile('lxml-3.4.2-cp34-none-win32') as myzip:
    myzip.extractall()

Test:

(test) C:\Documents and Settings\Tom\Envs\test\Scripts
λ python
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
>>> from lxml.html import parse,etree
>>> etree.__version__
u'3.4.4'

So with lxml it works fine.

The same with PyQt4 wheel dos not work,i got it almost to work.
I moved folder PyQt4 in purelib folder to sys.path.
Now get "ImportError: No module named sip" should be possible to fix.

ah, so basically all I have to do is unpack the archive and add the unpacked contents to sys.path right??

might be better than the illegal action I'm doing:

create Qt/ in SIDE/
copy site-packages/pyqt4/ to SIDE/Qt/
place sip.pyd in SIDE/Qt/ (yes, I get that error too)
sys.path.append('SIDE\Qt')
import PyQt4

since sip is part of sys.path, it gets counted

personally though, I like eggs and wheels over this as I usually don't have to extract them.

EDIT: btw, just to show it works:
Wine x86:
http://lh3.ggpht.com/-AZlNPMFCVTs/VUpYFy6XYsI/AAAAAAAAJA0/LpXKhIJibvo/s857/SIDE_UD.png
WinXP Black:
http://lh3.ggpht.com/-7EoWgmRe5kI/VUp2dzSOScI/AAAAAAAAJBM/4Uual4RU_x0/s861/Screenshot%25202015-05-06%252016.14.42.png

this question will be marked solved when I have a working portable installation.

by that I mean an egg, whl, or any other zipped or portable file format. :P

all I have right now is an unpacked installation, which works portably, but isn't exactly extension-worthy :P
(this method is known to cause issues with various binary extensions such as NumPy)

you know what, screw it, I'm marking this solved SIMPLY because it only applies to PyQt4 and not anything else.
so because PyQt4 works properly with this illegal method, yea, solved it.
lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.