justpy-org / justpy

An object oriented high-level Python Web Framework that requires no frontend programming
https://justpy.io
Apache License 2.0
1.22k stars 96 forks source link

Justpy hello not running Windows 10 python 3.9 ModuleNotFoundError: No module named 'psutil._psutil_windows' #624

Closed ejlmljt closed 2 years ago

ejlmljt commented 2 years ago

OS Name Microsoft Windows 10 Home Version 10.0.19044 Build 19044 Other OS Description Not Available OS Manufacturer Microsoft Corporation System Name DESKTOP-6NS2GOU System Manufacturer Winnovo System Model Winnovo N140 System Type x64-based PC

import justpy as jp

def hello_world_readme(): wp = jp.WebPage() d = jp.Div(text='Hello world!') wp.add(d) return wp

jp.justpy(hello_world_readme)

python justpy_test.py

Traceback (most recent call last): File "C:\Users\XXX\OneDrive\Documents\JustPy\justpy_test0.py", line 6, in import justpy as jp File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\site-packages\justpy__init__.py", line 2, in from .justpy import * File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\site-packages\justpy\justpy.py", line 15, in from jpcore.justpy_app import cookie_signer, template_options, handle_event, JustpyApp,JustpyAjaxEndpoint File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\site-packages\jpcore\justpy_app.py", line 14, in import psutil File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil__init__.py", line 109, in from . import _pswindows as _psplatform File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil_pswindows.py", line 35, in from ._psutil_windows import ABOVE_NORMAL_PRIORITY_CLASS

WolfgangFahl commented 2 years ago

@ejlmljt thank your for the bug report. Actually psutil is hopefully not necessary for the operation of justpy so it might be safe to move the import to the parts of the code where it is actually needed. Could you try this out yourself by patching the library our using a git cloned version of justpy? I don't have access to a windows machine and our CI reports that there is no Problem with Windows.

ejlmljt commented 2 years ago

Thanks for the quick reply. I found time to look into the problem further and it was user error. C:\msys64\mingw64\bin\python.exe was ahead of C:\Users\E2ehy\AppData\Local\Programs\Python\Python39\python.exe and C:\Users\E2ehy\AppData\Local\Programs\Python\Python310\python.exe in my Windows PATH so when I ran it with "python justpy_test.py" the wrong python exe was called. Justpy is working when run with python 3.9 and python 3.10 for the first two examples that I have run from you web site. Sorry for the confusion. Eugene

On Sun, Nov 20, 2022 at 10:39 AM Wolfgang Fahl @.***> wrote:

@ejlmljt https://github.com/ejlmljt thank your for the bug report. Actually psutil is hopefully not necessary for the operation of justpy so it might be safe to move the import to the parts of the code where it is actually needed. Could you try this out yourself by patching the library our using a git cloned version of justpy? I don't have access to a windows machine and our CI reports that there is no Problem with Windows.

— Reply to this email directly, view it on GitHub https://github.com/justpy-org/justpy/issues/624#issuecomment-1321177796, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRJ52D3LALNGYJE2TAWPG3WJJH23ANCNFSM6AAAAAASFRMJNA . You are receiving this because you were mentioned.Message ID: @.***>

ejlmljt commented 2 years ago

I found time to look into the problem further  and  it  was  user/machine setup error.  C:\msys64\mingw64\bin\python.exe was ahead  of   C:\Users\E2ehy\AppData\Local\Programs\Python\Python39\python.exe and  C:\Users\E2ehy\AppData\Local\Programs\Python\Python310\python.exe  in  my Windows PATH so when  I ran it with "python justpy_test.py" the wrong  python exe   was   called and could not load the psutil DLL thus causing the error. Justpy  is  working when  run  with  python 3.9 and python 3.10  for the first two examples  that  I have run from you web site. Sorry for the confusion.