I wanted to use jupyter notebook with docker in pip environment (opticspy)

background

--When building an environment with Docker and writing python code, jupyter notebook is easy to see the result of the image --When I tried to simulate using a module called opticspy, pip install was a prerequisite. - https://github.com/Sterncat/opticspy --Jupyter is usually used in the anaconda environment, so I dealt with it while investigating what to do.

Dockerfile

FROM continuumio/anaconda3:latest


RUN apt-get update && apt-get upgrade -y \
 && apt-get install -y \
    git \
    make \
    build-essential \
    libssl-dev \
    zlib1g-dev \
    libbz2-dev \
    libreadline-dev \
    libsqlite3-dev \
    wget \
    curl \
    llvm \
    libncurses5-dev \
    libncursesw5-dev \
    xz-utils \
    tk-dev \
    libffi-dev \
    liblzma-dev \
    vim

RUN conda create -n p37 python=3.7 pip

Execution code

terminal.sh


$ docker run -it -p 8881:8881 -v /hogehoge/:/mnt/ --name pip_in_conda pip_in_conda:1.0
$ source activate p37
$ pip install jupyter
$ pip install environment_kernels
$ jupyter notebook --generate-config
$ vim /root/.jupyter/jupyter_notebook_config.py

The contents to be added with vim are as follows

jupyter_notebook_config.py


c.NotebookApp.kernel_spec_manager_class='environment_kernels.EnvironmentKernelSpecManager'
c.EnvironmentKernelSpecManager.env_dirs=['/opt/conda/envs/']

terminal.sh


$ pip install cffi
$ pip install numpy
$ pip install git+git://github.com/Sterncat/opticspy.git@master
$ pip install pyyaml
$ jupyter notebook --port 8881 --ip=0.0.0.0 --allow-root

Execution of sample code of opticspy

screencapture-127-0-0-1-8881-notebooks-mnt-05-lens-design-opticspy-sample-double-gauss-sample01-ipynb-2020-01-19-15_23_23.png

Recommended Posts

I wanted to use jupyter notebook with docker in pip environment (opticspy)
I want to use a virtual environment with jupyter notebook!
How to use jupyter notebook without polluting your environment with Docker
Use pip with Jupyter Notebook
I want to blog with Jupyter Notebook
How to use jupyter notebook with ABCI
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Environment maintenance made with Docker (I want to post-process GrADS in Python
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
How to use jupyter lab in Windows 10 local environment
Use Cython with Jupyter Notebook
How to use Jupyter Notebook
I want to use R functions easily with ipython notebook
Machine learning with Jupyter Notebook in OCI Always Free environment (2019/12/17)
I want to start a jupyter environment with one command
Reflect the virtual environment created with Miniconda in Jupyter notebook
Install Jupiter Notebook on Windows with pip in proxy environment
Unable to display tensorboard in jupyter notebook on docker (solved)
I wanted to delete multiple objects in s3 with boto3
Use markdown with jupyter notebook (with shortcut)
Easy to use Jupyter notebook (Python3.5)
I want to run Rails with rails s even in vagrant environment
Use nb extensions with Anaconda's Jupyter notebook
Build Jupyter Lab (Python) environment with Docker
Use apache Spark with jupyter notebook (IPython notebook)
Use Jupyter Lab and Jupyter Notebook with EC2
I wanted to solve ABC160 with Python
I want to pip install with PythonAnywhere
How to execute commands in jupyter notebook
I wanted to solve ABC159 in Python
How to use tensorflow under docker environment
Jupyter Notebook Basics of how to use
Introduction to docker Create ubuntu environment in ubuntu
How to use Jupyter notebook [Super Basic]
I wanted to solve ABC172 with Python
I really wanted to copy with selenium
Implemented DQN in TensorFlow (I wanted to ...)
Use WebDAV in a Portable Docker environment
Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
I set the environment variable with Docker and displayed it in Python
What to do if you can't install with pip in babun environment
I tried using NVDashboard (for those who use GPU in jupyter environment)
Let's use the NAOqi OS VM. I want to resolve dependencies with pip even in Pepper development
Hello World with gRPC / go in Docker environment
I tried to use lightGBM, xgboost with Boruta
How to debug with Jupyter or iPython Notebook
I want to use MATLAB feval with python
I wanted to solve NOMURA Contest 2020 with Python
Use the latest pip in a virtualenv environment
I want to use Python in the environment of pyenv + pipenv on Windows 10
Flutter in Docker-How to build and use a Flutter development environment inside a Docker container
Browser specification of Jupyter Notebook in Windows environment
I tried to integrate with Keras in TFv1.1
To output a value even in the middle of a cell with Jupyter Notebook
I wanted to play with the Bezier curve
I wanted to install Python 3.4.3 with Homebrew + pyenv
Try using conda virtual environment with Jupyter Notebook
I want to use Temporary Directory with Python2
I don't want to use -inf with np.log
How to use tkinter with python in pyenv