liquidz00 / Patcher

Fetch patch management data from Jamf Pro to generate comprehensive reports in both Excel and PDF formats
https://patcher.liquidzoo.io/
Apache License 2.0
15 stars 1 forks source link

No module named 'aiohttp' #16

Closed MacDude closed 6 months ago

MacDude commented 6 months ago

Once I got it installed, this happened:

% python3 /Users/jeffrey.hoover/Patcher/patcher.py --path '/Users/Jeffrey.Hoover/Documents/Patcher_Output' --pdf Traceback (most recent call last): File "/Users/jeffrey.hoover/Patcher/patcher.py", line 2, in <module> import aiohttp ModuleNotFoundError: No module named 'aiohttp'

tried in both zsh and bash

liquidz00 commented 6 months ago

Hey @MacDude thank you again for checking out the repo and submitting this issue. When you are able, can you upload the installer.log file from $HOME/Patcher/logs? This will help determine why pip didn't install the dependencies as expected.

I know you were also having issues with the installer returning error: remote origin already exists. Going to be adding some extra checks into the installer regarding this as well.

MacDude commented 6 months ago

I think that either the first installer didn't get that far or the logs were overwritten.

Here are the logs from the successfully install

Starting installation...
2024-05-10 09:08:33 - INFO - Setting up environment...
2024-05-10 09:17:27 - INFO - Jamf instance details saved to .env file.
2024-05-10 09:17:49 - INFO - Dependencies installed to user directory.
2024-05-10 09:17:49 - INFO - Configuring UI elements...
2024-05-10 09:20:07 - INFO - Creating default ui_config.py with user-defined configurations...
2024-05-10 09:20:07 - INFO - UI configurations updated as expected.
liquidz00 commented 6 months ago

The installer uses python3 -m pip install --user -r requirements.txt to install the necessary dependencies. Since you are using Homebrew python, its possible that the Homebrew site-packages path is not on your $PYTHONPATH. Couple of things to try:

  1. Add Homebrew's site packages to your $PYTHONPATH variable. Execute the following command:
    export PYTHONPATH="$(brew --prefix)/lib/python3.12/site-packages:$PYTHONPATH"
  2. Create a virtualenv for Patcher. This is the recommendation directly from Homebrew assuming I am understanding it correctly.
    cd $HOME/Patcher; python3 -m venv venv; source venv/bin/activate; python3 -m pip install -r requirements.txt

    With the virtual environment still active, run the Patcher command again and it should work.

MacDude commented 6 months ago

It did run after executing both of those commands.

However the new log has: Bearer token and expiration updated in .env file Token obtained successfully. Expires in 59 seconds Patch policies obtained as expected. Error retrieving policies from API: string indices must be integers, not 'str' No patch policies were found. Unhandled exception occurred. Details:

liquidz00 commented 6 months ago

That usually happens when the life of the Access Token is not long enough to complete the required functions. Try to extend the duration of the token and try again.

You may also need to run the Patcher command a second time after updating the token lifetime for it to take effect.