Adding a code environment to a code studio template
I have created a code studio template that allows me to run Voila within my DSS instance, but I am having issues attaching a code environment to the template.
I have tried adding the code environment block to the template but have had no success. The only way I have been able to get the Python packages into the template is by installing them via the append to dockerfile block, but this is not ideal for my use case.
Any ideas on how I can include a code environment in the code studio template?
Best Answer
-
samanthamarkley Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 6 Partner
The solution that worked for this was to first add my code environment block to my template and then active this code environment in my entrypoint file like:
# Activate code environment
source /opt/dataiku/python-code-envs/webapp_env/bin/activate
# Run the webapp
/opt/dataiku/python-code-envs/webapp_env/bin/python -m voila --Voila.ip="$BIND_ADDR" --no-browser --Voila.tornado_settings="{'allow_origin': '*'}" --Voila.base_url="$BASE_URL/" --port=8866 /home/dataiku/workspace/code_studio-versioned/Untitled.ipynbThese steps replaced the need for the "Append to Dockerfile" block. Note of caution: make sure you carefully select the Python and package versions, conflicts will cause the code studio to fail!
Answers
-
JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 296 Dataiker
Hi @samanthamarkley
,You will need to build a template for CodeStudio with VScode and select a block type "ADD Code Environment" and then select the one you want to use. For new code env, create a new template.The following steps you can find in the tutorial https://knowledge.dataiku.com/latest/code/work-environment/tutorial-first-code-studio.html?highlight=code%20studio#configure-definition-settingsThanks!Jordan -
williamwirono Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 11 Partner
Hi @JordanB
, say that I want to change my Python version from Python 3.6 to 3.7.10, how would I do that? I know that by default, it is installing Python 3.6. How do I let Dataikh know to install Python 3.7.10 instead? -
JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 296 Dataiker
HI @williamwirono
,If you have the python3.7 installed on your dss host machine and it is available in the env path variable. If you try to create a code env in DSS with python3.7 and you receive an error such as:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7"
This means DSS cannot find a Python 3.7 interpreter installed in the DSS host. There could be two reasons for this:- This python version is not installed in the host. In that case you'll need to install it or contact your sysadmin to get it installed.
- This version is installed in the host, but it has not been added to the env PATH variable for the DSS user.
- Basically, the following command should be executed successfully from the cli: which python3.7
Thanks,
Jordan