pip install on windows failing

Issue #131 closed
Tue created an issue

I’m trying to install petsc for python on windows, using the following command:

pip install petsc petsc4py

However when I do this in anaconda I get the following:

(base) C:\Users\alyfl> pip install petsc --no-cache-dir

Collecting petsc
Downloading https://files.pythonhosted.org/packages/31/0a/aecec2c090617258c813d369e631cb4882bb6844e3bbfed917cb3391035e/petsc-3.11.1.tar.gz (13.6MB)
|████████████████████████████████| 13.6MB 6.4MB/s
Building wheels for collected packages: petsc
Building wheel for petsc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"'; file='"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\alyfl\AppData\Local\Temp\pip-wheel-oi0f_gde' --python-tag cp37
cwd: C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc
Complete output (1 lines):
petsc: this package cannot be built as a wheel

ERROR: Failed building wheel for petsc
Running setup.py clean for petsc
Failed to build petsc
Installing collected packages: petsc
Running setup.py install for petsc ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"'; file='"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\alyfl\AppData\Local\Temp\pip-record-gcsu4zbt\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc
Complete output (32 lines):
running install
PETSc: configure
configure options:
--prefix=C:\Anaconda3\Lib\site-packages\petsc
PETSC_ARCH=arch-python-win-amd64
--with-shared-libraries=1
--with-debugging=0
--with-c2html=0
--with-mpi=0
===============================================================================
Configuring PETSc to compile on your system
===============================================================================
===============================================================================
*** Windows python detected. Please rerun ./configure with cygwin-python. ***
===============================================================================
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py", line 314, in <module>
**metadata)
File "C:\Anaconda3\lib\site-packages\setuptools_init_.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py", line 230, in run
config(prefix, self.dry_run)
File "C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py", line 166, in config
if status != 0: raise RuntimeError(status)
RuntimeError: 3


ERROR: Command errored out with exit status 1: 'C:\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"'; file='"'"'C:\Users\alyfl\AppData\Local\Temp\pip-install-xl_fsd3b\petsc\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\alyfl\AppData\Local\Temp\pip-record-gcsu4zbt\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I have searched around online, for quite a while now, but haven’t been able to find anything, and reading the logfile, it mentions cygwin-python but not much else is offered. How do I resolve this issue?

Comments (5)

  1. Tue reporter

    If windows is not supported, I think this needs to be written clearly on the install page, right now there is absolutely nothing about windows not being supported here:

    https://pypi.org/project/petsc4py/

    And the error message given back, when you try to run it also doesn’t say this.

  2. Lisandro Dalcin

    Well, in the PyPI page you link, if you look down left, you should notice “Operating System: POSIX”. The reason pip install petsc4py does not work is that pip install petsc is not supported on Windows. PETSc is a large project (of which I’m a contributor) and many of it features come from volunteers. So far, no one has contribute a native Windows build, we depend on Cygwin to build PETSc on Windows. I tried to make it work years ago and failed miserably, it involved too much work and I’m lacking enough Windows expertise. An alternative option would be to distribute pre-compiled PETSc and petsc4py binaries, but again, I’m not in a good position to provide and maintain the required infrastructure. You should raise your concerns and complaints to the PETSc users or development mailing list.

  3. Log in to comment