Remote: ImportError: No module named gitlab

I wrote a gitlab hook with python. And added to post-receive hooks on gitlab server. When I click on the remote origin server from my laptop I get the following error. But it works when I run the script manually on the gitlab server. How can I solve the problem?

 Counting objects: 3, done.
 Writing objects: 100% (3/3), 240 bytes | 0 bytes/s, done.
 Total 3 (delta 0), reused 0 (delta 0)
 remote: Traceback (most recent call last):
 remote:   File "push.py", line 4, in <module>
 remote:     import gitlab
 remote: ImportError: No module named gitlab

      

+3


source to share


1 answer


gitlab using the native python2.7 binary in / opt / gitlab / embedded / bin / path. i renamed / opt / gitlab / embedded / bin / python 2.7 and created a symlink from / usr / bin / python 2.7

After that, you have to change the owner of the python file with the git user.



The above solutions cause the same problem if gitlab uses native python binaries. Because of this, you can run a script like this in the post-receive hook

/usr/bin/python2.7 some_script.py

+2


source







All Articles