pip install petsc fails on macOS High Sierra
Issue #103
on hold
I do not know if the reported issue is related to this one. I am currently unable to pip install petsc. I am working in a virtual environment and use Python 3.5.2 I do not understand the error message either. Here is the full output of $ pip install :
Collecting petsc
Using cached https://files.pythonhosted.org/packages/5a/6c/494af329ab9bde8fff6aa8667e379c6cb942cbc13d4b1a2e4e27e562e5b3/petsc-3.9.2.tar.gz
Installing collected packages: petsc
Running setup.py install for petsc ... error
Complete output from command /Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/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 /private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-record-mpkszpgr/install-record.txt --single-version-externally-managed --compile:
running install
PETSc: configure
configure options:
--prefix=/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-packages/petsc
PETSC_ARCH=arch-python-macosx-10.6-x86_64
--with-shared-libraries=1
--with-debugging=0
--with-c2html=0
--with-cc=/usr/local/bin/mpicc
--with-cxx=/usr/local/bin/mpicxx
--with-fc=/usr/local/bin/mpif90
Configure does not support Python 3 yet, attempting to run as
python2 './configure' '--prefix=/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-packages/petsc' 'PETSC_ARCH=arch-python-macosx-10.6-x86_64' '--with-shared-libraries=1' '--with-debugging=0' '--with-c2html=0' '--with-cc=/usr/local/bin/mpicc' '--with-cxx=/usr/local/bin/mpicxx' '--with-fc=/usr/local/bin/mpif90'
Traceback (most recent call last):
File "./configure", line 12, in <module>
os.execlp('python2', 'python2', *sys.argv)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/Resources/Python.app/Contents/MacOS/../../../../lib/python3.5/os.py", line 598, in execlp
execvp(file, args)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/Resources/Python.app/Contents/MacOS/../../../../lib/python3.5/os.py", line 615, in execvp
_execvpe(file, args)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/Resources/Python.app/Contents/MacOS/../../../../lib/python3.5/os.py", line 660, in _execvpe
raise last_exc.with_traceback(tb)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/Resources/Python.app/Contents/MacOS/../../../../lib/python3.5/os.py", line 650, in _execvpe
exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/petsc/setup.py", line 296, in <module>
**metadata)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/petsc/setup.py", line 212, in run
config(prefix, self.dry_run)
File "/private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/petsc/setup.py", line 148, in config
if status != 0: raise RuntimeError(status)
RuntimeError: 256
----------------------------------------
Command "/Users/marco.magliulo/Library/Enthought/Canopy/edm/envs/User/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/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 /private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-record-mpkszpgr/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dh/33jm7d0j1ss8vy_3786wjlg9p0cf6h/T/pip-install-vek1_hto/petsc/
Note: when I do pip install petsc with Python 3.6.5, everything goes fine
Comments (3)
-
-
@MarcoMagliulo Any news? Can I close this issue?
-
- changed status to on hold
- Log in to comment
PETSc needs a Python 2 interpreter to run its own
configure
script. Given that you are using Python 3, you need to somehow expose apython2
command in your$PATH
. Still not sure why things works with 3.6.5, but maybe somehow in that environment you have Python 2 available as well?In any case,
pip install petsc
is expected to fail from time to time. PETSc is not a Python package, and it has been quite difficult over the years to keep it pip-installable. My recommendation is always to build PETSc by hand with the usualconfigure --prefix=<previx> && make && make install
, thenexport PETSC_DIR=<prefix>
, and finallypip install petsc4py
.Or maybe start using Anaconda Python and the conda-forge packages, we already provide petsc,slepc and the *4py packages (though we do not support complex numbers yet).
So, in short, try to add to your PATH some directory that have a
python2
command available, and try again.