semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Question: Managing python venvs

Open drizzit56 opened this issue 1 year ago • 1 comments

Question

I have read through all of the docs but maybe I'm missing something.....

How are python venvs managed ?

I have taken a look at the venv in /opt/semaphore/apps/ansible/9.4.0/venv/ and it has the library when I do a pip freeze, but when I run any of the jobs using that library I get an error to say could not import the library:

msg: Failed to import the required Python library (pynetbox) on XXXXXXXX's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter
10:59:25 AM
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'pynetbox'

Perhaps I should be pointing the ansible_python_interpreter in ansible.cfg to the venv in semaphore's opt folder ? Doing that seems to cause issues with finding the file possibly permissions related.

So my main thing is just looking for some basic info on managing the venvs and where I go about adding libraries. It's just not clear to me from the docs or from using Semaphore for a while now, it used to work but I saw there were some issues and changes about venv management and I just would like to know what the current status is.

Related to

No response

drizzit56 avatar Oct 15 '24 10:10 drizzit56

Hi @drizzit56

How did you install pynetbox? What version of Semaphore?

fiftin avatar Oct 16 '24 22:10 fiftin

For context using docker and have tried the latest and develop branches, the requirements.txt contains all the required libraries and it's being added to the /etc/semaphore/ directory. I can get exact versions if you wish but have tried with all the last few updates and last few updates to the develop branch to get it working.

drizzit56 avatar Oct 21 '24 20:10 drizzit56