'Importing in Python script running on corporate Jenkins

i am trying to run my python script that works fine locally, on our corporate Jenkins.

On top of the script i have

from appium import webdriver

and getting this error in Jenkins:

File "/home/emobappta/jenkins-workspace/workspace/xz1nwi_Jenkinsfile-1647515865042/Skripte/test2.py", line 5, in <module>
    from appium import webdriver
ModuleNotFoundError: No module named 'appium'

I have the whole appium folder in the same directory on my bitbucket and at this point no idea what i can try...

By including

pprint.pprint(sys.path) "

in my Jenkinsfile i get the following output:

'/home/emobappta/jenkins-workspace/workspace/xz1nwi_Jenkinsfile-1647515865042/Skripte',

'/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']



Solution 1:[1]

I'm not sure what you are referring to by 'appium folder', so I might be entirely confused about what you are asking since you generally don't go around copying libraries when moving projects. However, what I simply see is that the package itself is missing. So try running

pip install Appium-Python-Client

using a terminal in your corporate server. Check if you are using a venv, which means that its packages are isolated. If that is the case, open a terminal, switch to that venv, and execute the above command.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M B