grokability / jamf2snipe

Import and sync assets from a JAMFPro instance to Snipe-IT asset management.
MIT License
113 stars 55 forks source link

ImportError: No module named requests #67

Closed crofmmv closed 2 years ago

crofmmv commented 2 years ago

I'm getting this error when running the command python jamf2snipe --dryrun Traceback (most recent call last): File "jamf2snipe", line 50, in import requests ImportError: No module named requests

macOS Catalina 10.15.7 (19H1417) Python 3.10

Any ideas what the issue would be? @ParadoxGuitarist

ParadoxGuitarist commented 2 years ago

Yeah, you need to install the requests module. https://docs.python-requests.org/en/latest/

Probably pip install requests. The requirements are located in the requirements.txt :)

ParadoxGuitarist commented 2 years ago

https://github.com/ParadoxGuitarist/jamf2snipe#mac You probably skipped over step 4.

kMikaZu commented 11 months ago

I use the 1Password CLI and a custom script to inject the secrets. That script is wrapped into an app, made in Platypus. It asks for the environment (Staging or Production) and should then choose the right secret.

The script runs fine, but I get a similar error.

​Staging
Installing Requirements
Requirement already satisfied: configparser in /opt/homebrew/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (6.0.0)
Requirement already satisfied: requests in /opt/homebrew/lib/python3.11/site-packages (from -r requirements.txt (line 2)) (2.31.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/homebrew/lib/python3.11/site-packages (from requests->-r requirements.txt (line 2)) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /opt/homebrew/lib/python3.11/site-packages (from requests->-r requirements.txt (line 2)) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/homebrew/lib/python3.11/site-packages (from requests->-r requirements.txt (line 2)) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /opt/homebrew/lib/python3.11/site-packages (from requests->-r requirements.txt (line 2)) (2023.11.17)
Running Jamf2Snipe
Traceback (most recent call last):
  File "/PATH/Jamf2Snipe.app/Contents/Resources/jamf2snipe", line 52, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
This is the end

What could be the culprit here? I followed the instructions and also created the virtualenv .

jerm commented 11 months ago

I have a suspicion that Platypus may not be using/respecting the virtualenv that you installed, but that's just a guess. I'm haven't played with Platypus, so i'm not sure how all the building/running goes together

in other words, are you sure that the virtualenv was active both for installing requirements and for running jamf2snipe?

jerm commented 11 months ago

Oh, because this is in a wildly different context --Platypus -- i think it's worth a new issue, as this is pretty far from a standard installation and not widely applicable. Please @ me in the new issue once you open it.