Home > Mobile >  Python Jira module is not found, but it's installed
Python Jira module is not found, but it's installed

Time:04-06

I have two files - one PHP file and one Python file. The python file imports the Jira module, searches for issues, and obtains information from Jira. This file does function correctly and it will find Jira issues and return all needed fields successfully.

The PHP file (for this example, let's call it py_exec.php) is part of a website and executes the Python file through shell_exec; something to the effect of:

$jira_issues = shell_exec(python3 py_search.py issue=blah);
print_r($jira_issues);
  • When I run the Python script directly, the script works correctly.
  • When I execute the PHP script directly, which in turn executes the Python script, the script works correctly.
  • But when I run the PHP script from the website, the script returns nothing.

After troubleshooting a bit, I tried to run the command as the apache user and I am given the following error:

ModuleNotFoundError: No module named 'jira'

Obviously the module is installed, but it seems that it's not accessible to Apache.

How do I make this module accessible to Apache?

Many thanks, in advance, for any help I can get.

CodePudding user response:

su to the apache user and run pip install jira. Check that it worked by doing python and then import jira.

Sometimes pip ends up aliased to something other than python. So if you have issues, try python -m pip instead.

  • Related