Can't run PyCharm interpreter as root

7/12/2018

I am trying to use Kubernetes python SDK.
I tried to run the following code:

from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)

It failed with lots of errors.
When I run the same code with python from a shell, the same issue.
When I run the same code with sudo python from shell, it works.

I am trying to run PyCharm interperte as root.
Following the instruction from JetBrains, I created a script shell with the name pythonCustomInt.sh that contains:

sudo python

I went to PyCharm settings > Project Interpreter and changed the Base interpreter to /<path>/pythonCutomInt.sh but it writes an error:

Environment location directory is not empty

enter image description here I am not sure where I need to put the script.
Any idea?

-- E235
interpreter
kubernetes
pycharm
python

1 Answer

7/16/2018

I ran sudo -s and then from the pycharm folder (pycharm-community-2018.1.4/bin) I ran sh ./pycharm.sh and it worked.

-- E235
Source: StackOverflow