title: How to use user's pipenv via systemd? Python is installed via SCL
body: <p>On a CentOS 7 server, I have installed Python 3.6 via SCL. ( <a href="https://www.softwarecollections.org/en/scls/rhscl/rh-python36/" rel="nofollow noreferrer">https://www.softwarecollections.org/en/scls/rhscl/rh-python36/</a>)</p>
  
  <p>I have this line in .bashrc to enable SCL's Python 3.6</p>
  
  <pre><code>source scl_source enable rh-python36
  </code></pre>
  
  <p>I have installed pipenv:</p>
  
  <pre><code>pip install --user pipenv
  </code></pre>
  
  <p>I run Python programs via the command line:</p>
  
  <pre><code>pipenv run python myprogram.py
  </code></pre>
  
  <p>All these work great. I have a Flask application that uses the user's pipenv. I am trying to create a systemd unit file to start/stop/reload the Flask web application. How can I get the sytemd unit file to use the user's pipenv installed via SCL's Python and pip? </p>
  
  <p>I tried to execute the command line from root and I get this error:</p>
  
  <pre><code>[root@localhost ~]# source scl_source enable rh-python36
  [root@localhost ~]# /home/user/.local/bin/pipenv run python /home/user/hello.py 
  Traceback (most recent call last):
    File "/home/user/.local/bin/pipenv", line 7, in &lt;module&gt;
      from pipenv import cli
  ModuleNotFoundError: No module named 'pipenv'
  </code></pre>
  
  <p>However, I am able to execute the command via su -c by loading user's bash shell:</p>
  
  <pre><code> su -c 'bash -lc /home/user/.local/bin/pipenv run python hello.py' user
  </code></pre>
  
  <p>But this line seems awkward. What is a the correct line I could use in systemd unit file's ExecStart line? What environment variables should be included in order to use the user's pipenv? </p>