Where is your python from? What does $ which python say? Please note that on Mac you need homebrew installed Python. Python from anaconda is not supported on any platform, as anaconda doesn’t support virtualenv, which we do need.
On 4 Feb 2016, at 22:29, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
I noticed that my PYTHONPATH was pointing to Library so I removed that from my bashrc and then reinstall firedrake from scratch. Now neither py.test not python work in terms of being able to import firedrake
(firedrake)am-laptop24:firedrake fpoulin$ py.test tests/test_0init.py =============================================================================== test session starts ================================================================================ platform darwin -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 rootdir: /Users/fpoulin/software/firedrake/src/firedrake, inifile: collected 0 items / 1 errors
====================================================================================== ERRORS ====================================================================================== _______________________________________________________________________ ERROR collecting tests/test_0init.py _______________________________________________________________________ tests/test_0init.py:3: in <module> from firedrake import * firedrake/__init__.py:31: in <module> from firedrake.assemble import * firedrake/assemble.py:9: in <module> from firedrake import assemble_expressions firedrake/assemble_expressions.py:17: in <module> from firedrake import function firedrake/function.py:14: in <module> from firedrake import functionspace firedrake/functionspace.py:16: in <module> from firedrake import dmplex E ImportError: cannot import name dmplex ============================================================================= 1 error in 0.78 seconds ==============================================================================
When I look at the sys.path in python I get this mess. At the bottom you will see that it is pointing to LIbrary, which is no t in my python path. Not sure why that was added.
import sys sys.path ['', '/usr/local/lib/python2.7/site-packages/cbcdns-1.0.0-py2.7.egg', '/Users/fpoulin/software/pyqg', '/Users/fpoulin/software/pyro2', '/Users/fpoulin/software/SPINSpy', '/Users/fpoulin/software/firedrake/src/firedrake', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/fpoulin/Library/Python/2.7/lib/python/site-packages', '/usr/local/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages/distarray-0.6.0_dev-py2.7.egg', '/Library/Python/2.7/site-packages/numpy-1.9.2-py2.7-macosx-10.9-intel.egg', '/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg', '/Library/Python/2.7/site-packages']
Below is what happens when I try importing firedrake. It seems to have problems with petsc4py.
(firedrake)am-laptop24:firedrake fpoulin$ python Python 2.7.11 (default, Jan 22 2016, 08:28:37) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import firedrake Traceback (most recent call last): File "<stdin>", line 1, in <module> File "firedrake/__init__.py", line 3, in <module> import firedrake.petsc as petsc File "firedrake/petsc.py", line 3, in <module> import petsc4py ImportError: No module named petsc4py
Note that I did specify the following before I installed.
PETSC_CONFIGURE_OPTIONS="--download-ctetgen --download-triangle --download-chaco --download-metis --download-parmetis --download-scalapack --download-hypre --download-mumps --download-netcdf --download-hdf5 --download-exodusii"
On ubuntu I see that petsc4py is in the following
/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/petsc4py/__init__.pyc
For my mac, there are site-packages but not for firedrake, but for the Library. Presumably it should be doing this in my firedrake directory?
When I used ipython, which does import correctly, I get the following. No /LIbrary that I can see. However, it does add my anaconda, but I wanted to install this using my homebrew version of python. So not sure why those are there but at least they are not causing problems.
In [4]: sys.path Out[4]: ['/Users/fpoulin/software/firedrake/lib/python2.7/site-packages', '', '/Users/fpoulin/software/firedrake/lib/python2.7/site-packages/h5py-2.5.0-py2.7-macosx-10.10-x86_64.egg', '/Users/fpoulin/software/anaconda/bin', '/Users/fpoulin/software/pyqg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/TwoDimBoussinesq-0.1.dev1-py2.7.egg', '/Users/fpoulin/software/pyro2', '/Users/fpoulin/software/SPINSpy', '/Users/fpoulin/software/firedrake/src/firedrake', '/Users/fpoulin/software/anaconda/lib/python27.zip', '/Users/fpoulin/software/anaconda/lib/python2.7', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-darwin', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-mac', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-tk', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-old', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-dynload', '/Users/fpoulin/.local/lib/python2.7/site-packages', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/Sphinx-1.3.1-py2.7.egg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/aeosa', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/IPython/extensions', '/Users/fpoulin/.ipython']
I then decided to force an upgrade for ipython, thinking that was a *good* idea and then I broke it. Running the test breaks,
(firedrake)am-laptop24:firedrake fpoulin$ ipython tests/test_0init.py WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /Users/fpoulin/software/firedrake/src/firedrake/tests/test_0init.py in <module>() 20 if __name__ == '__main__': 21 import os ---> 22 pytest.main(os.path.abspath(__file__))
/Users/fpoulin/software/firedrake/lib/python2.7/site-packages/_pytest/config.pyc in main(args, plugins) 36 try: 37 try: ---> 38 config = _prepareconfig(args, plugins) 39 except ConftestImportFailure as e: 40 tw = py.io.TerminalWriter(sys.stderr)
/Users/fpoulin/software/firedrake/lib/python2.7/site-packages/_pytest/config.pyc in _prepareconfig(args, plugins) 103 elif not isinstance(args, (tuple, list)): 104 if not isinstance(args, str): --> 105 raise ValueError("not a string or argument list: %r" % (args,)) 106 args = shlex.split(args) 107 config = get_config()
ValueError: not a string or argument list: u'/Users/fpoulin/software/firedrake/src/firedrake/tests/test_0init.py' (firedrake)am-laptop24:firedrake fpoulin$ which pip /Users/fpoulin/software/firedrake/bin/pip (
It also complains about not finding petsc4py.
For my new broken version of ipython I get the following path,
In [4]: sys.path Out[4]: ['/Users/fpoulin/software/firedrake/lib/python2.7/site-packages', '', '/Users/fpoulin/software/firedrake/lib/python2.7/site-packages/h5py-2.5.0-py2.7-macosx-10.10-x86_64.egg', '/Users/fpoulin/software/anaconda/bin', '/Users/fpoulin/software/pyqg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/TwoDimBoussinesq-0.1.dev1-py2.7.egg', '/Users/fpoulin/software/pyro2', '/Users/fpoulin/software/SPINSpy', '/Users/fpoulin/software/firedrake/src/firedrake', '/Users/fpoulin/software/anaconda/lib/python27.zip', '/Users/fpoulin/software/anaconda/lib/python2.7', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-darwin', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-mac', '/Users/fpoulin/software/anaconda/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-tk', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-old', '/Users/fpoulin/software/anaconda/lib/python2.7/lib-dynload', '/Users/fpoulin/.local/lib/python2.7/site-packages', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/Sphinx-1.3.1-py2.7.egg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/setuptools-17.1.1-py2.7.egg', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/aeosa', '/Users/fpoulin/software/anaconda/lib/python2.7/site-packages/IPython/extensions', '/Users/fpoulin/.ipython']
Sorry for all the mess but if someone had some advance I would be happy to test it out. Also, I presume I should rebuild it since I broke ipython
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Homolya, Miklós [m.homolya14@imperial.ac.uk] Sent: Thursday, February 04, 2016 3:47 PM To: firedrake Subject: Re: [firedrake] upgrading firedrake
I upgraded ipython and when I try importing firedrake it doesn't give an error, presumably that worked?
Yes.
but when I try it in python I get the following error. It now seems to be complaining that it has problems with petsc4py, which is something I installed in my other version of python.
Seems like your python picks up the wrong petsc4py for some reason. What is the value of the following environment variables?
PYTHONPATH PETSC_DIR PETSC_ARCH
What does "import sys; sys.path" print if you type it in python and in ipython?
Should I try removing petsc4py from all my versions of python and then reinstall?
That may help, yes.
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 04 February 2016 19:24 To: firedrake Subject: Re: [firedrake] upgrading firedrake
I upgraded ipython and when I try importing firedrake it doesn't give an error, presumably that worked?
but when I try it in python I get the following error. It now seems to be complaining that it has problems with petsc4py, which is something I installed in my other version of python.
Should I try removing petsc4py from all my versions of python and then reinstall?
from firedrake import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "firedrake/__init__.py", line 3, in <module> import firedrake.petsc as petsc File "firedrake/petsc.py", line 5, in <module> petsc4py.init(sys.argv) File "/Users/fpoulin/Library/Python/2.7/lib/python/site-packages/petsc4py/__init__.py", line 42, in init PETSc = petsc4py.lib.ImportPETSc(arch) File "/Users/fpoulin/Library/Python/2.7/lib/python/site-packages/petsc4py/lib/__init__.py", line 29, in ImportPETSc return Import('petsc4py', 'PETSc', path, arch) File "/Users/fpoulin/Library/Python/2.7/lib/python/site-packages/petsc4py/lib/__init__.py", line 64, in Import module = imp.load_module(fullname, fo, fn, stuff) ImportError: dlopen(/Users/fpoulin/Library/Python/2.7/lib/python/site-packages/petsc4py/lib/darwin10.6.0-c-debug/PETSc.so, 2): Library not loaded: /sw/lib/openmpi/libmpi.1.dylib Referenced from: /Users/fpoulin/Library/Python/2.7/lib/python/site-packages/petsc4py/lib/darwin10.6.0-c-debug/PETSc.so Reason: image not found
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Homolya, Miklós [m.homolya14@imperial.ac.uk] Sent: Thursday, February 04, 2016 1:39 PM To: firedrake Subject: Re: [firedrake] upgrading firedrake
py.test is only for running tests (which were written for py.test).
Otherwise you can just use python to run firedrake scripts. For interactive sessions, ipython provides a better experience (you can pip install ipython).
Once you are in python (or ipython), just:
from firedrake import *
and go ahead using Firedrake.
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 04 February 2016 18:33 To: firedrake Subject: Re: [firedrake] upgrading firedrake
I agree that is good news for the tests.
Unfortunately, I can't use py.test to open up a python session. Any ideas what I should do?
Francis
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Homolya, Miklós [m.homolya14@imperial.ac.uk] Sent: Thursday, February 04, 2016 1:32 PM To: firedrake Subject: Re: [firedrake] upgrading firedrake
You should use py.test to run the tests. 'make alltest' uses py.test as well.
The output shows that all the tests in tests/test_0init.py has passed, which is definitely a success.
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 04 February 2016 18:28 To: firedrake Subject: Re: [firedrake] upgrading firedrake
Ah, thanks.
I properly installed pytest.
I ran the following with some success
py.test tests/test_0init.py
Does this mean I should replace my python with py.test or something else?
=============================================================================================== test session starts ================================================================================================ platform darwin -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 rootdir: /Users/fpoulin/software/firedrake/src/firedrake, inifile: collected 2 items
tests/test_0init.py ..
============================================================================================= 2 passed in 0.71 seconds =============================================================================================
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Homolya, Miklós [m.homolya14@imperial.ac.uk] Sent: Thursday, February 04, 2016 1:24 PM To: firedrake Subject: Re: [firedrake] upgrading firedrake
Seems like you already have a pytest outside your virtualenv which gets picked up. You can force the installation of pytest inside the virtualenv by
pip install --ignore-installed pytest
Using
pip install --upgrade pytest
might also work.
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 04 February 2016 18:20 To: firedrake Subject: Re: [firedrake] upgrading firedrake
Thanks for the reply.
First I tried to install pytest and it seemed to already be there.
I then tried py.test and it added a couple of new tests at the beginning. It's still running but they seem to be passing. In particular, tests/test_0init.py passes, but when I try
python tests/test_0init.py
it fails because it can't import firedrake. There seems to be a problem with how the libraries are set up, as suggested by previous emails.
(firedrake)am-laptop24:firedrake fpoulin$ pip install pytest Requirement already satisfied (use --upgrade to upgrade): pytest in /usr/local/lib/python2.7/site-packages Requirement already satisfied (use --upgrade to upgrade): py>=1.4.29 in /usr/local/lib/python2.7/site-packages (from pytest) (firedrake)am-laptop24:firedrake fpoulin$ py.test ========================================================== test session starts ========================================================== platform darwin -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 rootdir: /Users/fpoulin/software/firedrake/src/firedrake, inifile: collecting 2 items collected 3589 items / 4 errors
pylit/doc/examples/testfile_literate.py.txt F pylit/doc/examples/testmod_literate.py.txt F tests/test_0init.py F. tests/test_ffc_interface.py .......... tests/benchmarks/test_assembly_overheads.py ssssssssssssssssssssssssss
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Homolya, Miklós [m.homolya14@imperial.ac.uk] Sent: Thursday, February 04, 2016 1:00 PM To: firedrake Subject: Re: [firedrake] upgrading firedrake
python tests/test_0init.py
Please try py.test instead of python.
If you have no py.test (in your virtualenv), install it with:
pip install pytest
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 04 February 2016 17:58 To: firedrake Subject: Re: [firedrake] upgrading firedrake
Hello,
Since yesterday I have reinstalled firedrake on my mac and still get the same issues.
What I don't understand is that when I do make alltest it seems to run most of the tests ok. But when I try running
python tests/test_0init.py
it fails.
Any idea what make alltest does differently that would work?
Francis
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake