BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ltuala
Calcite | Level 5

I want to install additional Python package on SAS Viya to be used on SAS Intelligent Decisioning Python code files.

 

But still encountering this error "ModuleNotFoundError"

ltuala_0-1689033641256.png

 

Had tried to follow this blog post but skip some parts and follow sections I deemed necessary for my case. Configuring SAS Viya for Python Integration

 

Here are the steps I have done:

  1. Created the change-configuration.yaml on this path ../site-config/sas-pyconfig. The permission is set to 777 for both the file and the parent folder. 
    ltuala_4-1689034395933.png
  2. Here is the content of the file:
    Set the global.enabled and global.python_enabled to true 
    Added the additional package cx_Oracle to default_py.pip_install_packages

 

 

apiVersion: builtin
kind: PatchTransformer
metadata:
  name: sas-pyconfig-custom-parameters
patch: |-
  - op: replace 
    path: /data/global.enabled
    value: "true"
  - op: replace 
    path: /data/global.python_enabled
    value: "true"
  - op: replace 
    path: /data/global.r_enabled
    value: "false"
  - op: replace
    path: /data/global.pvc
    value: "/opt/sas/viya/home/sas-pyconfig"
  - op: replace
    path: /data/global.python_profiles
    value: "default_py"
  - op: replace
    path: /data/global.r_profiles
    value: "default_r"
  - op: replace
    path: /data/default_py.configure_opts
    value: "--enable-optimizations"
  - op: replace
    path: /data/default_r.configure_opts
    value: "--enable-memory-profiling --enable-R-shlib --with-blas --with-lapack --with-readline=no --with-x=no --enable-BLAS-shlib"
  - op: replace
    path: /data/default_py.cflags
    value: "-fPIC"
  - op: replace
    path: /data/default_r.cflags
    value: "-fPIC"
  - op: replace
    path: /data/default_py.pip_install_nobinary
    value: "Prophet sas_kernel"
  - op: replace
    path: /data/default_py.pip_install_packages
    value: "Prophet sas_kernel matplotlib sasoptpy sas-esppy NeuralProphet scipy rpy2 Flask XGBoost TensorFlow pybase64 scikit-learn statsmodels sympy mlxtend Skl2onnx nbeats-pytorch ESRNN onnxruntime opencv-python zipfile38 json2 pyenchant nltk spacy gensim cx_Oracle"
  - op: replace
    path: /data/default_py.python_signer
    value: https://keybase.io/ambv/pgp_keys.asc
  - op: replace
    path: /data/default_py.python_signature
    value: https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz.asc
  - op: replace
    path: /data/default_py.python_tarball
    value: https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
  - op: replace
    path: /data/default_r.r_tarball
    value: https://cloud.r-project.org/src/base/R-4/R-4.2.2.tar.gz
  - op: replace
    path: /data/default_r.packages
    value: "dplyr jsonlite httr tidyverse randomForest xgboost forecast"
target:
  version: v1
  kind: ConfigMap
  name: sas-pyconfig-parameters​

 

3. Edit the kustomization.yaml to include this file (last line).

ltuala_5-1689035359891.png

4. Run the command:

 

kubectl create job sas-pyconfig-adhoc -n sas-viya --from cronjob/sas-pyconfig

 

ltuala_6-1689035600893.png

5. Then did the testing on SAS Studio.

ltuala_0-1689033641256.png

 

Currently stuck on this issue, I might have missed important steps. Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ScottMcCauley
SAS Employee

Adding the cx_Oracle package to change-configuration.yaml requires you to do a build and apply to get the change into the sas-pyconfig cronjob definition.  

 

If you want to avoid a build and apply you can use OpenLens or some other means to edit the sas-pyconfig-parameters configmap to add the cx_Oracle package to the default_py.pip_install_packages parameter that defines the current sas-pyconfig job. 

 

I expect this will take care of the problem.

 

If that doesn't help...


1. I cannot see the resources: from your kustomization.yaml but make sure you have a reference to 
- site-config/sas-open-source-config/python in there.

 

3. The sas-pyconfig job takes quite a while to complete so check the log from your sas-pyconfig-adhoc job just to make sure it completed and did not have any errors.

 

I was able to successfully add cx_Oracle to a test deployment following the blog steps so I think you are really close.

 

Good luck!

View solution in original post

1 REPLY 1
ScottMcCauley
SAS Employee

Adding the cx_Oracle package to change-configuration.yaml requires you to do a build and apply to get the change into the sas-pyconfig cronjob definition.  

 

If you want to avoid a build and apply you can use OpenLens or some other means to edit the sas-pyconfig-parameters configmap to add the cx_Oracle package to the default_py.pip_install_packages parameter that defines the current sas-pyconfig job. 

 

I expect this will take care of the problem.

 

If that doesn't help...


1. I cannot see the resources: from your kustomization.yaml but make sure you have a reference to 
- site-config/sas-open-source-config/python in there.

 

3. The sas-pyconfig job takes quite a while to complete so check the log from your sas-pyconfig-adhoc job just to make sure it completed and did not have any errors.

 

I was able to successfully add cx_Oracle to a test deployment following the blog steps so I think you are really close.

 

Good luck!

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 558 views
  • 0 likes
  • 2 in conversation