problems with notebook
Hello again, I was looking over the firedrake notebooks (thanks for putting those together!) and decided to try running the one that involves adjoint. https://nbviewer.jupyter.org/github/firedrakeproject/firedrake/blob/master/d... I did install scipy and adjoint, as requested, but get an error when I try plotting u_init axes = plot(u_init); The error is copied below. Is there something else that I need to install for this to work? Cheers, Francis --------------------------------------------------------------------------- CompilationError Traceback (most recent call last) <ipython-input-11-ab90b4141777> in <module>() 1 u_init, p_init = w.split() ----> 2 axes = plot(u_init); 3 #axes.set_aspect("equal") 4 #axes.set_title("Velocity") 5 #axes = plot(p_init) /home/fpoulin/software/firedrake/src/firedrake/firedrake/plot.pyc in plot(function_or_mesh, num_sample_points, axes, plot3d, **kwargs) 293 coords = function.ufl_domain().coordinates.dat.data_ro 294 X, Y = coords.T --> 295 vals = np.asarray(function.at(coords)) 296 C = np.linalg.norm(vals, axis=1) 297 U, V = vals.T /home/fpoulin/software/firedrake/src/firedrake/firedrake/function.pyc in at(self, arg, *args, **kwargs) 532 else: 533 p_result = np.empty(value_shape, dtype=float) --> 534 single_eval(points[i:i+1], p_result) 535 l_result.append((i, p_result)) 536 except PointNotInDomainError: /home/fpoulin/software/firedrake/src/firedrake/firedrake/function.pyc in single_eval(x, buf) 510 def single_eval(x, buf): 511 """Helper function to evaluate at a single point.""" --> 512 err = self._c_evaluate(self._ctypes, 513 x.ctypes.data_as(POINTER(c_double)), 514 buf.ctypes.data_as(POINTER(c_double))) /home/fpoulin/software/firedrake/src/PyOP2/pyop2/utils.pyc in __get__(self, obj, cls) 62 if obj is None: 63 return self ---> 64 obj.__dict__[self.__name__] = result = self.fget(obj) 65 return result 66 /home/fpoulin/software/firedrake/src/firedrake/firedrake/function.pyc in _c_evaluate(self) 460 @utils.cached_property 461 def _c_evaluate(self): --> 462 result = make_c_evaluate(self) 463 result.argtypes = [POINTER(_CFunction), POINTER(c_double), POINTER(c_double)] 464 result.restype = c_int /home/fpoulin/software/firedrake/src/firedrake/firedrake/function.pyc in make_c_evaluate(function, c_name, ldargs) 610 ["-I%s/include" % d for d in get_petsc_dir()], 611 ldargs=ldargs, --> 612 comm=function.comm) /home/fpoulin/software/firedrake/src/PyOP2/pyop2/compilation.pyc in load(src, extension, fn_name, cppargs, ldargs, argtypes, restype, compiler, comm) 328 raise CompilationError("Don't know what compiler to use for platform '%s'" % 329 platform) --> 330 dll = compiler.get_so(src, extension) 331 332 fn = getattr(dll, fn_name) /home/fpoulin/software/firedrake/src/PyOP2/pyop2/compilation.pyc in get_so(self, src, extension) 166 Unable to compile code 167 Compile log in %s --> 168 Compile errors in %s""" % (e.cmd, e.returncode, logfile, errfile)) 169 else: 170 cc = [self._cc] + self._cppargs + \ CompilationError: Command "['mpicc', '-std=c99', '-fPIC', '-Wall', '-march=native', '-O3', '-fno-ivopts', '-I/home/fpoulin/software/firedrake/src/firedrake/firedrake', '-I/usr/include', '-I/home/fpoulin/software/firedrake/lib/python2.7/site-packages/petsc/include', '-o', '/tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.so.tmp', '/tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.c', '-shared', '-L/usr/lib', '-lspatialindex_c', '-Wl,-rpath,/usr/lib']" return error status 1. Unable to compile code Compile log in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.log Compile errors in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.err ------------------ 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
Hi Francis,
On 26 Feb 2017, at 22:24, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Compile log in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.log Compile errors in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.err
Can you please post the contents of these files? Along with:
/tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.c
Thanks, Lawrence
Hello, I tried it again and sent you the most recent log, err and c files. The error file shows that it can't fine a header file. /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p3383.c:103:40: fatal error: spatialindex/capi/sidx_api.h: No such file or directory compilation terminated. Cheers, 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 Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk] Sent: Monday, February 27, 2017 2:37 PM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] problems with notebook Hi Francis,
On 26 Feb 2017, at 22:24, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Compile log in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.log Compile errors in /tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.err
Can you please post the contents of these files? Along with:
/tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p6844.c
Thanks, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
Hi Francis,
On 27 Feb 2017, at 22:44, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
I tried it again and sent you the most recent log, err and c files. The error file shows that it can't fine a header file.
/tmp/pyop2-cache-uid1000/7137338dc043a2dcfd35bcc4ecc64e90_p3383.c:103:40: fatal error: spatialindex/capi/sidx_api.h: No such file or directory compilation terminated.
I assume, since the other notebooks work, that you have installed jupyter inside the virtualenv, and launched the notebook server inside the virtualenv. However, it is possible that the "kernel" that the notebook is launching is not right. Can you post the output of: $ jupyter kernelspec list If the python2 kernel does not point to the python in the virtualenv, please run (inside the activated virtualenv): $ ipython kernel install --sys-prefix and then check the kernel spec list again. This should now point to the python2 inside the virtualenv. If you relaunch the notebook server and try again, hopefully that should fix the problem. Thanks, Lawrence
Hello, I assume, since the other notebooks work, that you have installed jupyter inside the virtualenv, and launched the notebook server inside the virtualenv. Yes, that is correct. However, it is possible that the "kernel" that the notebook is launching is not right. Can you post the output of: $ jupyter kernelspec list Copied below. Seems to be pointing at something else, not in my firedrake path. Available kernels: python2 /usr/local/lib/python2.7/dist-packages/ipykernel/resources If the python2 kernel does not point to the python in the virtualenv, please run (inside the activated virtualenv): $ ipython kernel install --sys-prefix Could there be a typo above? When I try just that i get a problem fpoulin@fpoulin-Gazelle:~/Downloads$ ipython kernel install --sys-prefix usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--prefix PREFIX] ipython-kernel-install: error: unrecognized arguments: --sys-prefix I did a bit of searching around but could not find what is wrong. Do you know what else I could try? Cheers, Francis
On 28 Feb 2017, at 14:19, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
$ ipython kernel install --sys-prefix
Could there be a typo above? When I try just that i get a problem
fpoulin@fpoulin-Gazelle:~/Downloads$ ipython kernel install --sys-prefix usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--prefix PREFIX] ipython-kernel-install: error: unrecognized arguments: --sys-prefix
I did a bit of searching around but could not find what is wrong. Do you know what else I could try
This looks like the Firedrake virtualenv was not activated when you tried this. Could you try activating it first and then doing so (the ipython you want is the one in the virtualenv. For example, for me, I have: $ ipython --version 5.2.2 And $ ipython kernel install -h usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--profile PROFILE] [--prefix PREFIX] [--sys-prefix] Thanks, Lawrence
This looks like the Firedrake virtualenv was not activated when you tried this. Could you try activating it first and then doing so (the ipython you want is the one in the virtualenv. For example, for me, I have: $ ipython --version 5.2.2 I seem to get one version lower and a bit, 4.2.0, but it is pointing to the correct ipython. (firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ ipython --version 4.2.0 (firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ which ipython /home/fpoulin/software/firedrake/bin/ipython And $ ipython kernel install -h usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--profile PROFILE] [--prefix PREFIX] [--sys-prefix] Then I don't seem to be able to do the kernel install, see below. (firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ ipython kernel install -h Traceback (most recent call last): File "/home/fpoulin/software/firedrake/bin/ipython", line 11, in <module> sys.exit(start_ipython()) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/__init__.py", line 119, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance app.initialize(argv) File "<decorator-gen-111>", line 2, in initialize File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 296, in initialize super(TerminalIPythonApp, self).initialize(argv) File "<decorator-gen-7>", line 2, in initialize File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/core/application.py", line 397, in initialize self.parse_command_line(argv) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 291, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File "<decorator-gen-4>", line 2, in parse_command_line File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 488, in parse_command_line return self.initialize_subcommand(subc, subargv) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/core/application.py", line 207, in initialize_subcommand return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv) File "<decorator-gen-3>", line 2, in initialize_subcommand File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 419, in initialize_subcommand subapp = import_item(subapp) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/ipython_genutils/importstring.py", line 31, in import_item module = __import__(package, fromlist=[obj]) ImportError: No module named ipykernel.kernelapp Cheers, Francis
On 28 Feb 2017, at 15:16, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
$ ipython kernel install -h usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--profile PROFILE] [--prefix PREFIX] [--sys-prefix]
Then I don't seem to be able to do the kernel install, see below.
Can you try upgrading the python installation: $ pip install -U ipython and then try again with: $ ipython kernel install --sys-prefix Thanks, Lawrence
Thanks for the suggestion. I thought that firedrake-update would update ipython, but I guess not. I will try and remember do that from time to time. As you can see below, I have now joined the modern times and have version 5.3.0, but it still seems to have problem with updating the kernel. I did try it again with jupyter and it still failed. Actually, when I try ipython notebook it fails as well. Should I remove ipython and try reinstalling it? Francis firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ ipython --version 5.3.0 (firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ ipython kernel install --sys-prefix Traceback (most recent call last): File "/home/fpoulin/software/firedrake/bin/ipython", line 11, in <module> sys.exit(start_ipython()) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/__init__.py", line 119, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance app.initialize(argv) File "<decorator-gen-109>", line 2, in initialize File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 300, in initialize super(TerminalIPythonApp, self).initialize(argv) File "<decorator-gen-7>", line 2, in initialize File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/core/application.py", line 446, in initialize self.parse_command_line(argv) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 295, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File "<decorator-gen-4>", line 2, in parse_command_line File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 514, in parse_command_line return self.initialize_subcommand(subc, subargv) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/IPython/core/application.py", line 236, in initialize_subcommand return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv) File "<decorator-gen-3>", line 2, in initialize_subcommand File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/traitlets/config/application.py", line 445, in initialize_subcommand subapp = import_item(subapp) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/ipython_genutils/importstring.py", line 31, in import_item module = __import__(package, fromlist=[obj]) ImportError: No module named ipykernel.kernelapp ------------------ 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 Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk] Sent: Wednesday, March 01, 2017 10:24 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] problems with notebook
On 28 Feb 2017, at 15:16, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
$ ipython kernel install -h usage: ipython-kernel-install [-h] [--user] [--name NAME] [--display-name DISPLAY_NAME] [--profile PROFILE] [--prefix PREFIX] [--sys-prefix]
Then I don't seem to be able to do the kernel install, see below.
Can you try upgrading the python installation: $ pip install -U ipython and then try again with: $ ipython kernel install --sys-prefix Thanks, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
On 1 Mar 2017, at 10:34, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Thanks for the suggestion. I thought that firedrake-update would update ipython, but I guess not. I will try and remember do that from time to time.
Yes, although it runs the upgrade cycle for direct firedrake components, we don't upgrade every package installed inside the virtualenv (since this would take too long, and we don't directly control all of that).
As you can see below, I have now joined the modern times and have version 5.3.0, but it still seems to have problem with updating the kernel. I did try it again with jupyter and it still failed.
Actually, when I try ipython notebook it fails as well.
Should I remove ipython and try reinstalling it?
Oh, sorry, I think the error was not directly ipython. Please also try: $ pip install -U jupyter $ pip install -U ipykernel and then go round again... Thanks, Lawrence
Hello Lawrence, Yes, that did the trick. Sorry for the bother. I realize that normally, we might not want to update everything, including ipython, but is there an option if we wanted to update everything? Might be helpful for people like me who don't know exactly what to update, like ipykernel. Not to see if I can do the exercises in the notebook. Cheers, 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 Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk] Sent: Wednesday, March 01, 2017 10:38 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] problems with notebook
On 1 Mar 2017, at 10:34, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Thanks for the suggestion. I thought that firedrake-update would update ipython, but I guess not. I will try and remember do that from time to time.
Yes, although it runs the upgrade cycle for direct firedrake components, we don't upgrade every package installed inside the virtualenv (since this would take too long, and we don't directly control all of that).
As you can see below, I have now joined the modern times and have version 5.3.0, but it still seems to have problem with updating the kernel. I did try it again with jupyter and it still failed.
Actually, when I try ipython notebook it fails as well.
Should I remove ipython and try reinstalling it?
Oh, sorry, I think the error was not directly ipython. Please also try: $ pip install -U jupyter $ pip install -U ipykernel and then go round again... Thanks, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (2)
- 
                
                Francis Poulin
- 
                
                Lawrence Mitchell