我尝试使用docker容器在Raspberry Pi 4B上安装PyFMI已经有一段时间了。我设法成功了。但是,仍然缺少更新日晷的功能。如果有人能帮我找到一个解决办法来更新它,我将不胜感激。目前,我将发布我所做的事情。这可能对其他人有帮助(即使这不是一个完美的解决方案)
PyFMI的问题在于它不适用于ARMv8体系结构。我尝试在docker中使用miniconda作为基本映像MiniForge(ARMv8不提供miniconda),但即使使用该映像,也无法使用conda命令直接安装(conda install-c conda forge pyfmi)。因此,我需要从源代码中编译所有PyFMI。我用这个帖子来帮你:PyFMI in Python 3 environment in Ubuntu 18.04
遵守守则:
FROM condaforge/miniforge3 AS compile-image
ENV TZ=America/Montreal
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -y update && apt-get -y upgrade \
&& apt-get install -y libblas-dev \
liblapack-dev \
libopenblas-dev \
python3-dev \
libatlas-base-dev \
libblas-dev \
gcc \
g++ \
build-essential \
zlib1g-dev \
gfortran \
autoconf \
automake \
bzip2 \
dpkg-dev \
file \
cmake \
git \
# Additional requirements for EnergyPlustoFMU
ca-certificates \
libxslt-dev \
swig \
libssl-dev \
tree \
libx11-6 \
curl \
tar
RUN pip install numpy
RUN pip install Cython
RUN pip install pandas
RUN pip install scipy
# RUN conda install -c conda-forge pyfmi # miniforge is not able to find the package.
# Manually compile all needed packages for PyFMI
# Source: https://stackoverflow.com/questions/59582257/pyfmi-in-python-3-environment-in-ubuntu-18-04
# Add FMI Library
WORKDIR /
RUN mkdir ./FMILibraryInstaller
RUN git clone https://github.com/modelon-community/fmi-library.git FMILibraryInstaller
RUN ls -lha
WORKDIR /FMILibraryInstaller
RUN mkdir ./buildcmake
WORKDIR /FMILibraryInstaller/buildcmake
# Variable DFMILIB_INSTALL_PREFIX defines the directory of installation
RUN cmake -DFMILIB_INSTALL_PREFIX=/usr/local/FMILibrary /FMILibraryInstaller/
RUN make install
# Create enviroment variable for PyFMI installation (Required for posterior installation of PyFMI).
ENV FMIL_HOME=/usr/local/FMILibrary
# Add sundials Library
WORKDIR /
RUN mkdir /SundialsInstaller
WORKDIR /SundialsInstaller
RUN wget https://github.com/LLNL/sundials/archive/refs/tags/v4.1.0.tar.gz
RUN mkdir buildtar
WORKDIR /SundialsInstaller/buildtar
RUN tar -xf /SundialsInstaller/v4.1.0.tar.gz
RUN ls -lha
WORKDIR /SundialsInstaller/buildtar/sundials-4.1.0
RUN mkdir buildcmake
WORKDIR /SundialsInstaller/buildtar/sundials-4.1.0/buildcmake
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local/Sundials /SundialsInstaller/buildtar/sundials-4.1.0
RUN make install
# Add lapack Library
WORKDIR /
RUN mkdir /LapackInstaller
RUN git clone https://github.com/Reference-LAPACK/lapack-release.git LapackInstaller
RUN ls -lha
WORKDIR /LapackInstaller
RUN mkdir ./buildcmake
WORKDIR /LapackInstaller/buildcmake
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local/Lapack /LapackInstaller
RUN make install
# Add assimulo Library
WORKDIR /
RUN mkdir /AssimuloInstaller
RUN git clone https://github.com/modelon-community/Assimulo.git AssimuloInstaller
WORKDIR /AssimuloInstaller
RUN ls -lha
RUN python setup.py install --sundials-home=/usr/local/Sundials
# --blas-home=/usr/local/Lapack/lib --lapack-home=/usr/local/Lapack
# Add PyFMI
# FMIL_HOME is an ambient variable. Needs to be exposed so it can be found for the PyFMI installer.
RUN export FMIL_HOME=/FMILibraryInstaller/buildcmake
WORKDIR /
RUN git clone https://github.com/modelon-community/PyFMI.git PyFMIInstaller
WORKDIR /PyFMIInstaller
RUN ls -lha
RUN python setup.py install --fmil-home=/usr/local/FMILibrary
有几件事需要注意:
如果有人知道如何安装最新版本的日晷,我将不胜感激。或者,更好的是,如果有人能够在conda forge中直接安装PyFMI for ARMv8体系结构,效果会更好
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐