Giter Club home page Giter Club logo

Comments (15)

Huibean avatar Huibean commented on August 12, 2024 2

@julianoes @xvzf 👌 thanks!

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024 1

Just to make sure:

Did you run pip install -r requirements.txt -r requirements-dev.txt ?

Also, which python version are you running?

And please try it inside an virtual environment:

$ python -m venv venv
$ . ./venv/bin/activate

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024

Hi!

You have to generate the plugins and then install the SDK, e.g. by executing pip install -e . inside the project root

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024

@xvzf I just did that, but problem still, here is the project tree and full log

➜  DronecodeSDK-Python git:(master) ✗ tree
.
├── README.md
├── docs
│   └── TODO.md
├── dronecode_sdk
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   └── async_plugin_manager.cpython-36.pyc
│   ├── _base.py
│   ├── async_plugin_manager.py
│   ├── generated
│   │   ├── __init__.py
│   │   ├── action_pb2.py
│   │   ├── action_pb2_grpc.py
│   │   ├── calibration_pb2.py
│   │   ├── calibration_pb2_grpc.py
│   │   ├── camera_pb2.py
│   │   ├── camera_pb2_grpc.py
│   │   ├── core_pb2.py
│   │   ├── core_pb2_grpc.py
│   │   ├── discovery_pb2.py
│   │   ├── discovery_pb2_grpc.py
│   │   ├── gimbal_pb2.py
│   │   ├── gimbal_pb2_grpc.py
│   │   ├── info_pb2.py
│   │   ├── info_pb2_grpc.py
│   │   ├── mission_pb2.py
│   │   ├── mission_pb2_grpc.py
│   │   ├── telemetry_pb2.py
│   │   └── telemetry_pb2_grpc.py
│   └── plugins
│       ├── __init__.py
│       └── __pycache__
│           └── __init__.cpython-36.pyc
├── dronecode_sdk.egg-info
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   ├── dependency_links.txt
│   ├── requires.txt
│   └── top_level.txt
├── examples
│   ├── mission.py
│   ├── takeoff_and_land.py
│   ├── telemetry_flight_mode.py
│   ├── telemetry_is_armed_is_in_air.py
│   └── telemetry_takeoff_and_land.py
├── other
│   ├── docker
│   │   └── testing
│   │       ├── Dockerfile
│   │       ├── build_python.sh
│   │       └── test.sh
│   ├── templates
│   │   ├── call.j2
│   │   ├── enum.j2
│   │   ├── file.j2
│   │   ├── request.j2
│   │   ├── stream.j2
│   │   ├── struct.j2
│   │   └── type_conversions
│   └── tools
│       ├── run_protoc.sh
│       └── run_tests.sh
├── proto
│   ├── README.md
│   ├── pb_plugins
│   │   ├── README.rst
│   │   ├── dcsdkgen
│   │   │   ├── __init__.py
│   │   │   ├── __main__.py
│   │   │   ├── autogen.py
│   │   │   ├── autogen_file.py
│   │   │   ├── enum.py
│   │   │   ├── methods.py
│   │   │   ├── name_parser.py
│   │   │   ├── struct.py
│   │   │   ├── type_info.py
│   │   │   └── utils.py
│   │   ├── dcsdkgen.egg-info
│   │   │   ├── PKG-INFO
│   │   │   ├── SOURCES.txt
│   │   │   ├── dependency_links.txt
│   │   │   ├── entry_points.txt
│   │   │   ├── requires.txt
│   │   │   └── top_level.txt
│   │   ├── requirements.txt
│   │   ├── setup.py
│   │   └── test
│   │       ├── __init__.py
│   │       ├── test_name_parser.py
│   │       └── test_type_info.py
│   └── protos
│       ├── action
│       │   └── action.proto
│       ├── calibration
│       │   └── calibration.proto
│       ├── camera
│       │   └── camera.proto
│       ├── core
│       │   └── core.proto
│       ├── discovery
│       │   └── discovery.proto
│       ├── gimbal
│       │   └── gimbal.proto
│       ├── info
│       │   └── info.proto
│       ├── mission
│       │   └── mission.proto
│       └── telemetry
│           └── telemetry.proto
├── requirements-dev.txt
├── requirements-test.txt
├── requirements.txt
├── setup.cfg
├── setup.py
├── tests
└── tox.ini

29 directories, 88 files
➜  DronecodeSDK-Python git:(master) ✗ ./other/tools/run_protoc.sh
[+] Installing the DronecodeSDK autogenerator
Obtaining file:///Users/huibean/Work/DronecodeSDK-Python/proto/pb_plugins
Requirement already satisfied: protobuf in /Users/huibean/anaconda3/lib/python3.6/site-packages (from dcsdkgen==0.1a0) (3.6.1)
Requirement already satisfied: jinja2 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from dcsdkgen==0.1a0) (2.9.6)
Requirement already satisfied: setuptools in /Users/huibean/anaconda3/lib/python3.6/site-packages (from protobuf->dcsdkgen==0.1a0) (36.5.0.post20170921)
Requirement already satisfied: six>=1.9 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from protobuf->dcsdkgen==0.1a0) (1.11.0)
Requirement already satisfied: MarkupSafe>=0.23 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from jinja2->dcsdkgen==0.1a0) (1.0)
Installing collected packages: dcsdkgen
  Found existing installation: dcsdkgen 0.1a0
    Uninstalling dcsdkgen-0.1a0:
      Successfully uninstalled dcsdkgen-0.1a0
  Running setup.py develop for dcsdkgen
Successfully installed dcsdkgen
[+] Done
[+] Generating plugins from
 -> [+] Generated protobuf and gRPC bindings for gimbal
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Gimbal.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/gimbal.py: No such file or directory
 -> [+] Generated plugin for gimbal
 -> [+] Generated protobuf and gRPC bindings for core
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Core.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/core.py: No such file or directory
 -> [+] Generated plugin for core
 -> [+] Generated protobuf and gRPC bindings for calibration
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Calibration.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/calibration.py: No such file or directory
 -> [+] Generated plugin for calibration
 -> [+] Generated protobuf and gRPC bindings for camera
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Camera.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/camera.py: No such file or directory
 -> [+] Generated plugin for camera
 -> [+] Generated protobuf and gRPC bindings for discovery
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Discovery.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/discovery.py: No such file or directory
 -> [+] Generated plugin for discovery
 -> [+] Generated protobuf and gRPC bindings for mission
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Mission.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/mission.py: No such file or directory
 -> [+] Generated plugin for mission
 -> [+] Generated protobuf and gRPC bindings for info
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Info.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/info.py: No such file or directory
 -> [+] Generated plugin for info
 -> [+] Generated protobuf and gRPC bindings for action
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Action.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/action.py: No such file or directory
 -> [+] Generated plugin for action
 -> [+] Generated protobuf and gRPC bindings for telemetry
: program not found or is not executable
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
mv: rename /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/Telemetry.py to /Users/huibean/Work/DronecodeSDK-Python/other/tools/../..//dronecode_sdk/plugins/telemetry.py: No such file or directory
 -> [+] Generated plugin for telemetry
[+] Done
➜  DronecodeSDK-Python git:(master) ✗ pip3 install -e .
Obtaining file:///Users/huibean/Work/DronecodeSDK-Python
Requirement already satisfied: protobuf>=3.5.1 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from dronecode-sdk==0.1.0a0) (3.6.1)
Requirement already satisfied: aiogrpc>=1.5 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from dronecode-sdk==0.1.0a0) (1.5)
Requirement already satisfied: grpcio>=1.11.0 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from dronecode-sdk==0.1.0a0) (1.17.1)
Requirement already satisfied: setuptools in /Users/huibean/anaconda3/lib/python3.6/site-packages (from protobuf>=3.5.1->dronecode-sdk==0.1.0a0) (36.5.0.post20170921)
Requirement already satisfied: six>=1.9 in /Users/huibean/anaconda3/lib/python3.6/site-packages (from protobuf>=3.5.1->dronecode-sdk==0.1.0a0) (1.11.0)
Installing collected packages: dronecode-sdk
  Found existing installation: dronecode-sdk 0.1.0a0
    Uninstalling dronecode-sdk-0.1.0a0:
      Successfully uninstalled dronecode-sdk-0.1.0a0
  Running setup.py develop for dronecode-sdk
Successfully installed dronecode-sdk
➜  DronecodeSDK-Python git:(master) ✗ examples/takeoff_and_land.py
Traceback (most recent call last):
  File "examples/takeoff_and_land.py", line 5, in <module>
    from dronecode_sdk import connect as dronecode_sdk_connect
  File "/Users/huibean/Work/DronecodeSDK-Python/dronecode_sdk/__init__.py", line 38, in <module>
    from .plugins import *
  File "/Users/huibean/Work/DronecodeSDK-Python/dronecode_sdk/plugins/__init__.py", line 3, in <module>
    from .gimbal import *
ModuleNotFoundError: No module named 'dronecode_sdk.plugins.gimbal'

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024
pip install -r requirements.txt -r requirements-dev.txt

was executed while following readme.md, would try venv later

from mavsdk-python.

julianoes avatar julianoes commented on August 12, 2024

Please use pip3 install -r requirements.txt -r requirements-dev.txt, unless your distribution brings Python 3 by default.

@xvzf we should use pip3 and python3 everywhere in all comments, docs etc.!

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024

@julianoes Agreed. I'll do that right away!

Also I'd strongly advice we opt in for venv because it setups all the path needed to execute the autogenerator! (we just cannot do python3 -m dcsdkgen, protobuf doesn't like it at all )

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024

@Huibean Please come back with the result! :-)

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024

@xvzf @julianoes In fact, I am using pip3 all the time, but it not seems to be the problem here, by the way I more likely to figure out how message is generated

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024

@xvzf @julianoes I just solved this, ./other/tools/run_protoc.sh could not handle the dcsdkgen path well, so I give a fix path to it and python3 -m grpc_tools.protoc run through

➜  DronecodeSDK-Python git:(master) ✗ which dcsdkgen
dcsdkgen not found
        python3 -m grpc_tools.protoc -I$(dirname ${PROTO_FILE}) \
                                     --plugin=protoc-gen-custom=$('/Users/huibean/.local/bin/dcsdkgen') \ #replace which dcsdkgen
                                     --custom_out=${PLUGIN_DIR} \
                                     --custom_opt=py \
                                     ${PROTO_FILE}

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024

maybe --user is not necessary while install dcsdkgen in this case, I made a pr for this fix #39

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024

➜ DronecodeSDK-Python git:(master) ✗ which dcsdkgen
dcsdkgen not found

This is likely because your PATH is not set correctly! Are you using a venv?

Can you post the output of echo $PATH ?

from mavsdk-python.

Huibean avatar Huibean commented on August 12, 2024

@xvzf when use --user in pip install, it would install to ~/.local/bin, I don't have ~/.local/bin in my $PATH, I haven't remove this manually before, not sure install anaconda would affected this

from mavsdk-python.

julianoes avatar julianoes commented on August 12, 2024

@Huibean what about adding ~/.local/bin to your $PATH? Isn't that common practice?

from mavsdk-python.

xvzf avatar xvzf commented on August 12, 2024

@Huibean You have to add it to your path or use a virtual environment as described above which setups the path for you!

from mavsdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.