DOLFIN/FEniCS integration in other Python installation

Asked by Bento

Hi everybody,

I have an installation of Python(x,y) on my (Windows) Computer. Today I installed the FEniCS package and it created a separate installation. Is it possible to integrate FEniCS into my existing Python 2.6 installation? Calling "from dolfin import *" does not work at the moment.

Thank you!

Till

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Bento
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

This is not supported. However, since you are using Python 2.6 which is the same version as included in the FEniCS binary, you could try to tweak the runme.bat in the FEniCS installation directory to use your copy of Python. For instance, if you have installed Python under C:\Python2.6, then try to change line 7 from

  set PATH=%FENICS_DIR%bin;%FENICS_DIR%Scripts;%FENICS_DIR%lib;%FENICS_DIR%lib\Python26;%PATH%

to this:

  set PATH=%FENICS_DIR%bin;%FENICS_DIR%Scripts;%FENICS_DIR%lib;C:\Python26;%PATH%

Note that this is not tested so it may or may not work.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#2

Hi Johannes,

Thank you for your answer. I was hoping to find a workaround of some sort. Unfortunately I do not manage to compile UFC and DOLFIN from source in Windows. Is there a way to do this without Cygwin?

Revision history for this message
Johan Hake (johan-hake) said :
#3

On Friday January 14 2011 01:34:13 Johannes Ring wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Status: Open => Answered
>
> Johannes Ring proposed the following answer:
> This is not supported. However, since you are using Python 2.6 which is
> the same version as included in the FEniCS binary, you could try to
> tweak the runme.bat in the FEniCS installation directory to use your
> copy of Python. For instance, if you have installed Python under
> C:\Python2.6, then try to change line 7 from
>
> set
> PATH=%FENICS_DIR%bin;%FENICS_DIR%Scripts;%FENICS_DIR%lib;%FENICS_DIR%lib\Py
> thon26;%PATH%
>
> to this:
>
> set
> PATH=%FENICS_DIR%bin;%FENICS_DIR%Scripts;%FENICS_DIR%lib;C:\Python26;%PATH%
>
> Note that this is not tested so it may or may not work.

It would be cool if we were able to provide a more differentiated installation
on Windows. I know a bunch of people who might try it out if it could be made
compatible with their present Python environment.

Sorry for higjacking the question, but how is the Windows build managed,
Johannes? Is it through CMake and msys? Have you tried compiling it using
visual C++? How well do the other packages compile on Windows?

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#4

That would be a cool thing, I offer my help (although my knowledge is rather limited).

Compiling the Python packages FFC, FIAT, Instant, Viper and UFL was no problem on my system. I then used CMake 2.8 to build UFC, but that didn't work out.

Revision history for this message
Johannes Ring (johannr) said :
#5

@Till: You could try to set up the environment variables manually as a workaround. If you look in runme.bat you should be able to figure out what path's you need to set (PATH, PYTHONPATH, PKG_CONFIG_PATH, etc.).

@Johan: Yes, CMake's ExternalProject is used to build the packages and I'm using a regular command prompt in combination with MSYS for those packages that requires a UNIX like environment (e.g. Autotools packages). Visual C++ should work fine but is currently untested AFAIK. The reason for choosing MinGW was that I wanted to ship the compiler with the installer and I'm not sure if that would be feasible with Visual C++.

I haven't successfully compiled packages like OpenMPI/MPICH, PETSc, SLEPc, SCOTCH, ParMETIS, and Trilinos yet, but the other packages is mostly straightforward.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#6

OK, thank you, I will try that tomorrow.
However I would still appreciate a solution to integrate Dolfin into my existing Python installation. I will try again to compile it myself, but so far it did not work out.
Thank you again.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#7

OK, I give up on compiling it myself. I just can't get UFC to build properly, it keeps producing errors.

In the long run that workaround to change the python path in the Fenics-Python is to clumsy for me. Dolfin seemed to be exactly what I was looking for, but I need something that integrates into my usual system and workflow.

If you ever come up with a way to integrate Dolfin into an existing Python installation, then I would be grateful if you let me know.

Thank you anyway!

Till

Revision history for this message
Johan Hake (johan-hake) said :
#8

Too bad!

You have not handed us the error messages you get, or have you already bailed
out? Maybe someone on the list can help?

Johan

On Tuesday January 18 2011 04:17:45 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> OK, I give up on compiling it myself. I just can't get UFC to build
> properly, it keeps producing errors.
>
> In the long run that workaround to change the python path in the Fenics-
> Python is to clumsy for me. Dolfin seemed to be exactly what I was
> looking for, but I need something that integrates into my usual system
> and workflow.
>
> If you ever come up with a way to integrate Dolfin into an existing
> Python installation, then I would be grateful if you let me know.
>
> Thank you anyway!
>
> Till

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#9

OK, I did the following:
-install the python packages FFC, FIAT, Instant, Viper and UFL
-build boost (only libraries filesystem, system, programoptions and the header files)
-get swig 2.0.1

Then I tried to build UFC:
I use MinGW 4.4.0 that came with my Python(x,y) distro. I start CMake 2.8 with gui and load the ufc-1.4.2 source directory, build directory C:\temp
-click "configure"
-choose MinGW Makefiles
-it says "configuring done"
-I manually set the variables BOOST_INCLUDE_DIR, PYTHON_INCLUDE_DIR, PYTHON_LIBRARY, SWIG_EXECUTABLE
-press "configure" and it says:

SWIG_MODULE_LOCATION C:/temp/_ufc.pyd [this line is in red]
Configuring done

-press "configure" again, same ouptput, but this time it releases the "generate" button
-press "generate", it says "Generating done" but it builds nothing

Thats it. In CMake it still says PYTHON_DEBUG_LIBRARY-NOTFOUND and CMAKE_SH-NOTFOUND in the option, but not in the output.
I manually added an entry SWIG_MODULE_LOCATION that points to the location of the ufc.i file inside the source directory, but it does not change anything.

Well, thats it. Not many error messages.

Revision history for this message
Johannes Ring (johannr) said :
#10

Did you try to run make (or mingw32-make) in the build directory after the makefiles was generated by CMake?

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#11

No, I did not this, I thought this is done by CMake, beginners mistake. Now I did and I get a lot of output. The output on the SDTERR handle starts with

C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:2806:32: error: boost/shared_ptr.hpp: No such file or directory
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx: In function 'PyObject* _wrap_delete_finite_element(PyObject*, PyObject*)':
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:3703: error: 'boost' has not been declared
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:3703: error: expected primary-expression before '>' token
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:3703: error: 'tempshared1' was not declared in this scope
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:3704: error: 'boost' has not been declared
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:3704: error: expected primary-expression before '>' token
...

goes on in the same style and then finally ends with

...
C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx:6076: error: expected ';' before ':' token
make[2]: *** [CMakeFiles/_ufc.dir/src/ufc/ufcPYTHON_wrap.cxx.obj] Error 1
make[1]: *** [CMakeFiles/_ufc.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#12

ok, that missing shared_ptr.hpp file is deeper inside the boost directory. I changed BOOST_INCLUDE_DIR to the deeper folder, but it stays the same.

Revision history for this message
Johan Hake (johan-hake) said :
#13

On Tuesday January 18 2011 09:44:58 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> ok, that missing shared_ptr.hpp file is deeper inside the boost
> directory. I changed BOOST_INCLUDE_DIR to the deeper folder, but it
> stays the same.

Could you please tell us where you installed boost, what's in
BOOST_INCLUDE_DIR. Also set CMAKE_VERBOSE_MAKEFILE and paste the command that
fails. It is the line that includes:

  ... -c C:\tempbuild\src\ufc\ufcPYTHON_wrap.cxx ...

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#14

ok. Boost is in C:\Boost\include\boost-1_45\boost (that's where all the .hpp-files are). I just tried BOOST_INCLUDE_DIR and it works better (finds the missing file). It doesn't give the line that you asked for, but it says (with CMAKE_VERBOSE_MAKEFILE checked):

"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:\Till\ufc-1.4.2 -BC:\tempbuild --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_start C:\tempbuild\CMakeFiles C:\tempbuild\CMakeFiles\progress.marks
make -f CMakeFiles\Makefile2 all
make[1]: Entering directory `C:/tempbuild'
make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/depend
make[2]: Entering directory `C:/tempbuild'
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Till\ufc-1.4.2 C:\Till\ufc-1.4.2 C:\tempbuild C:\tempbuild C:\tempbuild\CMakeFiles\_ufc.dir\DependInfo.cmake --color=
make[2]: Leaving directory `C:/tempbuild'
make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/build
make[2]: Entering directory `C:/tempbuild'
Linking CXX shared module _ufc.pyd
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\_ufc.dir\link.txt --verbose=1
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\_ufc.dir/objects.a
C:\PROGRA~1\pythonxy\mingw\bin\ar.exe cr CMakeFiles\_ufc.dir/objects.a @CMakeFiles\_ufc.dir\objects1.rsp
C:\PROGRA~1\pythonxy\mingw\bin\G__~1.EXE -shared -o _ufc.pyd -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\_ufc.dir/objects.a -Wl,--no-whole-archive C:\Python26\libs\python26.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMakeFiles\_ufc.dir/objects.a(ufcPYTHON_wrap.cxx.obj):ufcPYTHON_wrap.cxx:(.text+0x5c): undefined reference to `_imp__PyExc_RuntimeError'
CMakeFiles\_ufc.dir/objects.a(ufcPYTHON_wrap.cxx.obj):ufcPYTHON_wrap.cxx:(.text+0x6d): undefined reference to `_imp__PyExc_IndexError'
CMakeFiles\_ufc.dir/objects.a(ufcPYTHON_wrap.cxx.obj):ufcPYTHON_wrap.cxx:(.text+0x79): undefined reference to `_imp__PyExc_IOError'

...going on like this...

CMakeFiles\_ufc.dir/objects.a(ufcPYTHON_wrap.cxx.obj):ufcPYTHON_wrap.cxx:(.text+0x32c4): more undefined references to `_imp__PyType_Type' follow
CMakeFiles\_ufc.dir/objects.a(ufcPYTHON_wrap.cxx.obj):ufcPYTHON_wrap.cxx:(.text+0x4fb3): undefined reference to `_imp__PyExc_AttributeError'
collect2: ld returned 1 exit status
make[2]: *** [_ufc.pyd] Error 1
make[2]: Leaving directory `C:/tempbuild'
make[1]: *** [CMakeFiles/_ufc.dir/all] Error 2
make[1]: Leaving directory `C:/tempbuild'
make: *** [all] Error 2

Revision history for this message
Johan Hake (johan-hake) said :
#15

On Tuesday January 18 2011 10:09:27 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> ok. Boost is in C:\Boost\include\boost-1_45\boost (that's where all the
> .hpp-files are). I just tried BOOST_INCLUDE_DIR and it works better
> (finds the missing file).

I guess you set BOOST_INCLUDE_DIR to C:\Boost\include\boost-1_45?

Do you have a python26.dll in:

  C:\Python26\libs

It looks like you are trying to link agains the static Python library. If not
you should try to reinstall/compile Python as a shared library.

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#16

Yes, I set the Boost include to the one you said.

I only have a python26.lib in the libs directory.

Revision history for this message
Johan Hake (johan-hake) said :
#17

On Tuesday January 18 2011 10:32:07 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> Yes, I set the Boost include to the one you said.

Ok.

> I only have a python26.lib in the libs directory.

How did you install your present Python?

Johannes: I see that .lib can be a sharedlibrary but only during compilation.
During runtime a .dll is also needed. How are you compiling Python for FEniCS?

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#18

I installed it with the installer that came with Python(x,y):
www.pythonxy.com

2011/1/18 Johan Hake <email address hidden>

> Your question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Johan Hake proposed the following answer:
> On Tuesday January 18 2011 10:32:07 Till B wrote:
> > Question #141422 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/141422
> >
> > Till B posted a new comment:
> > Yes, I set the Boost include to the one you said.
>
> Ok.
>
> > I only have a python26.lib in the libs directory.
>
> How did you install your present Python?
>
> Johannes: I see that .lib can be a sharedlibrary but only during
> compilation.
> During runtime a .dll is also needed. How are you compiling Python for
> FEniCS?
>
> Johan
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/dolfin/+question/141422/+confirm?answer_id=16
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/dolfin/+question/141422
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Johan Hake (johan-hake) said :
#19

Have you looked for a .dll in your python installation? Could you choose to
install shared library or maybe a development version of Python when you
installed pythonxy?

It should be there. When found use that for the PYTHON_LIBRARY variable in
cmake.

Johan

On Tuesday January 18 2011 10:51:27 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Status: Answered => Open
>
> Till B is still having a problem:
> I installed it with the installer that came with Python(x,y):
> www.pythonxy.com
>
>
> 2011/1/18 Johan Hake <email address hidden>
>
> > Your question #141422 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/141422
> >
> > Johan Hake proposed the following answer:
> >
> > On Tuesday January 18 2011 10:32:07 Till B wrote:
> > > Question #141422 on DOLFIN changed:
> > > https://answers.launchpad.net/dolfin/+question/141422
> > >
> > > Till B posted a new comment:
> > > Yes, I set the Boost include to the one you said.
> >
> > Ok.
> >
> > > I only have a python26.lib in the libs directory.
> >
> > How did you install your present Python?
> >
> > Johannes: I see that .lib can be a sharedlibrary but only during
> > compilation.
> > During runtime a .dll is also needed. How are you compiling Python for
> > FEniCS?
> >
> > Johan
> >
> > --
> > If this answers your question, please go to the following page to let us
> > know that it is solved:
> > https://answers.launchpad.net/dolfin/+question/141422/+confirm?answer_id=
> > 16
> >
> > If you still need help, you can reply to this email or go to the
> > following page to enter your feedback:
> > https://answers.launchpad.net/dolfin/+question/141422
> >
> > You received this question notification because you are a direct
> > subscriber of the question.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#20

oh, I found a python.dll, generated a new makefile and - no errors.
But the only thing that happens is that I get a ufc.py. I thought it will produce some output in the program files or the python site-packages folder.

Revision history for this message
Johan Hake (johan-hake) said :
#21

On Tuesday January 18 2011 11:09:43 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> oh, I found a python.dll, generated a new makefile and - no errors.
> But the only thing that happens is that I get a ufc.py. I thought it will
> produce some output in the program files or the python site-packages
> folder.

Ok.

You should get a _ufc.dll or somthing from that command. The ufc.py is
generated by swig in the previous command.

Have you tried:

  make install

It should then install your stuff into what ever directory you told cmake.

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#22

ok, did it, I get this. It installs but still has a few (syntax) errors. To me it looks like mixed up slashes and backslashes.

"C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:\Till\ufc-1.4.2 -BC:\tempbuild --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_start C:\tempbuild\CMakeFiles C:\tempbuild\CMakeFiles\progress.marks
make -f CMakeFiles\Makefile2 all
make[1]: Entering directory `C:/tempbuild'
make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/depend
make[2]: Entering directory `C:/tempbuild'
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Till\ufc-1.4.2 C:\Till\ufc-1.4.2 C:\tempbuild C:\tempbuild C:\tempbuild\CMakeFiles\_ufc.dir\DependInfo.cmake --color=
make[2]: Leaving directory `C:/tempbuild'
make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/build
make[2]: Entering directory `C:/tempbuild'
make[2]: Nothing to be done for `CMakeFiles/_ufc.dir/build'.
make[2]: Leaving directory `C:/tempbuild'
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report C:\tempbuild\CMakeFiles 1 2
[100%] Built target _ufc
make[1]: Leaving directory `C:/tempbuild'
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_start C:\tempbuild\CMakeFiles 0
make -f CMakeFiles\Makefile2 preinstall
make[1]: Entering directory `C:/tempbuild'
make[1]: Nothing to be done for `preinstall'.
make[1]: Leaving directory `C:/tempbuild'
Install the project...
"C:\Program Files\CMake 2.8\bin\cmake.exe" -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: C:/Program Files/UFC/include/ufc.h
-- Installing: C:/Program Files/UFC/include/swig/ufc.i
-- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/_ufc.pyd
-- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/ufc.py
-- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/__init__.py
CMake Warning (dev) at cmake_install.cmake:49 (list):
  Syntax error in cmake code at

    C:/tempbuild/cmake_install.cmake:50

  when parsing string

    C:/Program Files/UFC\Lib\site-packages/ufc_utils

  Invalid escape sequence \L

  Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
  "cmake --help-policy CMP0010" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake_install.cmake:51 (FILE):
  Syntax error in cmake code at

    C:/tempbuild/cmake_install.cmake:51

  when parsing string

    C:/Program Files/UFC\Lib\site-packages

  Invalid escape sequence \L

  Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
  "cmake --help-policy CMP0010" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/build.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/dof_map.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/finite_element.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/form.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/function.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/integrals.py
-- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/__init__.py
-- Installing: C:/Program Files/UFC/share/ufc/ufc-config.cmake
-- Installing: C:/Program Files/UFC/lib/pkgconfig/ufc-1.pc

Revision history for this message
Johan Hake (johan-hake) said :
#23

On Tuesday January 18 2011 11:21:28 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> ok, did it, I get this. It installs but still has a few (syntax) errors.
> To me it looks like mixed up slashes and backslashes.

That looks more like warnings. It should be installed. Now you should set your
paths and you should be done with ufc :)

Johan

> "C:\Program Files\CMake 2.8\bin\cmake.exe" -HC:\Till\ufc-1.4.2
> -BC:\tempbuild --check-build-system CMakeFiles\Makefile.cmake 0
> "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_start
> C:\tempbuild\CMakeFiles C:\tempbuild\CMakeFiles\progress.marks make -f
> CMakeFiles\Makefile2 all
> make[1]: Entering directory `C:/tempbuild'
> make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/depend
> make[2]: Entering directory `C:/tempbuild'
> "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_depends "MinGW
> Makefiles" C:\Till\ufc-1.4.2 C:\Till\ufc-1.4.2 C:\tempbuild C:\tempbuild
> C:\tempbuild\CMakeFiles\_ufc.dir\DependInfo.cmake --color= make[2]:
> Leaving directory `C:/tempbuild'
> make -f CMakeFiles\_ufc.dir\build.make CMakeFiles/_ufc.dir/build
> make[2]: Entering directory `C:/tempbuild'
> make[2]: Nothing to be done for `CMakeFiles/_ufc.dir/build'.
> make[2]: Leaving directory `C:/tempbuild'
> "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report
> C:\tempbuild\CMakeFiles 1 2 [100%] Built target _ufc
> make[1]: Leaving directory `C:/tempbuild'
> "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_start
> C:\tempbuild\CMakeFiles 0 make -f CMakeFiles\Makefile2 preinstall
> make[1]: Entering directory `C:/tempbuild'
> make[1]: Nothing to be done for `preinstall'.
> make[1]: Leaving directory `C:/tempbuild'
> Install the project...
> "C:\Program Files\CMake 2.8\bin\cmake.exe" -P cmake_install.cmake
> -- Install configuration: "Release"
> -- Installing: C:/Program Files/UFC/include/ufc.h
> -- Installing: C:/Program Files/UFC/include/swig/ufc.i
> -- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/_ufc.pyd
> -- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/ufc.py
> -- Installing: C:/Program Files/UFC/Lib/site-packages/ufc/__init__.py
> CMake Warning (dev) at cmake_install.cmake:49 (list):
> Syntax error in cmake code at
>
> C:/tempbuild/cmake_install.cmake:50
>
> when parsing string
>
> C:/Program Files/UFC\Lib\site-packages/ufc_utils
>
> Invalid escape sequence \L
>
> Policy CMP0010 is not set: Bad variable reference syntax is an error.
> Run "cmake --help-policy CMP0010" for policy details. Use the
> cmake_policy command to set the policy and suppress this warning.
> This warning is for project developers. Use -Wno-dev to suppress it.
>
> CMake Warning (dev) at cmake_install.cmake:51 (FILE):
> Syntax error in cmake code at
>
> C:/tempbuild/cmake_install.cmake:51
>
> when parsing string
>
> C:/Program Files/UFC\Lib\site-packages
>
> Invalid escape sequence \L
>
> Policy CMP0010 is not set: Bad variable reference syntax is an error.
> Run "cmake --help-policy CMP0010" for policy details. Use the
> cmake_policy command to set the policy and suppress this warning.
> This warning is for project developers. Use -Wno-dev to suppress it.
>
> -- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils
> -- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/build.py
> -- Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/dof_map.py
> -- Installing: C:/Program
> Files/UFC\Lib\site-packages/ufc_utils/finite_element.py -- Installing:
> C:/Program Files/UFC\Lib\site-packages/ufc_utils/form.py -- Installing:
> C:/Program Files/UFC\Lib\site-packages/ufc_utils/function.py --
> Installing: C:/Program Files/UFC\Lib\site-packages/ufc_utils/integrals.py
> -- Installing: C:/Program
> Files/UFC\Lib\site-packages/ufc_utils/__init__.py -- Installing:
> C:/Program Files/UFC/share/ufc/ufc-config.cmake
> -- Installing: C:/Program Files/UFC/lib/pkgconfig/ufc-1.pc
>
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#24

Oh, great, thank you so far. Could I also copy the UFC directory from program files to the python site-packages? Or do I set the python paths to program files\ufc? Or can I install it again directly into the site-packages?

Thank you again. Next step is getting Armadillo and then build dolfin. I will try that on my own now.

If I ever come to the Simula Labs, I invite you for something.

Revision history for this message
Johan Hake (johan-hake) said :
#25

On Tuesday January 18 2011 11:32:38 Till B wrote:
> Question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Till B posted a new comment:
> Oh, great, thank you so far. Could I also copy the UFC directory from
> program files to the python site-packages? Or do I set the python paths
> to program files\ufc? Or can I install it again directly into the site-
> packages?

Depending on your likings you can do either one of those. But I would prefer
to change the installation directory in cmake to your site-packages directory,
and make that your preffered install path for new python stuff.

> Thank you again. Next step is getting Armadillo and then build dolfin. I
> will try that on my own now.

Cross fingers!

> If I ever come to the Simula Labs, I invite you for something.

Thanks, but you better come to San Diego instead, as it is here I am ;)

Johan

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#26

Oh, San Diego. I'll do my best.

I think I'll try the Armadillo and Dolfin stuff tomorrow at work. But thank you a lot so far.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#27

ok, sorry, I am stuck again.

First I did not build Boost properly. I used the following command to build it:
bjam install --toolset=gcc --prefix=C:\Boost --stagedir=C:\Boost\stage --build-dir=C:\tempbuild --with-system --link=shared
but it does not give me the DLLs for the Boost.system library (I only try one library at a time, until I get it).

Second I do not manage to install Armadillo-1.0.0. I downloaded precompiled BLAS and LAPACK libraries, stored them safely away and then did what was written under "manual installation" in the Armadillo readme. This was basically uncommenting a few lines in the config.hpp file. Do I set the PATH variable to the BLAS and LAPACK libs and to the config.hpp?
When trying to generate the makefile for Dolfin, CMake asks for ARMADILLO_DIR, I tried the Armadillo/include dir and several others, but it did not work. ARMADILLO_TEST_RUNS is missing. And it asks for ARMADILLO_LIBRARIES, but Armadillo only comes with hpp files.
Do I have to build Armadillo in some way? In the installation description it only tells me to uncomment a few lines.

Revision history for this message
Johannes Ring (johannr) said :
#28

Yes, you will have to build Armadillo (cmake, make, make install), however, I don't see how you feel that adding a few environment variables are more clumsy than building everything by yourself. I just tried it with Python(x,y) this morning and it worked. All I had to do was to set/modify the PATH, PYTHONPATH, PKG_CONFIG_PATH, BOOST_DIR, and SWIG_LIB environment variables. I can give you some more detailed instructions if you would like to try this out, but if you still prefer to build it by yourself, you might find the sources I use for building the Windows binary useful. It's available from http://www.fenicsproject.org/pub/software/fenics/.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#29

It still does not find Armadillo:
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Armadillo could not be found. Be sure to set ARMADILLO_DIR. (missing:
  ARMADILLO_TEST_RUNS)
Call Stack (most recent call first):
  C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindArmadillo.cmake:139 (find_package_handle_standard_args)
  CMakeLists.txt:156 (find_package)

ARMADILLO_DIR and ARMADILLO_INCLUDE_DIR are properly set. In the Armadillo-readme it said that CMake is not supported, but at least make install produced some output.

I am not sure what you mean about the environment variables. Do you suggest to change the variables from the Fenics-Python to include the modules from Pythonxy or vice versa? In both cases I will still have to Python's in my system. A few days ago I tried to set the pythonxy paths to include the Dolfin package, but that did not work out.
Meanwhile I am thinking to completely move my stuff and packages to the Fenics-Python installation, I thought this would be more work, but now I think I should do that. Don't know if it works, but maybe I give it a try.

Revision history for this message
Johannes Ring (johannr) said :
#30

Oh, I didn't even notice that in the Armadillo README.txt. CMake and Armadillo works just fine for me on Windows using the MinGW compilers.

It is lots of information available on how to set environment variables in Windows (http://tinyurl.com/6ajpfsp). What I did was to edit the PATH variable under user variables and added the following before the rest of the value:

  C:\FEniCS\bin;C:\FEniCS\Scripts;C:\FEniCS\lib;

You should replace C:\FEniCS with whatever directory you installed FEniCS into. Then I created the following new variables (also under user variables):

  PKG_CONFIG_PATH=C:\FEniCS\lib\pkg-config
  PYTHONPATH=C:\FEniCS\lib\site-packages;C:\FEniCS\lib\vtk-5.6
  BOOST_DIR=C:\FEniCS
  SWIG_LIB=C:\FEniCS\share\swig\2.0.0

After that I simply closed all open Python(x,y) related program and then I was able to use DOLFIN from Spyder.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#31

Yes, I already tried this, environment variables are set like you described.
In fact I reinstalled the whole Python(x,y) into the Fenics installation.

But when I try to compile the biharmonics demo.py, I get the error below, no
matter if it is from Spyder or the cmd shell. It does work if I run the
Fenics runme.bat first.

Traceback (most recent call last):
  File "C:\FEniCS\share\dolfin\demo\pde\biharmonic\python\demo.py", line 24,
in <module>
    from dolfin import *
  File "C:\FEniCS\lib\site-packages\dolfin\__init__.py", line 11, in
<module>
    import dolfin.cpp as cpp
  File "C:\FEniCS\lib\site-packages\dolfin\cpp.py", line 28, in <module>
    _cpp = swig_import_helper()
  File "C:\FEniCS\lib\site-packages\dolfin\cpp.py", line 24, in
swig_import_helper
    _mod = imp.load_module('_cpp', fp, pathname, description)
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

(last line means that the called module was not found)

I tried to mimic the runme.bat and I guess the tricky part is

if not defined HOME (
   if defined HOMEDRIVE (
      if defined HOMEPATH (
         set HOME=%HOMEDRIVE%%HOMEPATH%
      )
   ) else (
      if defined USERPROFILE (
         set HOME=%USERPROFILE%
      )
   )
)
if not defined HOME (
   for /f "tokens=*" %%a in (
      'python -c "import os;print os.path.expanduser('~')"'
   ) do (
      set HOME=%%a
   )
)
if not exist "%HOME%\pydistutils.cfg" (
   echo [build] > "%HOME%\pydistutils.cfg"
   echo compiler=mingw32 >> "%HOME%\pydistutils.cfg"
)
What is it doing here? Can I somehow include this into Spyder or the other
Python(x,y) stuff?

2011/1/19 Johannes Ring <email address hidden>

> Your question #141422 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/141422
>
> Johannes Ring posted a new comment:
> Oh, I didn't even notice that in the Armadillo README.txt. CMake and
> Armadillo works just fine for me on Windows using the MinGW compilers.
>
> It is lots of information available on how to set environment variables
> in Windows (http://tinyurl.com/6ajpfsp). What I did was to edit the PATH
> variable under user variables and added the following before the rest of
> the value:
>
> C:\FEniCS\bin;C:\FEniCS\Scripts;C:\FEniCS\lib;
>
> You should replace C:\FEniCS with whatever directory you installed
> FEniCS into. Then I created the following new variables (also under user
> variables):
>
> PKG_CONFIG_PATH=C:\FEniCS\lib\pkg-config
> PYTHONPATH=C:\FEniCS\lib\site-packages;C:\FEniCS\lib\vtk-5.6
> BOOST_DIR=C:\FEniCS
> SWIG_LIB=C:\FEniCS\share\swig\2.0.0
>
> After that I simply closed all open Python(x,y) related program and then
> I was able to use DOLFIN from Spyder.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Johannes Ring (johannr) said :
#32

The biharmonic demo works fine for me from within Spyder. You must make sure that this part:

  C:\FEniCS\bin;C:\FEniCS\Scripts;C:\FEniCS\lib;

is added at the _front_ of the PATH variable. This is important because Python(x,y) installs (by default) its own MinGW compilers and these will not work with the FEniCS package. You can also try to remove or simply rename the mingw folder under the pythonxy folder. Remember to restart Python(x,y) stuff whenever you update the environment variables.

I'm not sure it's a good idea to install Python(x,y) into the FEniCS folder, although it probably won't hurt. However, it might be a good idea to install Python(x,y) to a path without spaces, for instance C:\pythonxy.

Also, you don't need to worry about the stuff in runme.bat. It should be enough that you run it once after installation such that necessary files are created.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#33

The Python(x,y) stuff is actually in program files. But I installed the Python distribution including all packages over the python distro in Fenics. I like to have everything in one place.

I changed the PATH variable and at least the error message has changed. It aborts because vcvarsall.bat is missing. But this is a Visual Studio file, isn't it? Does this happen because I reordered PATH and now it doesn't find mingw?

Another thing that I noticed:
C:\FEniCS\lib\site-packages\instant\paths.py creates a directory .instant in the home directory. In my case this is unfortunately a network drive so it does not work in the train. I changed this into a path on my local drive. Does this also occur in other places?

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#34

ok, now it works - almost.

From what I read in runme.bat, it creates a cfg-file that contains the information which compiler to use. Where is this information used? Since my homedrive sits on a network drive, this will cause problems, when I am disconnected.
At the moment it works, when I am connected (and run runme.bat at least once), but it does of course not work, when I am not connected.

Revision history for this message
Johannes Ring (johannr) said :
#35

You can put the same information into a file Lib/distutils/distutils.cfg in you Python installation directory. That is, put

  [build]
  compiler=mingw32

into C:\Python26\Lib\distutils\distutils.cfg if Python is installed into C:\Python26. You will need to create the file if it does not already exist. This will ensure that the MinGW compilers are used when building Python extension modules.

Regarding your question about the .instant directory on your home drive: This is the default cache directory for Instant. You can change this by setting the environment variable INSTANT_CACHE_DIR to some suitable directory, like for instance C:\temp\instant.

Revision history for this message
Bento (tbarmeier-deactivatedaccount) said :
#36

Now it works! Both connected and unconnected. I think now I have everything in place. I will clean up my system now and then I can start the real stuff. Hopefully my next question is PDE related.

Thank you both Johan and Johannes for helping me so much. And sorry for asking all the stupid questions.

Best regards

Till