Python Forum

Full Version: Could not find a version that satisfies the requirement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings to those that work on Saturday ! Wink Big Grin

I noted I cannot install any of the modules from the network.
The error goes usually like this:

ERROR: Could not find a version that satisfies the requirement wmi (from versions: none)
ERROR: No matching distribution found for wmi

And a lot of lines like thisone:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001C3F8A81C70>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/wmi/

Does it mean I should find the correct version of Python for a specific module to be installed?
I have Python X-64 3.8xx installed
Thank you.
'Any of the modules' any of what modules?
If you're trying to install a pypi package, from command line, use:
pip install packagename
I tried to install a lot of modules -all failed.
Now I'm trying to install 'wmi' same story.
Was wondering if I should use a different method....

Thank you.
I'm trying to get process IDs( Names) using Python.
I found a snippet online:
import wmi 
f = wmi.WMI()
print("pid   Process name")
 
for process in f.Win32_Process():
    print(f"{process.ProcessId:<10} {process.Name}")
It produces a bunch of errors. About some modules. including "WMI"
I installed "WMI" manually without errors using the command :
C:\Users\Someuser\Downloads\Python_Modules\WMI\dist\WMI-1.5.1 python setup.py install

But it still gives me tons of errors about some modules including "WMI".

Question,
is there any reliable way, without weeks to debugging "WMI/Win32API" modules, to get this working on Windows?
Or you guys just using Powershell and other means to do this?

Thank you.
It is solved now.
I found module "psutil" does what I need.
And for some reason, I was be able to install it!
and the code I found online works fine.

import psutil
# List of current running process IDs.
pids = psutil.pids()
print("psutil.pids() = {0}".format(pids))

for proc in psutil.process_iter():
    try:
        pinfo = proc.as_dict(attrs=['pid', 'name'])
    except psutil.NoSuchProcess:
        pass
    else:
        print(pinfo)
Thank you!
That error message is typical network(firewall ect..) problem on your side.
Can try with a proxy and see if that work.

Example check that pip is updated(newest 21.1.3) an how to use proxy.
Free Proxy List these can down fast so have try serval.
# Test pip
G:\div_code
λ pip -V
pip 21.1.3 from c:\python39\lib\site-packages\pip (python 3.9)

# Use proxy
G:\div_code
λ pip install --proxy="http://41.190.147.158:54018" wmi
Collecting wmi
  Using cached WMI-1.5.1-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: pywin32 in c:\python39\lib\site-packages (from wmi) (300)
Installing collected packages: wmi
Successfully installed wmi-1.5.1
Other stuff to try.
python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
Can also try to install the newest Python version.