Comments (5)
Like you install any Python "library":
pip install python-gitlab
from python-gitlab.
I believe the answer is here: http://fedir.github.io/web/2014/01/06/gitlab-projects-management-from-shell/#installation, which says:
git clone https://github.com/gpocentek/python-gitlab.git
cd python-gitlab
python setup.py install
But that gave me this error:
[toby.ferguson@XXXX python-gitlab]$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 7, in <module>
import gitlab
File "/home/toby.ferguson/python-gitlab/gitlab/__init__.py", line 26, in <module>
import requests
ImportError: No module named requests
Now I just have to figure out how to install requests
from python-gitlab.
So the trick is to install pip, and then use it:
[toby.ferguson@ca-ovsx32 python-gitlab]$ curl -O https://bootstrap.pypa.io/get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1388k 100 1388k 0 0 849k 0 0:00:01 0:00:01 --:--:-- 934k
[toby.ferguson@ca-ovsx32 python-gitlab]$ su
Password:
[root@ca-ovsx32 python-gitlab]# python get-pip.py
/usr/lib/python2.6/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /tmp/tmpjqAJHB/pip.zip/pip/__init__.py, but /usr/lib/python2.6/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
/tmp/tmpjqAJHB/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
/tmp/tmpjqAJHB/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
Collecting pip
Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB)
100% |████████████████████████████████| 1.1MB 230kB/s
Collecting wheel
Downloading wheel-0.24.0-py2.py3-none-any.whl (63kB)
100% |████████████████████████████████| 65kB 2.4MB/s
Collecting argparse (from wheel)
Downloading argparse-1.3.0-py2.py3-none-any.whl
Installing collected packages: pip, argparse, wheel
Found existing installation: pip 1.3.1
Uninstalling pip-1.3.1:
Successfully uninstalled pip-1.3.1
Successfully installed argparse-1.3.0 pip-7.0.3 wheel-0.24.0
[root@ca-ovsx32 python-gitlab]# pip install python-gitlab
Collecting python-gitlab
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading python-gitlab-0.9.1.tar.gz
Collecting requests (from python-gitlab)
Downloading requests-2.7.0-py2.py3-none-any.whl (470kB)
100% |████████████████████████████████| 471kB 424kB/s
Collecting six (from python-gitlab)
Downloading six-1.9.0-py2.py3-none-any.whl
Building wheels for collected packages: python-gitlab
Running setup.py bdist_wheel for python-gitlab
Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-N1G53N/python-gitlab/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpvwxELMpip-wheel-:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for python-gitlab
Failed to build python-gitlab
Installing collected packages: requests, six, python-gitlab
Running setup.py install for python-gitlab
Successfully installed python-gitlab-0.9.1 requests-2.7.0 six-1.9.0
and to ignore that 'wheel error' at the end
from python-gitlab.
No - that wasn't enough - even thought the last line seemed to indicate requests and six were installed I got the following errors:
[root@ca-ovsx32 python-gitlab]# gitlab --help
Traceback (most recent call last):
File "/usr/bin/gitlab", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six
I fixed this using easy_install
:
easy_install six requests
and NOW this gitlab tool works! Yay!
from python-gitlab.
Using pip to install python software is a common practice, and would have helped you in this case. Glad you got it working.
from python-gitlab.
Related Issues (20)
- Cannot remove or update project avatars HOT 1
- Wrong type on `job.trace()`? HOT 3
- Missing `latest()` method on `ProjectPipelineManager` HOT 4
- Support group-level service-accounts
- Add group.shared_with_groups.list() HOT 2
- const module not exposed
- Missing content Class Variable in ProjectFile Class HOT 3
- Improve documentation on usage of Docker image directly within Gitlab CI HOT 1
- ProjectMergeRequestApprovalManager.set_approvers cannot handle too many approval rules
- Bug: List all projects of current user returns empty list
- In CommitManager, using the path filter breaks the endpoint call HOT 3
- Feature: add `pages` support in `project`
- update CI/CD Variables with a specific env
- personal_access_tokens.rotate(<ID>) 'dict' object has no attribute 'token' HOT 3
- get_id() retruns name of label
- project.commits.list(path=some/path.txt) fails because "path" param is used to override path in ListMixin.list HOT 2
- Introduce a global setting to always get all element from `list()` calls HOT 1
- `path` argument of "List repository commits" is overriden
- Feature: Retrieve the job that generated a job token from /job api call
- Cannot update/patch protected branch allowed_to_push/push_access_levels state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-gitlab.