Make .exe file that can run on windows?

Hi everyone

Is it possible to create an executable file that uses Fenics in Ubuntu and then install it to Windows?
For example, turning the demo_poisson.py into Windows software?

Best regards

demo_poisson.py: https://fenicsproject.org/olddocs/dolfin/1.3.0/python/demo/documented/poisson/python/documentation.html

Transforming python files to windows executables are not something many people do. There exists applications for this, (auto-our-exe, pyinstaller, etc.). However, these packages seem quite limited.

Why can’t you use docker on your windows to run the python programs, which is by far the simplest way of running FEniCS, independent of platform

Hi dokken

Because I want to make Windows executable file which contains FEA functions based on Fenics. My target users are not friendly with Linux.

I tried to install Fenics by building it manually as described here using Windows Command Prompt, but I did not success as the second step, installing DOLFIN

FENICS_VERSION=$(python3 -c"import ffc; print(ffc.version)")
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/mshr
mkdir dolfin/build && cd dolfin/build && cmake … && make install && cd …/…
mkdir mshr/build && cd mshr/build && cmake … && make install && cd …/…
cd dolfin/python && pip3 install . && cd …/…
cd mshr/python && pip3 install . && cd …/…

Link: https://fenics.readthedocs.io/en/latest/installation.html#from-source

The main problem is that it is quite hard linking PETSc, Eigen and the other C++ backend nicely in windows. Might I suggest using jupyter notebooks?

Thank dokken.

If I call jupyter notebook from Windows Comment Prompt, it will come back to the original problem how to install Fenics to Windows Python using Comment Prompt.

If I call jupyter notebook from Window Subsystem Linux or Virtual Box, I have to ask my users to install a lot of things which is boring and must be avoided.

Using docker requires minimal installation. Then they only have to install Docker Desktop and run the following command in docker desktop.

docker run -ti -p 127.0.0.1:8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current

I did install Docker Destop and run your command in Windows Powershell. Then I failed when typing

dolfin-version
or
python
import dolfin as df

Can you help me to go through these steps?

To test that your Docker desktop installation works, follow


If docker run hello-world works, you should be able to run:

docker run -ti -p 127.0.0.1:8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current

For further questions, you need to supply the full error messages, as described in Read before posting: How do I get my question answered?

I successfully run

docker run hello-work

But when I run

docker run -ti -p 127.0.0.1:8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared Quay

I got this error

C:\Program Files\Docker\Docker\resources\bin\docker.exe: invalid reference format.
See ‘C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help’.

Easy error to google, see solution at stackoverflow

I found it. I run the command in Windows Command Prompt instead of Windows PowerShell. This is what I get.


It’s seem to be fine except the last error:

docker: Error response from daemon: create (pwd): "(pwd)" includes invalid characters for
a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9_.-]” are allowed. If you intended to pass a
host directory, use absolute path.

I can see fenicsproject/stable is stored in docker’s images.

When I execute

fenicsproject run

I get this error

‘fenicsproject’ is not recognized as an internal or external command, operable program or batch file.

EDIT:
I know how to use Fenics through Docker Desktop now. It is written here
https://readthedocs.org/projects/fenics-containers/downloads/pdf/latest/

Read the error message. Your path contains invaild error messages. Googling parts of the error messages gives examples where you have to encapsulate your path with " ". Please spend some minutes googling the error messages before posting new questions.

Additionally, to run the fenicsproject command you need to call curl -s https://get.fenicsproject.org | bash first, as described at the FEniCS download site