[petsc-users] Libraries destination directory is non-standard
Barry Smith
bsmith at mcs.anl.gov
Fri Jan 9 23:45:25 CST 2015
Juan Luis,
The intention of the setup.py is so that people can do things like
$ sudo pip install https://bitbucket.org/petsc/petsc/get/master.tar.gz#egg=petsc-master
100% |################################| 13.3MB 881kB/s
Installing collected packages: petsc-master
Running setup.py install for petsc-master
PETSc: configure
configure options:
PETSC_ARCH=macosx-10.10-intel-python
--with-shared-libraries=1
--with-debugging=0
--with-c2html=0
--with-sowing=0
--with-fc=0
--with-cxx=0
--with-mpi=0
...
--destDir=/Library/Python/2.7/site-packages/petsc
--prefix=/Library/Python/2.7/site-packages/petsc
*** Using PETSC_DIR=/private/tmp/pip-build-z0Odnn/petsc-master PETSC_ARCH=macosx-10.10-intel-python ***
*** Installing PETSc at prefix location: /Library/Python/2.7/site-packages/petsc ***
====================================
Install complete.
Now to check if the libraries are working do (in current directory):
make PETSC_DIR=/Library/Python/2.7/site-packages/petsc PETSC_ARCH="" test
====================================
Successfully installed petsc-master
$ sudo PETSC_DIR=/Library/Python/2.7/site-packages/petsc PETSC_ARCH="" pip install
https://bitbucket.org/petsc/petsc4py/get/master.tar.gz#egg=petsc4py-master
Collecting petsc4py-master from https://bitbucket.org/petsc/petsc4py/get/master.tar.gz#egg=petsc4py-master
Downloading https://bitbucket.org/petsc/petsc4py/get/master.tar.gz (216kB)
100% |################################| 217kB 467kB/s
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from petsc4py-master)
Requirement already satisfied (use --upgrade to upgrade): Cython>=0.15 in /Library/Python/2.7/site-packages/Cython-0.21.2-py2.7-macosx-10.10-intel.egg (from petsc4py-master)
Installing collected packages: petsc4py-master
Running setup.py install for petsc4py-master
cythonizing 'petsc4py.PETSc.pyx' -> 'petsc4py.PETSc.c'
cythonizing 'libpetsc4py/libpetsc4py.pyx' -> 'libpetsc4py/libpetsc4py.c'
PETSC_DIR: /Library/Python/2.7/site-packages/petsc
....
removing /tmp/tmpwZjccQ.py
Successfully installed petsc4py-master
~/Src
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import petsc4py
>>> petsc4py.init()
That is the setup is so that users can easily install PETSc for use from petsc4py and then easily install petsc4py without ever needing to directly worry about configure, make, etc etc .... themselves.
Make sense?
(Also I think it should be fine to use --download-suitesparse options etc with the setup.py though I have not tested it.)
Barry
I'll check with Lisandro about eliminating the need for that PETSC_DIR=/Library/Python/2.7/site-packages/petsc PETSC_ARCH=""
since petsc4py should automatically check if PETSc libs are install for python and use them;
> On Jan 9, 2015, at 11:51 AM, Juan Luis Cano <juanlu001 at gmail.com> wrote:
>
> Hello Satish, I reply you inline:
>
> On 2015-01-08 21:46, Satish Balay wrote:
>> For one - I think each external package should be packaged separately
>> - and packagers should not rely on --download-package functionality.
>
> Fair point. Doing it this way was just easy, but you are right I should decouple the external packages. That is unrelated to my problem though.
>
>> Secondly - petsc/umfpack etc libs will get installed in
>> $PREFIX/lib/python2.7/site-packages/petsc/lib only if petsc is
>> configured with the option:
>>
>> --prefix=$PREFIX/lib/python2.7/site-packages/petsc/lib
>>
>> Perhaps there is an error here? You can check [or send us]
>> configure.log created by PETSc.
>
> Actually this is unsurprising to me, because all Python modules (i.e. those installed via 'python setup.py install') go to $PREFIX/lib/python2.7/site-packages, and I didn't expect petsc to be an exception.
>
> After reading your reply I inspected the resulting files and probably PETSc is not meant to be there, which makes me wonder if I should use the Python installer in the first place. The 'setup.py' way is mentioned nowhere in the docs...
>
> I just switched to traditional './configure && make' and now the libraries are where I wanted. I had to specify PETSC_DIR though when building petsc4py but that is fine. I should probably take the same path with slepc.
>
> Problem solved! But what is the status of the setup.py installation procedure then?
>
> Answering Barry too:
>
> On 2015-01-09 00:58, Barry Smith wrote:
>> 2) For the longer term we'd like to make it trivial for things work as you desire. We've revamped our installation process in the developer version of PETSc http://www.mcs.anl.gov/petsc/developers/index.html (git branch barry/namespace-install) and would be happy to work with you to get that version to to have the support you require. I'm guessing that we could add an optional argument to our setup.py that allows you to bypass the extra 'petsc' in the installation directory and we'd be happy to add that.
>
> Thanks for your support. Perhaps this is not needed anymore given the above, but what are the changes that you introduced specifically? As there is no readme it is difficult to me to figure it out, as I am not familiarized with PETSc source code...
>
> Juan Luis
More information about the petsc-users
mailing list