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

[Win] Installation failure on Cygwin #1856

Closed
eabase opened this issue Oct 21, 2020 · 2 comments
Closed

[Win] Installation failure on Cygwin #1856

eabase opened this issue Oct 21, 2020 · 2 comments

Comments

@eabase
Copy link

eabase commented Oct 21, 2020

Win

  • { OS 8/10 }
  • { psutil version: python3 -c "import psutil; print(psutil.version)" }
  • { python version }

Bug description

Installation fails on Py3.8 under Cygwin. This is POSIX compatible and should work just as well as under WSL or any other *nix.

...

$ pip install psutil
Collecting psutil
  Downloading psutil-5.7.2.tar.gz (460 kB)
     |████████████████████████████████| 460 kB 528 kB/s
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.8.exe -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-geen0hz1/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-geen0hz1/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9xffagwt
         cwd: /tmp/pip-install-geen0hz1/psutil/
    Complete output (1 lines):
    platform cygwin is not supported
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Test results
{ output of python -c psutil.tests (failures only, not full result) }


UPDATE 2020-11-07

Apparently Cygwin is not supported as 'posix' nor 'nt', according to these related Issues:

However, there were already some suggested PRs that was (never?) submitted.

@eabase eabase added the bug label Oct 21, 2020
@eabase
Copy link
Author

eabase commented Nov 7, 2020

Because in Cygwin:

# python -c "import os; print('\n'.join([os.name, os.sys.platform]));"
posix
cygwin

# python -c "import sys,os; print(os.uname()[0].split('-')[1]);"
6.3

IMPORTANT: ❗
If you have a native Windows Python installed in your windows path, you will get the wrong results above, as your Cygwin path will copy the windows path under normal settings.
So either uninstall Python from Cygwin, or remove the Python item in the Windows path, from your Cygwin PATH (via ~/.bashrc, for example). You can test what is used with:

echo ${PATH}|tr ":" "\n"

ls -al `which python.exe`
ls -al `which python`

Looks like some initial support could be given by changing, replacing these lines:

CYGWIN = os.sys.platform == "cygwin"
if os.name != 'nt' and os.sys.platform != 'cygwin':

Then, in

  • psutil/setup.py

    Lines 140 to 142 in 241f8ed

    def get_winver():
    maj, min = sys.getwindowsversion()[0:2]
    return '0x0%s' % ((maj * 100) + min)

these lines could be added/replaced with:

def get_winver():
	return os.uname()[0].split('-')[1]

@giampaolo
Copy link
Owner

Cygwin is currently not supported. It's tracked in ticket 82 already.

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

2 participants