Comments (6)
After reading the docs I guess I need to run the "generating protobuf stuff" which isn't clear this is a requirement for install ?
$ python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto
/usr/bin/python: No module named grpc.tools
Seems I'm missing some stuff.. eventually figured out I had to install cython and grpcio-tools:
$ pip install cython
$ pip install grpcio-tools
$ python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto
Import grpc:No module named gevent.socket
etcd3/proto: warning: directory does not exist.
etcd3/proto/*.proto: No such file or directory
$ cd /usr/local/lib/python2.7/dist-packages/etcd3
$ python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto
Import grpc:No module named gevent.socket
etcd3/proto: warning: directory does not exist.
etcd3/proto/*.proto: No such file or directory
Now at a loss :/
from python-etcd3.
Getting further...
Fix missing gevent.socket errors:
$ pip install gevent
Figured out I have to run the protobuf generate code from the source repo directory, not the module install dir.
$ git clone git://github.com/kragniz/python-etcd3
$ cd python-etcd3
$ python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto
$ git status
modified: etcd3/etcdrpc/rpc_pb2.py
What am I supposed to do with this file? where does it go? Lets try:
$ cp -r etcd3/etcdrpc /usr/local/lib/python2.7/dist-packages/etcd3/
$ ./test3.py
Traceback (most recent call last):
File "./test3.py", line 3, in <module>
import etcd3
File "/usr/local/lib/python2.7/dist-packages/etcd3/__init__.py", line 3, in <module>
from etcd3.client import Etcd3Client
File "/usr/local/lib/python2.7/dist-packages/etcd3/client.py", line 5, in <module>
import etcd3.transactions as transactions
File "/usr/local/lib/python2.7/dist-packages/etcd3/transactions.py", line 1, in <module>
from etcd3.etcdrpc import rpc_pb2 as etcdrpc
File "/usr/local/lib/python2.7/dist-packages/etcd3/etcdrpc/rpc_pb2.py", line 17, in <module>
import kv_pb2 as kv__pb2
File "/usr/local/lib/python2.7/dist-packages/etcd3/etcdrpc/kv_pb2.py", line 187, in <module>
from grpc.beta import implementations as beta_implementations
File "/usr/local/lib/python2.7/dist-packages/grpc/beta/implementations.py", line 39, in <module>
from grpc import _auth
File "/usr/local/lib/python2.7/dist-packages/grpc/_auth.py", line 43, in <module>
class GoogleCallCredentials(grpc.AuthMetadataPlugin):
AttributeError: 'module' object has no attribute 'AuthMetadataPlugin'
This is painfull :/
from python-etcd3.
Solved!
A bit of googling informed me I had conflicts with 'grpc' and 'grpcio'. So i cleaned everything and started over:
$ rm -rf /usr/local/lib/python2.7/dist-packages/grpc*
$ rm -rf /usr/local/lib/python2.7/dist-packages/google*
$ rm -rf /usr/local/lib/python2.7/dist-packages/cython*
$ rm -rf /usr/local/lib/python2.7/dist-packages/Cython*
$ rm -rf /usr/local/lib/python2.7/dist-packages/gevent*
$ rm -rf /usr/local/lib/python2.7/dist-packages/protobuf*
$ pip install cython
$ pip install grpcio
$ pip install grpcio-tools
$ git clone git://github.com/kragniz/python-etcd3
$ cd python-etcd3
$ python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto
$ git status
modified: etcd3/etcdrpc/rpc_pb2.py
$ cp -r etcd3/etcdrpc /usr/local/lib/python2.7/dist-packages/etcd3/
$ cd ~/
$ cat test3.py
#!/usr/bin/python
import etcd3
conn = etcd3.client(host='127.0.0.1')
print conn.get('/test')
$ ./test3.py
foo
Wow, all this should really be documented better.
from python-etcd3.
Hey, thanks for trying this out! As you can tell, it's in a very early state. You shouldn't have to generate the protobuf stubs yourself, since these should be bundled with the rest of the code.
I hadn't actually tested installing it with pip, my bad. It works okay from a git clone, but not from pypi:
(etcd3-test) ~/git $ git clone https://github.com/kragniz/python-etcd3 python-etcd-test
Cloning into 'python-etcd-test'...
remote: Counting objects: 657, done.
remote: Compressing objects: 100% (149/149), done.
remote: Total 657 (delta 88), reused 0 (delta 0), pack-reused 507
Receiving objects: 100% (657/657), 188.01 KiB | 178.00 KiB/s, done.
Resolving deltas: 100% (359/359), done.
(etcd3-test) ~/git $ pip install -e python-etcd-test/
Obtaining file:///home/louis/git/python-etcd-test
Requirement already satisfied (use --upgrade to upgrade): grpcio>=1.0.0 in /tmp/etcd3-test/lib/python3.5/site-packages (from etcd3==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /tmp/etcd3-test/lib/python3.5/site-packages (from grpcio>=1.0.0->etcd3==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): protobuf>=3.0.0 in /tmp/etcd3-test/lib/python3.5/site-packages (from grpcio>=1.0.0->etcd3==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): enum34>=1.0.4 in /tmp/etcd3-test/lib/python3.5/site-packages (from grpcio>=1.0.0->etcd3==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): futures>=2.2.0 in /tmp/etcd3-test/lib/python3.5/site-packages (from grpcio>=1.0.0->etcd3==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /tmp/etcd3-test/lib/python3.5/site-packages (from protobuf>=3.0.0->grpcio>=1.0.0->etcd3==0.2.0)
Installing collected packages: etcd3
Running setup.py develop for etcd3
Successfully installed etcd3
(etcd3-test) ~/git $ python
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import etcd3
>>>
I'll have a look and see what's wrong with the version pushed to pypi.
from python-etcd3.
This should now be fixed with 4abdd63. I've pushed 0.2.2 to pypi, which seems to work okay.
from python-etcd3.
Tested on a clean install, works fine now. thanks!
from python-etcd3.
Related Issues (20)
- get key detail from callback function
- a problem in using lease HOT 1
- client.close() occasionally takes 10s
- python-etcd3 is incompatible with grpcio versions newer than 1.44.0 (1.45+) HOT 5
- etcd3 does not connect to 3.5.0 server but etcd does HOT 1
- Do you still maintain this project? HOT 10
- TypeError: Descriptors cannot not be created directly HOT 1
- hi guy,we need to come up with a new version to fix the previous problem. If there is, I can help.
- Can't use etcd3 package? HOT 6
- locking with python3-etcd3 0.12.0 on etcd 3.4.23 fails? HOT 3
- Release plan after 0.12.0 HOT 1
- Bug in grpcio>=1.54.0 HOT 1
- Installing etcd3 HOT 2
- Let `python-etcd3` renew auth token when expired between calling `Lock.acquire` and `Lock.release`
- Updated release HOT 2
- How can I skip tls verify when I use the cert file?
- etcd3-client throwing error -
- about add_watch_callback HOT 1
- Can you help me upgrade the version number?
- How to "keep-alive" by lease_id? 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-etcd3.