[docker中的python3 mayavi未安装

问题描述 投票:0回答:1

我试图让mayavi在Docker容器中工作,最初我是从continuumio / anaconda3启动Dockerfile的。我做了一个“ conda install mayavi”,它似乎可以安装,但是一旦我尝试导入它或vtk,我就会得到:

“ ModuleNotFoundError:没有名为'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

我已经来了一段时间,任何帮助将不胜感激。

python docker anaconda vtk mayavi
1个回答
0
投票

您可以查看my binder repo fork,您可以在其中插入Jupyter笔记本中的嵌入式Mayavi。

在此处粘贴Dockerfile以供后代使用:

FROM jupyter/minimal-notebook:65761486d5d3

MAINTAINER Jean-Remi King <[email protected]>

# 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"]
© www.soinside.com 2019 - 2024. All rights reserved.