Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 64 bit versions of Windows #107

Closed
giampaolo opened this issue May 23, 2014 · 18 comments
Closed

Support 64 bit versions of Windows #107

giampaolo opened this issue May 23, 2014 · 18 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on September 15, 2010 09:36:41

My script is iterating over processes and checks their CMDLINE list.
On Vista 32bit it worked (I used package for py2.7 downloaded from 
here), but after installing Windows 7 64bit, the CMDLINE is always 
empty for any process.

The "psutil" was installed using "Base-10.9.13.win-amd64-py2.7.‌exe" 
package from http://www.lfd.uci.edu/~gohlke/pythonlibs/ Maybe it is 
the source of my issue.

Original issue: http://code.google.com/p/psutil/issues/detail?id=107

@giampaolo
Copy link
Owner Author

From g.rodola on September 20, 2010 10:38:27

Not sure about that installer provided on lfd.uci.edu (I haven't 
tried it) but I've tried the 32bit installer available here ( 
http://psutil.googlecode.com/files/psutil-0.1.3.win32-py2.7.exe ) on 
a Windows 7 64 bit just now and everything is fine.
My recommendation is to use the official 32 bit version then.

@giampaolo
Copy link
Owner Author

From [email protected] on September 20, 2010 13:45:47

I use 64 bit version of python, so 32 bit psutil installer won't help.
It's not a big deal to reinstall python and all the plugins, but I 
think it's a good idea to provide users with official psutil 64 bit installer

@giampaolo
Copy link
Owner Author

From g.rodola on September 20, 2010 14:13:37

Oh right, I took for granted that you were using python 32 bit 
version, sorry. I hope I'll be able to look into this soon.

@giampaolo
Copy link
Owner Author

From g.rodola on September 20, 2010 15:22:43

I've tried to set up the mingw64 environment but I failed in the 
process because it's way too complex (for me at least). Also, it 
seems we might have another problem other than properly setting up 
the mingw environment: http://bugs.python.org/issue4709 .
Maybe we might have better chances to fix this by fixing issue 81 first.

@giampaolo
Copy link
Owner Author

From g.rodola on September 20, 2010 15:35:33

Labels: OpSys-Windows7 64bit Portability

@giampaolo
Copy link
Owner Author

From [email protected] on September 30, 2010 22:12:28

I have attached a patch against release-0.1.3 that fixes this and 
some other 64 bit issues on Windows. Tested on Python 2.5, 2.6 and 
2.7, 32 and 64 bit, with msvc9 compiler.

Attachment: win-amd64.diff

@giampaolo
Copy link
Owner Author

From g.rodola on October 02, 2010 05:23:17

Tried your patch with mingw32 and everything is fine but VS 2008 
complains about missing ntdef.h. 
If I replace it with winternl.h then it works with VS but not with mingw32.
I'm not sure what to do. :-\
Jay, ideas?

Cc: jloden

@giampaolo
Copy link
Owner Author

From [email protected] on October 02, 2010 08:47:39

Ntdef.h is part of the Windows driver development kit. It seems the 
only thing needed from ntdef.h is UNICODE_STRING. 

Index: process_handles.c
===================================================================
--- process_handles.c   ( revision 648 )
+++ process_handles.c   (working copy)
@@ -5,7 +5,7 @@
 #include <Python.h>
 #include <windows.h>
 #include <stdio.h>
-#include <Ntdef.h>
+//#include <Ntdef.h>
 #include "process_handles.h"

 #ifndef NT_SUCCESS
@@ -70,6 +70,12 @@
     NonPagedPoolCacheAlignedMustS
 } POOL_TYPE, *PPOOL_TYPE;

+typedef struct _UNICODE_STRING {
+  USHORT  Length;
+  USHORT  MaximumLength;
+  PWSTR  Buffer;
+} UNICODE_STRING, *PUNICODE_STRING;
+
 typedef struct _OBJECT_TYPE_INFORMATION
 {
     UNICODE_STRING Name;

@giampaolo
Copy link
Owner Author

From g.rodola on October 02, 2010 09:52:11

Thanks to your suggestion I was able to compile psutil with both VS and mingw 32 bits.
I encountered this problem with 64 bit version though (ValueError: 
[u'path']): http://bugs.python.org/issue7511 How do you compile against 64 bit?

@giampaolo
Copy link
Owner Author

From g.rodola on October 02, 2010 10:02:55

btw, I'm using:

python setup.py build --plat-name=win-amd64

...as suggested here: 
http://docs.python.org/distutils/builtdist.html#cross-compiling-on-windows

@giampaolo
Copy link
Owner Author

From [email protected] on October 02, 2010 10:16:10

I have Visual Studio 2008 Professional installed and never 
encountered that bug. A simple "python setup.py build" works.

@giampaolo
Copy link
Owner Author

From [email protected] on October 02, 2010 19:07:21

Regarding ntdef.h, the merge we've been looking at from wj32 included 
bits from ntdef.h that we are using also. I've got the DDK installed 
and in previous releases we'd just assumed/required that people had the DDK. 

As far as the ValueError you're getting, the comments in that issue 
7511 you linked on the Python tracker also includes some workarounds 
and explanations for the cause. The problem is you're using the 
Express Edition of VS, cjgohlke is using Professional edition and 
there's some issues with Express and distutils.

According to the comments, at least one person says executing 
vcvars32.bat or vcvars64.bat before running
setup.py worked for them. Otherwise there may be some tweaking 
required to the bat files on your system to make this all work with 
Express edition. There's a vcvars4.diff that you may wish to apply, 
it seems to be working for some people.

@giampaolo
Copy link
Owner Author

From g.rodola on October 23, 2010 11:46:24

Issue 119 has been merged into this issue.

@giampaolo
Copy link
Owner Author

From g.rodola on October 25, 2010 10:59:14

I've tried the patch in issue 7511 which turned that ValueError into 
a "Visual Studio Express: need 64-bit tools from the SDK" error.
I've tried to follow these instructions: 
http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L
 ...but I get a "generic trust failure" error when I attempt to 
install Net framework 4. 
Setting up this environment is a nightmare, really.
Jay, I guess you don't have VS 2008 professional, right? =)

@giampaolo
Copy link
Owner Author

From [email protected] on October 25, 2010 11:07:29

Nope sorry, I don't have it installed anywhere - and I've only got 
Windows 2003 and XP, haven't tried Vista or Win 7 yet.

@giampaolo
Copy link
Owner Author

From g.rodola on October 25, 2010 14:00:38

I finally managed to setup VS, tested the patch and committed everything in r738 .
When 0.2.0 will be released I'll make sure to provide a 64 bit 
version of the Windows installer for at least Python 2.7.
Thanks a lot for this.

Summary: Support 64 bit versions of Windows
Status: FixedInSVN
Labels: -Type-Defect Type-Enhancement Milestone-0.2.0

@giampaolo
Copy link
Owner Author

From g.rodola on November 12, 2010 19:14:59

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:54:17

Updated csets after the SVN -> Mercurial migration: r738 == revision b4b5825c5c34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant