-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Wine support #1448
Comments
Mmm... I wonder if you have IPv6 support at all. Could you try this? import socket
print(socket.has_ipv6)
print(hasattr(socket, "AF_INET6")) |
I guess it would be good not to use RtlIpv6AddressToStringA, but do it yourself, to keep WINE compatibility, until they put that symbol into their dll |
Could you please also try what happens with psutil 5.5.1 if you do this? import socket, psutil
s = socket.socket(socket.AF_INET6)
s.bind(('::1', 0))
s.listen(5)
print(psutil.Process().connections()) On a system supporting the IPv6 stack it should print:
|
I downgraded my app to 5.5.1 and there I can import PSUTIL
At least I can import PSUTIL and use other, non-IPV6 related functions ! |
dunno if You noticed my edit - bump ;-) |
OK, thanks. I know what to do. I will work on a fix soon. |
thats really great - a pleasure as always ;-) |
OK, fixed. Do you have Visual Studio installed so that you can make sure latest GIT version works? If not I could send you a pre-compiled wheel (but I need the exact python version and whether it's 32 or 64 bit). |
Dear Giampaolo, I compiled with VS2017 and installed on Wine 32 Bit, Python Version 3.7.2 - it works fine !!! |
Cool. ;) |
FYI, I can import psutil now, and use the non-IPV6 functions as before - but IPV6 still seem not to work on WINE32 (what is not a problem, at least for me) :
when You are going to release 5.6.1, then I can clean my requirement.txt files ;-) ??? |
BTW, WINE Debug says:
dunno if You really stick to that function, or if You are willing to work around ... |
Does this happen with latest GIT code? |
Sorry, I checked twice and made a mistake !
all good ... ;-) except that IPV6 is not really working ;-) |
OK, then it's good. Unfortunately we cannot support IPv6 on Wine because Also, on a totally different matter, this is probably the first time I receive a report about Wine. Could you please try |
sure, here it is - if You need more tests, just let me know !
|
Tests don't start because they fail on import. You can comment that out and set |
FWIW I filed a ticket on Wine bugtracker for |
yes - I am sure the will be issues ;-) |
I committed ffe8a9d so now you should be able to at least run tests. |
hold on ... I recompile / reinstall and give it a try ... |
unfortunately I can not pipe the results into a file ... it hangs at the last test : psutil.tests.test_process.TestProcess.test_num_ctx_switches ...
|
BTW - I am using wine 4.3 development - there might be different test results with wine-stable (conservative) or wine-staging (bleeding edge) |
Mmm I installed wine on Ubuntu, then tried to install python3.7 win installer and indeed failed. I tried to copy C:\pyhon37\ installation from a Windows installation into Linux and executed |
giampaolo, do You have some messenger - I give You a crash course. |
Are You still interested in installing WINE ? Its really cool, just give it a try. I have some production applications running on wine with great success - and in most cases it is much faster and stable then on Windows - as long as Your Software does not need any API Calls which are not included in WINE´s nt.dll |
@bitranox I'm already on Linux. And I also have a Windows 10 in VirtualBox. I basically need some instructions on how to install Wine, but I prefer to use this ticket (as opposed to remote remote desktop). |
I just released psutil 5.6.1 which includes a fix for this issue which should target systems not supporting IPv6 (if any). I'm gonna close this issue as fixed and will treat Wine support in a separate one. @bitranox feel free to continue the discussion here for now though. |
ok, here a very quick "howto"
so lets install wine-develop - You can Install 32 Bit and 64 Bit Windows machines in parallel (generally, as many windows machines as You like)
At this stage we installed Wine - but no Machines until now. If You dont need that machine anymore, just simply delete that directory. Or copy it, to have a second, indipendent machine (as You might do it with vm-containers) If You only install one Windows machine thats fine - but You might to use many for development, so we setup two machines for now.
ok, we set up two machines now.
lets also create a new volume for all the wine machines :
ok - now lets start our first program on wine - but on which wine-prefix (context / machine / whatever You want to call it)
or
ok - so lets configure the machines a bit with winecfg - its pretty self-explaning, You can Set which Version of Windows it should report to programs, etc. ( I use usually WINDOWS10)
once You are fine with Your configuration, just copy the whole wine directory to have a backup, there are countless settings on wine You can set, You might use original Windows DLL if the wine dll does not work, and so on. ok, but You want to Install Python : so just copy the installations (I used some Installations of a Windows10 machine):
now You should clean the permissions and ownerships with the small script mentioned above. so lets test python on wine now :
and
voila ! everything else You can do in the wineconsole, like pip install and so on ... I hope that was helpful, in case of any questions, let me know ! Robert |
just curiouse - did it work as expected ? |
Sorry but don't have time right now. I will try to get back to this later. |
I set up travis integration for Python on WINE |
For clarity, I would welcome Wine support but since that:
...I don't expect this to happen any time soon (plus I will be in China for the next 2 months, so I won't have a lot of free time). Of course if you want to start working on a PR which would give a rough idea about Wine you have my blessing. =) |
no problem at all - as long as I can import it ;-) |
Yeah, I also don't particularly like the food (too fried and oily). I'll bring some pasta and moka. =) |
* origin/master: (150 commits) Linux / CPU freq, fixes giampaolo#1481 improve pmap.py script reuse ps.py script in psutil.test() move get_terminal_size() in _compat.py improve ps.py script improve ps.py script move bytes2human() into psutil._common and reused it from scripts dir fix windows failure re. py 2 vs. 3 fix linux tests fix giampaolo#1474: fix formatting of psutil.tests() which mimicks 'ps aux' output give CREDITS for giampaolo#1480 remove outdated tests Fix read access violation in psutil.cpu_count(logical=False) (giampaolo#1480) update doc update doc [Win] Process IO priority constants + high priority (giampaolo#1479 / giampaolo#1476) don't fail if there are not prev failed tests fix giampaolo#1478: add make command to re-run tests failed on last run [Win] return value is not properly handled for undocumented NT* Windows APIs. (giampaolo#1477) fix error on py 2.7 where OSError doesn't always have winerror attribute update HISTORY for giampaolo#1475 properly check OSError.winerror refactor ionice() on Linux refactor ionice() on Linux ionice test refactoring giampaolo#1404: fix regression not returning CPUs > 9 give CREDITS to Daniel Beer for giampaolo#1471 Fix spurious exception when iterating processes on Solaris (giampaolo#1471) give CREDITS for giampaolo#1470 Fix corner case when /etc/mtab doesn't exist and procfs=/proc (giampaolo#1470) update DEVNOTES Typo fixed (giampaolo#1469) giampaolo#1458: implement colors on Windows update HISTORY / CREDITS, fix some C warnings Make uptime type consitent to fix boot time error. (giampaolo#1225) fix giampaolo#1463: cpu_distribution.py script is broken update issue template issue giampaolo#1404 / linux / phys CPUs count Big docfix (giampaolo#1464) Big docfix (giampaolo#1464) Make tests invariant to LANG setting (giampaolo#1462) test runner: show errors on KeyboardInterrupt test runner refactoring (avoid code duplication) Coloured tests (giampaolo#1459) pre-release [Windows] calculate USS memory by using NtQueryVirtualMemory (giampaolo#1453) fix version highlighting in docs/index (giampaolo#1455) fix version highlighting in README (giampaolo#1454) run win specific tests twice as fast test refactoring test: avoid failing at import time mention how to run tests in INSTALL guide giampaolo#1448: fix Wine support due to missing rtlIpv6AddressToStringA update HISTORY Fix giampaolo#1329: [AIX] disable some functions based on availability in libperfstat (giampaolo#1349) bump up version, fix some doc issues fix ResourceWarning pre-release fix giampaolo#1447: we weren't use @wrap_exceptions around oneshot() (doh\!) update doc + change git hook location update doc make pre-release checks/install src dist in a venv add new make command to check tar.gz sanity move doc; rephrase it a bit add issue templates for 'bug' and 'enhancement' types remove issue template commited by accident Update issue templates giampaolo#1291: (BACKWARD-INCOMPATIBLE) remove memory_maps() on OSX Restore Win-7 support on GIT master (5.5.1 was OK) (giampaolo#1446) try to fix ntext.h restore previous def fix compiler warning fix compiler warning fix compiler warning fix compiler warning take defs from PH set proper SYSTEM_PROCESS_INFORMATION struct from PH fix compilation warnings giampaolo#1398 / win / cmdline: call NtQueryInformationProcess twice, the first time to get the right buf size (ProcessHacker does this) update doc better print formatting for print scripts fix giampaolo#1442: use python3 as Makefile default appveyor: run print scripts after tests highlight top 6 slowest calls add printerr() and exit() to shared utils module add arg parser for ad script introduce a new scriptsutils.py private module shared by all internal utils + refactor print_access_speed.py script giampaolo#1291 / OSX: mark memory_maps() as deprecated and make it alwats raise AccessDenied OSX memory_maps() - add error handling add script for to benchmark API calls move access_denied script _assert_alive() refactor (linux) refactor fix NetBSD: Process.connections() may return incomplete results if using oneshot() giampaolo#1439 add win tests related to send_signal(CTRL_C_EVENT) giampaolo#1227 fix win test fix win tests fix backslash warnings refactor README a bit #fix 1438: do not return any parent() for PID 0 + update doc ...
hope You are good. https://github.com/bitranox/install_python_on_wine_and_travis good time in China Xie Xie Robert |
Dear Giampaolo,
please be so kind and fix yours sincerely Robert |
I'm bumping this issue. Here how to reproduce the problem with docker.
|
The fix should be easy: diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c
index ff060a51..60850714 100644
--- a/psutil/_psutil_common.c
+++ b/psutil/_psutil_common.c
@@ -330,8 +330,6 @@ psutil_loadlibs() {
return 1;
RtlIpv6AddressToStringA = psutil_GetProcAddressFromLib(
"ntdll.dll", "RtlIpv6AddressToStringA");
- if (! RtlIpv6AddressToStringA)
- return 1;
// --- Optional
// minimum requirement: Win 7 @bitranox could you please apply the fix above to |
Dear Giampaolo,
I would like to but it is not that easy:
should I take care of I will try to get C++ running on wine, then I can continue ... yours sincerely Robert |
Dear Giampaolo,
https://www.winehq.org/announce/5.10 however - I am still testing and will let You know the results. yours sincerely Robert |
Dear Giampaolo, Unfortunately the installation for In preparation I fixed as soon as Yours sincerely Robert |
There is also a problem with Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.pids()
[32, 56, 68, 104, 148, 180, 204, 224, 280, 288]
>>> psutil.Process(288)
0124:fixme:ntdll:NtQuerySystemInformation (0x00000058,0x20e9c8,0x00000018,(nil)) stub
Traceback (most recent call last):
File "C:\Program Files\Python311\Lib\site-packages\psutil\_common.py", line 443, in wrapper
ret = self._cache[fun]
~~~~~~~~~~~^^^^^
KeyError: <function Process.exe at 0x00000000018AFBA0>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python311\Lib\site-packages\psutil\__init__.py", line 389, in __str__
info["name"] = self.name()
^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\__init__.py", line 621, in name
name = self._proc.name()
^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 759, in name
return os.path.basename(self.exe())
^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 690, in wrapper
raise convert_oserror(err, pid=self.pid, name=self._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 680, in convert_oserror
raise exc
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 688, in wrapper
return fun(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_common.py", line 450, in wrapper
ret = fun(self)
^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 775, in exe
exe = cext.proc_exe(self.pid)
^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 87] 无效参数。: '(originated from NtQuerySystemInformation)'
>>> proc = psutil.Process()
>>> proc
0124:fixme:ntdll:NtQuerySystemInformation (0x00000058,0x20e9c8,0x00000018,(nil)) stub
Traceback (most recent call last):
File "C:\Program Files\Python311\Lib\site-packages\psutil\_common.py", line 443, in wrapper
ret = self._cache[fun]
~~~~~~~~~~~^^^^^
KeyError: <function Process.exe at 0x00000000018AFBA0>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python311\Lib\site-packages\psutil\__init__.py", line 389, in __str__
info["name"] = self.name()
^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\__init__.py", line 621, in name
name = self._proc.name()
^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 759, in name
return os.path.basename(self.exe())
^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 690, in wrapper
raise convert_oserror(err, pid=self.pid, name=self._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 680, in convert_oserror
raise exc
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 688, in wrapper
return fun(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_common.py", line 450, in wrapper
ret = fun(self)
^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\psutil\_pswindows.py", line 775, in exe
exe = cext.proc_exe(self.pid)
^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 87] 无效参数。: '(originated from NtQuerySystemInformation)' Tested on WINE staging 7.22 on Arch Linux, psutil version 5.9.4, Python version 3.11.1. |
@nukemiko Same here. Have you found some solutions? |
psutil can not be imported :
can You somehow switch off IPV6 by parameter on loading ?
or any other solution ?
The text was updated successfully, but these errors were encountered: