<p>I am trying to use <a href="https://github.com/kubernetes-client/python#example" rel="nofollow noreferrer">Kubernetes python SDK</a>.<br>
I tried to run the following code:  </p>

<pre><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)
</code></pre>

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

<p>I am trying to run PyCharm interperte as root.<br>
Following the <a href="https://intellij-support.jetbrains.com/hc/en-us/community/posts/206587695-How-to-run-debug-programs-with-super-user-privileges" rel="nofollow noreferrer">instruction</a> from JetBrains, I created a script shell with the name <code>pythonCustomInt.sh</code> that contains:  </p>

<pre><code>sudo python
</code></pre>

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

<blockquote>
  <p>Environment location directory is not empty</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/5Z9MS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Z9MS.png" alt="enter image description here"></a>
I am not sure where I need to put the script.<br>
Any idea?   </p>

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