我试图让mayavi在docker容器中工作,最初我是从continuumio/anaconda3启动我的Dockerfile的。我做了一个"conda install mayavi",它似乎会安装,但一旦我尝试导入它或 vtk,我就会得到:
"ModuleNotFoundError: No module named 'vtkRenderingOpenGL2Python'">
当我尝试从 pip3 安装它时,它无法安装"ModuleNotFoundError:没有名为'vtkOpenGLKitPython'的模块">
我从 centos:7 开始尝试并遇到同样的问题。我想值得一提的是,这些模块的 conda 搜索或 pip 搜索是空白的。但是我可以在 docker 之外安装它,一切正常。
如果有帮助,我当前的 Dockerfile 如下所示:
FROM centos:7
RUN yum install vim -y
RUN yum install python3 -y
RUN yum install python3-pip -y
RUN yum install python3-devel -y
RUN yum install gcc -y
#RUN pip3 install mayavi
#RUN pip3 install PyQt5
RUN mkdir /home/working
WORKDIR /home/working
我已经在这里工作了一段时间,任何帮助将不胜感激。
你可以看看我的binder repo fork,你可以在Jupyter notebooks中加载内联Mayavi。
将 Dockerfile 粘贴到此处以供后人参考:
FROM jupyter/minimal-notebook:65761486d5d3
MAINTAINER Jean-Remi King <jeanremi.king@gmail.com>
# Install core debian packages
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -yq dist-upgrade
&& apt-get install -yq --no-install-recommends
openssh-client
vim
curl
gcc
&& apt-get clean
# Xvfb
RUN apt-get install -yq --no-install-recommends
xvfb
x11-utils
libx11-dev
qt5-default
&& apt-get clean
ENV DISPLAY=:99
# Switch to notebook user
USER $NB_UID
# Upgrade the package managers
RUN pip install --upgrade pip
RUN npm i npm@latest -g
# Install Python packages
RUN pip install vtk &&
pip install boto &&
pip install h5py &&
pip install nose &&
pip install ipyevents &&
pip install ipywidgets &&
pip install mayavi &&
pip install nibabel &&
pip install numpy &&
pip install pillow &&
pip install pyqt5 &&
pip install scikit-learn &&
pip install scipy &&
pip install xvfbwrapper &&
pip install https://github.com/nipy/PySurfer/archive/master.zip
# Install Jupyter notebook extensions
RUN pip install RISE &&
jupyter nbextension install rise --py --sys-prefix &&
jupyter nbextension enable rise --py --sys-prefix &&
jupyter nbextension install mayavi --py --sys-prefix &&
jupyter nbextension enable mayavi --py --sys-prefix &&
npm cache clean --force
# Try to decrease initial IPython kernel load times
RUN ipython -c "import matplotlib.pyplot as plt; print(plt)"
# Add an x-server to the entrypoint. This is needed by Mayavi
ENTRYPOINT ["tini", "-g", "--", "xvfb-run"]