CuCalc icon indicating copy to clipboard operation
CuCalc copied to clipboard

question: installing additional conda packages after build

Open billpage opened this issue 6 years ago • 1 comments

What is the correct method to install additional conda packages, e.g. sympy, after build is complete and CuCalc is running? If I use conda install sympy in docker exec -it cucalc bash then sympy is not available to projects in CuCalc due to issues with file privileges.

billpage avatar Feb 16 '18 00:02 billpage

The workaround is to create a new local environment in conda for packages you need. For example, call /opt/conda/bin/conda create -n sympy python=3.6 ipykernel sympy from terminal in your project to create Python 3.6 environment with sympy installed. Adding ipykernel will allow to use it from Jupyter:

Verify that environment is created: /opt/conda/bin/conda env list

# conda environments:
#
base                  *  /opt/conda
sympy                    /projects/60381e06-c4b4-4b8b-ae7d-a6dc03b1b13a/.conda/envs/sympy

Add new kernel to Jupyter:

export PATH=/opt/conda/bin${PATH:+:${PATH}} 
source activate sympy
(sympy) ~$ python -m ipykernel install --user --name sympy --display-name "Python 3.6 (SymPy)"

Check Jupyter (don't forget to switch kernel)

sympy

If you want to have more permanent solution and be able to use it in all of your project, add the following line to a Dockerfile and rebuild the CuCalc image:

RUN /opt/conda/bin/conda create -n sympy python=3.6 sympy

ktaletsk avatar Feb 16 '18 18:02 ktaletsk