uzh-rpg / flightmare

An Open Flexible Quadrotor Simulator
https://uzh-rpg.github.io/flightmare/
Other
1.03k stars 346 forks source link

flightmare installation issues #211

Open abdul-mannan-khan opened 3 months ago

abdul-mannan-khan commented 3 months ago

Hello, Thank you so much for sharing this amazing work. Really grateful for this. I tried to install it following the installation guides give here and got following error:

  Building wheel for flightgym (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/mannan/anaconda3/envs/flightmare/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-m5n1lx4v/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-m5n1lx4v/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-xx5p8su_
       cwd: /tmp/pip-req-build-m5n1lx4v/
  Complete output (73 lines):
  running bdist_wheel
  running build
  running build_ext
  -- The C compiler identification is GNU 9.4.0
  -- The CXX compiler identification is GNU 9.4.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- ======================  !Flightmare!  ======================
  -- ======> Setup Dependencies
  -- Using system provided Eigen.
  /usr/include/eigen3
  -- Eigen3 include dir: /usr/include/eigen3
  -- Getting Pybind11...
  Cloning into 'pybind11-src'...
  Already on 'master'
  -- Pybind11 downloaded!
  -- pybind11 v2.14.0 dev1
  CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
    Could NOT find PythonInterp: Found unsuitable version "3.6.13", but
    required is at least "3.8" (found
    /home/mannan/anaconda3/envs/flightmare/bin/python)
  Call Stack (most recent call first):
    /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake-3.16/Modules/FindPythonInterp.cmake:169 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    externals/pybind11-src/tools/FindPythonLibsNew.cmake:114 (find_package)
    externals/pybind11-src/tools/pybind11Tools.cmake:50 (find_package)
    externals/pybind11-src/tools/pybind11Common.cmake:202 (include)
    externals/pybind11-src/CMakeLists.txt:249 (include)

  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-req-build-m5n1lx4v/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-req-build-m5n1lx4v/setup.py", line 106, in <module>
      zip_safe=False,
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-req-build-m5n1lx4v/setup.py", line 59, in run
      self.build_extension(ext)
    File "/tmp/pip-req-build-m5n1lx4v/setup.py", line 89, in build_extension
      cmake_args, cwd=self.build_temp, env=env)
    File "/home/mannan/anaconda3/envs/flightmare/lib/python3.6/subprocess.py", line 311, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-req-build-m5n1lx4v', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-req-build-m5n1lx4v/build/lib.linux-x86_64-3.6/', '-DPYTHON_EXECUTABLE=/home/mannan/anaconda3/envs/flightmare/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for flightgym
  Running setup.py clean for flightgym

To resolve this issue, I changed the conda environment from Python 3.6 to 3.8. Then, I got an issue of googletest repository. I downloaded it locally. Then, I hit an issue in CMakeLists.txt file in flightlib. So, I modifed it to:

cmake_minimum_required(VERSION 3.0)

project(flightlib VERSION 0.1.0)

message(STATUS "======================  !Flightmare!  ======================")

################################################################################
# Options
################################################################################
option(BUILD_TESTS "Building the tests" ON)
option(BUILD_UNITY_BRIDGE_TESTS "Building the Unity Bridge tests" ON)
option(BUILD_BENCH "Building the benchmark." OFF)
option(ENABLE_FAST "Build with optimizations for speed" ON)
option(ENABLE_BLAS "Build using BLAS and LAPACK libraries" OFF)
option(ENABLE_PARALLEL "Build using openmp parallelization" ON)
option(EIGEN_FROM_SYSTTEM "Use the system-provided Eigen" ON)
set(
  EIGEN_ALTERNATIVE "" CACHE STRING
  "Path to alternative Eigen, autodownload if blank"
)

################################################################################
# Finding Dependencies
################################################################################

message(STATUS "======> Setup Dependencies")
if(EIGEN_FROM_SYSTTEM)
  find_package(Eigen3 3.3.4 QUIET)
  if(EIGEN3_FOUND)
    message(STATUS "Using system provided Eigen.")
    message(${EIGEN3_INCLUDE_DIR})
  else()
    message(STATUS "No sufficient Eigen version (3.3.4) found.")
    message(STATUS "Restoring to download Eigen sources.")
    include(cmake/eigen.cmake)
  endif()
elseif(EIGEN_ALTERNATIVE STREQUAL "")
  include(cmake/eigen.cmake)
else()
  set(EIGEN_INCLUDE_DIR ${EIGEN_ALTERNATIVE})
endif()

message(STATUS "Eigen3 include dir: ${EIGEN3_INCLUDE_DIR}")

# Including dependencies 
include(cmake/pybind11.cmake)
include(cmake/yaml.cmake)

# Including dependencies 
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(OpenMP REQUIRED)

if(ENABLE_BLAS)
  set(BLA_VENDOR "Generic")
  find_package(BLAS REQUIRED)
  if(BLAS_FOUND)
    message(STATUS "Found BLAS: ${BLAS_LIBRARIES}")
  else()
    message(ERROR "Could not enable BLAS because BLAS was not found")
  endif()
  find_package(LAPACK REQUIRED)
  if(LAPACK_FOUND)
    message(STATUS "Found Lapack: ${LAPACK_LIBRARIES}")
  else()
    message(ERROR "Could not enable LAPACK because LAPACK was not found")
  endif()
endif()

# Check for ccache
if(NOT DEFINED CATKIN_DEVEL_PREFIX)
  find_program(CCACHE_PROGRAM ccache)
  if(CCACHE_PROGRAM)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
  else()
    message(INFO "Build time could be improved with ccache!")
    message(INFO "    sudo apt install ccache")
  endif()
endif()

################################################################################
# Setup Compilation
################################################################################
message(STATUS "======> Setup Compilation")

add_definitions(-DEIGEN_STACK_ALLOCATION_LIMIT=1048576)
include_directories(${EIGEN_INCLUDE_DIR} "tests")
include_directories(${OpenCV_INCLUDE_DIRS})

# Set default build type
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
  if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
  endif()
endif()

# Add c++ flags 
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -fPIC -Wall -DNDEBUG  -fopenmp")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -fPIC -Wall -g -fopenmp")
set(CMAKE_CXX_STANDARD 17)

# Architectural flags
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
  message(STATUS "Using ARMv7 optimized flags!")
  set(CMAKE_CXX_ARCH_FLAGS " -Wno-psabi -march=armv7-a -mfpu=neon -mfloat-abi=hard -funsafe-math-optimizations")
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  message(STATUS "Using ARM aarch64 optimized flags!")
  set(CMAKE_CXX_ARCH_FLAGS " -Wno-psabi -march=armv8-a+crypto -mcpu=cortex-a57+crypto")
else()
  set(CMAKE_CXX_ARCH_FLAGS " -march=native")
endif()

# Optimized flags
if(ENABLE_FAST)
  message(STATUS "Enabling fast optimization flags!")
  set(CMAKE_CXX_FAST_FLAGS " -Ofast")
else()
  set(CMAKE_CXX_FAST_FLAGS " -O0")
endif()

# BLAS Flags
if(BLAS_FOUND AND LAPACK_FOUND)
  message(STATUS "Enabling BLAS and LAPACK")
  set(CMAKE_CXX_BLAS_FLAGS " -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACK -DEIGEN_USE_LAPACKE")
else()
  set(CMAKE_CXX_BLAS_FLAGS "")
endif()

# Summarize Flags
set(CMAKE_CXX_FLAGS_RELEASE
  "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FAST_FLAGS} ${CMAKE_CXX_ARCH_FLAGS} ${CMAKE_CXX_PAR_FLAGS}")
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message(STATUS "The activated CXX RELEASE configuration is:\n ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "The activated CXX DEBUG configuration is:\n ${CMAKE_CXX_FLAGS_DEBUG}")

################################################################################
# Specify Build Resources
################################################################################
message(STATUS "======>  Setup Build  ")

# Create file lists for flightlib source
file(GLOB_RECURSE FLIGHTLIB_SOURCES
  src/bridges/*.cpp
  src/dynamics/*.cpp
  src/objects/*.cpp
  src/sensors/*.cpp
  src/envs/*.cpp
  src/common/*.cpp
)

# Create file lists for flightlib tests
file(GLOB_RECURSE FLIGHTLIB_TEST_SOURCES
  tests/dynamics/*.cpp
  tests/objects/*.cpp
  tests/sensors/*.cpp  
  tests/envs/*.cpp
  tests/common/*.cpp
)

# Create file lists for flightlib_gym source 
file(GLOB_RECURSE FLIGHTLIB_GYM_SOURCES
  src/wrapper/*.cpp 
)

# Create file lists for flightlib_gym tests
file(GLOB_RECURSE FLIGHTLIB_GYM_TEST_SOURCES
  tests/wrapper/*.cpp
)

# Create file lists for flightlib_unity_bridge tests
file(GLOB_RECURSE FLIGHTLIB_UNITY_BRIDGE_TEST_SOURCES
  tests/bridges/*.cpp
)

################################################################################
# Optional Catkin Build
################################################################################

if(DEFINED CATKIN_DEVEL_PREFIX)
  message(STATUS "======>  Building with -- catkin -- ")
  include(cmake/catkin.cmake)
  return()
endif()

################################################################################
# Setup Build
################################################################################

# Setup Testing and Benchmark
if(BUILD_TESTS OR BUILD_BENCH)
  # Point to the local googletest directory
  add_subdirectory(${CMAKE_SOURCE_DIR}/googletest)
  enable_testing()
endif()

# Library and Executables
include_directories(include)

if(NOT FLIGHTLIB_SOURCES)
  set(LIBRARY_NAME)
else()
  # flightlib
  add_library(${PROJECT_NAME} ${FLIGHTLIB_SOURCES})
  target_link_libraries(${PROJECT_NAME} PRIVATE
    ${OpenCV_LIBRARIES}
    yaml-cpp
    zmq
    zmqpp
    stdc++fs)
  set(LIBRARY_NAME ${PROJECT_NAME})
  set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
endif()

if(FLIGHTLIB_GYM_SOURCES)
  # flightlib_gym (python3 binding with Pybind11)
  pybind11_add_module(flightgym MODULE 
    ${FLIGHTLIB_GYM_SOURCES})
  if(EIGEN3_FOUND)
    target_include_directories(flightgym PRIVATE
      # ${PROJECT_SOURCE_DIR}/externals/pybind11-src/include
      ${PYBIND11_INCLUDE_DIR}
      ${PROJECT_SOURCE_DIR}/include
      ${EIGEN3_INCLUDE_DIR})  
  else()
    target_include_directories(flightgym PRIVATE
      # ${PROJECT_SOURCE_DIR}/externals/pybind11-src/include
      ${PYBIND11_INCLUDE_DIR}
      ${PROJECT_SOURCE_DIR}/externals/eigen/eigen3 #pybind11 use #include <Eigen/Core>, however, flightmare use #include <eigen3/Eigen/Core>
      ${PROJECT_SOURCE_DIR}/include)  
  endif()
  target_link_libraries(flightgym PRIVATE ${LIBRARY_NAME} )
endif()

if(ENABLE_BLAS AND BLAS_FOUND AND LAPACK_FOUND)
  message(STATUS "Linking standard BLAS ${BLAS_LIBRARIES}")
  target_link_libraries(${LIBRARY_NAME}
    ${BLAS_LIBRARIES}
    ${LAPACK_LIBRARIES}
    ${LAPACKE_LIBRARIES}
  )
endif()

# Build tests for flightlib gym wrapper
if(BUILD_TESTS AND FLIGHTLIB_GYM_TEST_SOURCES)
  add_executable(test_gym ${FLIGHTLIB_GYM_TEST_SOURCES})
  target_link_libraries(test_gym
    ${LIBRARY_NAME}
    gtest
    gtest_main)
add_test(test_gym test_gym)
endif()

# Build tests for flightlib
if(BUILD_TESTS AND FLIGHTLIB_TEST_SOURCES)
  add_executable(test_lib ${FLIGHTLIB_TEST_SOURCES})
  target_link_libraries(test_lib PUBLIC
    ${LIBRARY_NAME}
    gtest
    gtest_main)
add_test(test_lib test_lib)
endif()

# Build tests for flightlib unity bridge
if(BUILD_UNITY_BRIDGE_TESTS AND FLIGHTLIB_UNITY_BRIDGE_TEST_SOURCES)
  add_executable(test_unity_bridge ${FLIGHTLIB_UNITY_BRIDGE_TEST_SOURCES})
  target_link_libraries(test_unity_bridge PUBLIC
    ${LIBRARY_NAME}
    gtest
    gtest_main)
add_test(test_unity_bridge test_unity_bridge)
endif()

message(STATUS "================  !Done. No more nightmare!  ================")

Then, I also faced issue with setup.py file in flightlib. So, I changed it to

import os
import glob
import shutil
import re
import sys
import platform
import subprocess

from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion

class CMakeExtension(Extension):
    def __init__(self, name, sourcedir=''):
        Extension.__init__(self, name, sources=[])
        self.sourcedir = os.path.abspath(sourcedir)

class CMakeBuild(build_ext):
    def run(self):
        FLIGHTLIB_EXTERNAL_FILES = os.environ["FLIGHTMARE_PATH"] + \
            "/flightlib/externals/"
        # --------------------------------
        # remove cached external files
        # a hack to solve some cmake error when using "pip install ."
        try:
            for i, p in enumerate(glob.glob(os.path.join(FLIGHTLIB_EXTERNAL_FILES, "*"))):
                shutil.rmtree(p)
                print("Removing some cache file: ", p)
        except:
            pass
        FLIGHTLIB_BUILD_FILES = os.environ["FLIGHTMARE_PATH"] + \
            "/flightlib/build/"
        # --------------------------------
        # remove cached files
        # a hack to solve some cmake error when using "pip install ."
        try:
            for i, p in enumerate(glob.glob(os.path.join(FLIGHTLIB_BUILD_FILES, "*"))):
                shutil.rmtree(p)
                print("Removing some cache file: ", p)
        except:
            pass
        # --------------------------------

        try:
            out = subprocess.check_output(['cmake', '--version'])
        except OSError:
            raise RuntimeError("CMake must be installed to build the following extensions: " +
                               ", ".join(e.name for e in self.extensions))

        if platform.system() == "Windows":
            cmake_version = LooseVersion(
                re.search(r'version\s*([\d.]+)', out.decode()).group(1))
            if cmake_version < '3.1.0':
                raise RuntimeError("CMake >= 3.1.0 is required on Windows")

        for ext in self.extensions:
            self.build_extension(ext)

    def build_extension(self, ext):
        extdir = os.path.abspath(os.path.dirname(
            self.get_ext_fullpath(ext.name)))
        # required for auto-detection of auxiliary "native" libs
        if not extdir.endswith(os.path.sep):
            extdir += os.path.sep
        cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
                      '-DPYTHON_EXECUTABLE=' + sys.executable]

        cfg = 'Debug' if self.debug else 'Release'
        build_args = ['--config', cfg]

        if platform.system() == "Windows":
            cmake_args += [
                '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
            if sys.maxsize > 2**32:
                cmake_args += ['-A', 'x64']
            build_args += ['--', '/m']
        else:
            cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
            build_args += ['--', '-j4']

        env = os.environ.copy()
        env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
                                                              self.distribution.get_version())
        if not os.path.exists(self.build_temp):
            os.makedirs(self.build_temp)
        subprocess.check_call(['cmake', ext.sourcedir] +
                              cmake_args, cwd=self.build_temp, env=env)
        subprocess.check_call(['cmake', '--build', '.'] +
                              build_args, cwd=self.build_temp)

setup(
    name='flightgym',
    version='0.0.1',
    author='Yunlong Song',
    author_email='song@ifi.uzh.ch',
    description='Flightmare: A Quadrotor Simulator.',
    long_description='',
    ext_modules=[CMakeExtension('flightlib')],
    install_requires=['gym==0.11', 'ruamel.yaml',
                      'numpy', 'stable_baselines==2.10.1'],
    cmdclass=dict(build_ext=CMakeBuild),
    include_package_data=True,
    zip_safe=False,
)

Then, I ran into issues with dependencies, i resolved them by running

pip install oauthlib>=3.0.0 requests-oauthlib

Finally, I got successful installation. However, when I tried to run

python3 run_drone_control.py --train 0 --render 1

I got a problem ModuleNotFoundError: No module named 'tensorflow'. Upon further reading, I found that I cannot install Tensorflow 1 version because it is not compatible for Python 3.8. This repository is using Tensorflow 1. In conclusion, this repository is not working Python 3.6 and if we use Python 3.8, we get issues with Tensorflow 1. Any solution? Thank you.

lakshmikanth-nageswar commented 3 months ago

Hi, I am facing similar issue and am unable to resolve it yet. Could you please let me know if you find a solution.

Thanks!

abdul-mannan-khan commented 3 months ago

No. David Scaramuzza team needs to take a look at it as installation is very old.

purewoo1 commented 2 months ago

Hi, I am facing similar issue and am unable to resolve it yet. Could you please let me know if you find a solution. Thanks!!!

Jinwei-Liu commented 1 month ago

I encountered the same issues, and here’s how I solved them.

For the first issue, you can refer to this discussion: flightmare issue #208.

After that, you might encounter a second issue, as described in flightmare issue #175. By applying the changes mentioned there, you should be able to resolve the problem completely.

By the way, python_version == 3.6

zhaozilong2zl commented 1 month ago

I encountered the same issues, and here’s how I solved them.

The first issue is not caused by CMake, but by pybind11. You can refer to this discussion: flightmare issue #208. Simply follow the proposed solution or try running pip install pybind11==2.12 to downgrade pybind11.

After that, you might encounter a second issue, as described in flightmare issue #175. By applying the changes mentioned there, you should be able to resolve the problem completely.

By the way, python_version == 3.6

thank you for your record! what's the ubuntu version did you used? i encounter the same problem but can't make it

Jinwei-Liu commented 1 month ago

I encountered the same issues, and here’s how I solved them. The first issue is not caused by CMake, but by pybind11. You can refer to this discussion: flightmare issue #208. Simply follow the proposed solution or try running to downgrade pybind11.pip install pybind11==2.12 After that, you might encounter a second issue, as described in flightmare issue #175. By applying the changes mentioned there, you should be able to resolve the problem completely. By the way, python_version == 3.6

thank you for your record! what's the ubuntu version did you used? i encounter the same problem but can't make it

I used Ubuntu 20.04 to solve the issue.

zhaozilong2zl commented 1 month ago

I encountered the same issues, and here’s how I solved them. The first issue is not caused by CMake, but by pybind11. You can refer to this discussion: flightmare issue #208. Simply follow the proposed solution or try running to downgrade pybind11.pip install pybind11==2.12 After that, you might encounter a second issue, as described in flightmare issue #175. By applying the changes mentioned there, you should be able to resolve the problem completely. By the way, python_version == 3.6

thank you for your record! what's the ubuntu version did you used? i encounter the same problem but can't make it

I used Ubuntu 20.04 to solve the issue.

thank you for your quick reply! so you successfully install flightmare in ubuntu20.04 and python3.6 right?(congratulations!!!)

i am trying to do the same thing but fail for days

did you complete the full installation merely by Install with pip and the two changes(pybind==2.12 and master to main), i retry many times but keep failing T_T, looking forward to your reply, congratulates for your success again!

Jinwei-Liu commented 1 month ago

thank you for your quick reply! so you successfully install flightmare in ubuntu20.04 and python3.6 right?(congratulations!!!)

i am trying to do the same thing but fail for days

did you complete the full installation merely by Install with pip and the two changes(pybind==2.12 and master to main), i retry many times but keep failing T_T, looking forward to your reply, congratulates for your success again!

Yes, please proceed based on the documentation for Install with pip and make the necessary adjustments: first, change the file flightlib/cmake/pybind11_download.cmake from master to v2.12; second, change flightlib/cmake/gtest_download.cmake from master to main. Maybe you can also post the error message.

I tried again and confirmed that I only need to modify these two documents in ubuntu20.04 or ubuntu22.04 and python3.6 .

zhaozilong2zl commented 1 month ago

Yes, please proceed based on the documentation for Install with pip and make the necessary adjustments: first, change the file flightlib/cmake/pybind11_download.cmake from master to v2.12; second, change flightlib/cmake/gtest_download.cmake from master to main. Maybe you can also post the error message.

I tried again and confirmed that I only need to modify these two documents in ubuntu20.04 or ubuntu22.04 and python3.6 .

thank you for your time for retrying the installation again!

however, i still got these errors below

1, after "pip install ." in /flightlib, got this failed to build opencv-python error image and i found an issue perfectly match my error infomation in #209 , like AnasAbdelR point that the issue may caused by unproper opencv-python version, so i try "pip install opencv-python==4.6" and "pip install opencv-python-headless==4.6" then, both install succesfully image and then i retry "pip install ." in flightlib, there is no error! image

but when i "pip install -e ." in flightrl (because pip install . will rise "No module named 'rpg_baselines.common'" error then), and then "python3 run_drone_control.py --train 0", i will get the dump error below (it confused me because i encounter this error before when i try to use python3.7 to install flightmare, at thar trail i got the exactly error) image

so anyway, i still can't run the flightmare at last, maybe i should change another environment for my research haha T_T

soooooo much thanks for your time, i am great appreciate!!!! wish you can get your ideal experiment result!

Jinwei-Liu commented 1 month ago

Yes, I also encountered the issue you mentioned. I originally thought you would solve it, so it's great to hear that you've managed to resolve the OpenCV-Python error. For your last issue, you can solve it by running:

pip uninstall ruamel.yaml pip install ruamel.yaml==0.16.13

Finally, you will get it working.

image

zhaozilong2zl commented 1 month ago

Yes, I also encountered the issue you mentioned. I originally thought you would solve it, so it's great to hear that you've managed to resolve the OpenCV-Python error. For your last issue, you can solve it by running:

pip uninstall ruamel.yaml pip install ruamel.yaml==0.16.13

Finally, you will get it working.

image

follow your command i successfully run the demo finally! can't be more appreciate for your kind instruction ! you save me from desperate!!!!!!!!!!!!!!!!!!!!!!!!!!

so for the afterward researchers who struggle to install flightmare in ubuntu20.04 and python3.6, please just follow our discussion and try one more time before you give up!

thank you Jinwei !!!

zhw970623 commented 4 weeks ago

Yes, I also encountered the issue you mentioned. I originally thought you would solve it, so it's great to hear that you've managed to resolve the OpenCV-Python error. For your last issue, you can solve it by running: pip uninstall ruamel.yaml pip install ruamel.yaml==0.16.13 Finally, you will get it working. image

follow your command i successfully run the demo finally! can't be more appreciate for your kind instruction ! you save me from desperate!!!!!!!!!!!!!!!!!!!!!!!!!!

so for the afterward researchers who struggle to install flightmare in ubuntu20.04 and python3.6, please just follow our discussion and try one more time before you give up!

thank you Jinwei !!!

Have you ever encountered such an error when installing flightmare, I fell into the trap of pain just like you

Building wheel for flightgym (setup.py) ... error ERROR: Command errored out with exit status 1: command: /opt/anaconda/envs/flightmare/bin/python -u -c 'import io, os, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-p46yvcrt/setup.py'"'"';mp/pip-req-build-p46yvcrt/setup.py'"'"';f = getattr(tokenize, '"'"'open'") if os.path.exists(file) else io.StringIO('"'"'from setuptools imp)'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();e file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-z8anhpai cwd: /tmp/pip-req-build-p46yvcrt/ Complete output (207 lines): running bdist_wheel running build running build_ext -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- ====================== !Flightmare! ====================== -- ======> Setup Dependencies -- Using system provided Eigen. /usr/local/include/eigen3 -- Eigen3 include dir: /usr/local/include/eigen3 -- Getting Pybind11... 正克隆到 'pybind11-src'... fatal: 无法访问 'https://github.com/pybind/pybind11.git/':Failed to coom port 443 after 133288 ms: 连接超时 正克隆到 'pybind11-src'... 切换到一个新分支 'v2.12' -- Pybind11 downloaded! -- pybind11 v2.12.1 -- Found PythonInterp: /opt/anaconda/envs/flightmare/bin/python (found "3.6.13", minimum required is "3.6") -- Found PythonLibs: /opt/anaconda/envs/flightmare/lib/libpython3.6m.so -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Getting yaml-cpp... -- Yaml downloaded! -- Found OpenCV: /usr (found version "4.5.4") -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5") INFOBuild time could be improved with ccache! INFO sudo apt install ccache -- ======> Setup Compilation -- Enabling fast optimization flags! -- The activated CXX RELEASE configuration is: -DVERSION_INFO=\"0.0.1\" -fPIC -Wall -DNDEBUG -fopenmp -Ofast -marc -- The activated CXX DEBUG configuration is: -DVERSION_INFO=\"0.0.1\" -fPIC -Wall -g -fopenmp -- ======> Setup Build -- Getting gtests... 正克隆到 'googletest-src'... 已经位于 'main' -- gtests downloaded! -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- ================ !Done. No more nightmare! ================ -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip-req-build-p46yvcrt/build/-3.6 [ 1%] Building CXX object ../../externals/googletest-build/googletest/dir/src/gtest-all.cc.o [ 2%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cb/graphbuilder.cpp.o [ 4%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cb/graphbuilderadapter.cpp.o [ 5%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-c.cpp.o [ 6%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-ct.cpp.o [ 9%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cives.cpp.o [ 9%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cuard.cpp.o [ 10%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cpp.o [ 12%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-comevents.cpp.o [ 13%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cr.cpp.o [ 15%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-crstate.cpp.o [ 16%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-crutils.cpp.o [ 19%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cions.cpp.o [ 19%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cp.o [ 20%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-c.cpp.o [ 21%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cpp.o [ 23%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cata.cpp.o [ 24%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cilder.cpp.o [ 26%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cents.cpp.o [ 27%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cpp.o [ 28%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cm_wrapper.cpp.o [ 30%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-ccpp.o [ 31%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-c.cpp.o [ 32%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cyaml.cpp.o [ 34%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cr.cpp.o [ 35%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-calar.cpp.o [ 36%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cg.cpp.o [ 38%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cken.cpp.o [ 39%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-ckey.cpp.o [ 41%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cdocparser.cpp.o [ 42%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-c.cpp.o [ 43%] Building CXX object ../../externals/yaml-build/CMakeFiles/yaml-cp.o [ 45%] Linking CXX static library libyaml-cpp.a [ 45%] Built target yaml-cpp [ 46%] Building CXX object CMakeFiles/flightlib.dir/src/bridges/unity_b [ 49%] Building CXX object CMakeFiles/flightlib.dir/src/common/integrat [ 49%] Building CXX object CMakeFiles/flightlib.dir/src/common/command. [ 50%] Building CXX object CMakeFiles/flightlib.dir/src/common/integrat [ 52%] Building CXX object CMakeFiles/flightlib.dir/src/common/integrat [ 53%] Linking CXX static library ../../../build/temp.linux-x86_64-3.6/ [ 53%] Built target gtest [ 54%] Building CXX object ../../externals/googletest-build/googletest/main.dir/src/gtest_main.cc.o [ 56%] Building CXX object CMakeFiles/flightlib.dir/src/common/logger.c [ 57%] Building CXX object CMakeFiles/flightlib.dir/src/common/math.cpp [ 58%] Linking CXX static library ../../../build/temp.linux-x86_64-3.6/.a [ 60%] Building CXX object CMakeFiles/flightlib.dir/src/common/paramete [ 60%] Built target gtest_main [ 61%] Building CXX object CMakeFiles/flightlib.dir/src/common/pend_sta [ 63%] Building CXX object CMakeFiles/flightlib.dir/src/common/quad_sta [ 64%] Building CXX object CMakeFiles/flightlib.dir/src/common/timer.cp [ 65%] Building CXX object CMakeFiles/flightlib.dir/src/dynamics/dynami [ 67%] Building CXX object CMakeFiles/flightlib.dir/src/dynamics/quadroo [ 68%] Building CXX object CMakeFiles/flightlib.dir/src/envs/envbase.c [ 69%] Building CXX object CMakeFiles/flightlib.dir/src/envs/quadrotor.cpp.o [ 71%] Building CXX object CMakeFiles/flightlib.dir/src/envs/test_env.c [ 72%] Building CXX object CMakeFiles/flightlib.dir/src/envs/vecenv.cp [ 73%] Building CXX object CMakeFiles/flightlib.dir/src/objects/object [ 75%] Building CXX object CMakeFiles/flightlib.dir/src/objects/quadrot [ 76%] Building CXX object CMakeFiles/flightlib.dir/src/objects/unity_c [ 78%] Building CXX object CMakeFiles/flightlib.dir/src/sensors/imu.cpp [ 79%] Building CXX object CMakeFiles/flightlib.dir/src/sensors/rgbcam [ 80%] Building CXX object CMakeFiles/flightlib.dir/src/sensors/sensor [ 82%] Linking CXX static library libflightlib.a [ 82%] Built target flightlib [ 83%] Building CXX object CMakeFiles/test_unitybridge.dir/tests/bridgpp.o [ 84%] Building CXX object CMakeFiles/flightgym.dir/src/wrapper/pybind [ 86%] Building CXX object CMakeFiles/test_lib.dir/tests/common/eigen.c [ 87%] Building CXX object CMakeFiles/test_lib.dir/tests/common/integra [ 89%] Building CXX object CMakeFiles/test_lib.dir/tests/common/logger. [ 90%] Building CXX object CMakeFiles/test_lib.dir/tests/common/quad_st [ 91%] Building CXX object CMakeFiles/test_lib.dir/tests/dynamics/quadr.o [ 93%] Linking CXX executable test_unity_bridge /usr/bin/ld: warning: libzmq.so.3, needed by /usr/lib/gcc/x86_64-linux-86_64-linux-gnu/libzmqpp.so, may conflict with libzmq.so.5 /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibitializeConnections()': unity_bridge.cpp:(.text+0x3ff): undefined reference tozmqpp::socket::::basic_string<char, std::char_traits, std::allocator > const /usr/bin/ld: unity_bridge.cpp:(.text+0x4fb): undefined reference to zm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator< /usr/bin/ld: unity_bridge.cpp:(.text+0x545): undefined reference tozmcribe(std::cxx11::basic_string<char, std::char_traits, std::alloct&)' /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndleSettings()': unity_bridge.cpp:(.text+0x28f4): undefined reference tozmqpp::messageunsigned long const&) const' /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndInitialSettings()': unity_bridge.cpp:(.text+0x32ae): undefined reference tozmqpp::message:cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibtPointCloud(flightlib::PointCloudMessage_t&, float)': unity_bridge.cpp:(.text+0x3a8f): undefined reference tozmqpp::message:cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibtRender(unsigned long)': unity_bridge.cpp:(.text+0x48bc): undefined reference tozmqpp::message:cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndleOutput()': unity_bridge.cpp:(.text+0x4a92): undefined reference tozmqpp::messageunsigned long const&) const' collect2: error: ld returned 1 exit status gmake[2]: [CMakeFiles/test_unity_bridge.dir/build.make:156:test_un1 gmake[1]: [CMakeFiles/Makefile2:307:CMakeFiles/test_unity_bridge.d gmake[1]: *** 正在等待未完成的任务.... [ 94%] Building CXX object CMakeFiles/test_lib.dir/tests/envs/quadrotorv.cpp.o [ 95%] Building CXX object CMakeFiles/test_lib.dir/tests/envs/vec_env.c [ 97%] Linking CXX shared module ../lib.linux-x86_64-3.6/flightgym.cpytnux-gnu.so lto-wrapper: warning: using serial compilation of 4 LTRANS jobs [ 98%] Building CXX object CMakeFiles/test_lib.dir/tests/objects/quadro [ 98%] Built target flightgym [100%] Linking CXX executable test_lib /usr/bin/ld: warning: libzmq.so.3, needed by /usr/lib/gcc/x86_64-linux-86_64-linux-gnu/libzmqpp.so, may conflict with libzmq.so.5 /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibitializeConnections()': unity_bridge.cpp:(.text+0x3ff): undefined reference tozmqpp::socket::::basic_string<char, std::char_traits, std::allocator > const /usr/bin/ld: unity_bridge.cpp:(.text+0x4fb): undefined reference to zm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator< /usr/bin/ld: unity_bridge.cpp:(.text+0x545): undefined reference tozmcribe(std::cxx11::basic_string<char, std::char_traits, std::alloct&)' /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndleSettings()': unity_bridge.cpp:(.text+0x28f4): undefined reference tozmqpp::messageunsigned long const&) const' /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndInitialSettings()': unity_bridge.cpp:(.text+0x32ae): undefined reference tozmqpp::message:__cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibtPointCloud(flightlib::PointCloudMessage_t&, float)': unity_bridge.cpp:(.text+0x3a8f): undefined reference tozmqpp::message:cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibtRender(unsigned long)': unity_bridge.cpp:(.text+0x48bc): undefined reference tozmqpp::message:cxx11::basic_string<char, std::char_traits, std::allocator /usr/bin/ld: libflightlib.a(unity_bridge.cpp.o): in function flightlibndleOutput()': unity_bridge.cpp:(.text+0x4a92): undefined reference tozmqpp::messageunsigned long const&) const' collect2: error: ld returned 1 exit status gmake[2]: [CMakeFiles/test_lib.dir/build.make:268:test_lib] 错误 1 gmake[1]: [CMakeFiles/Makefile2:278:CMakeFiles/test_lib.dir/all] 错 gmake: * [Makefile:146:all] 错误 2 Traceback (most recent call last): File "", line 1, in File "/tmp/pip-req-build-p46yvcrt/setup.py", line 106, in zip_safe=False, File "/opt/anaconda/envs/flightmare/lib/python3.6/site-packages/setup", line 153, in setup return distutils.core.setup(attrs) File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/core.py",up dist.run_commands() File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/dist.py",_commands self.run_command(cmd) File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/dist.py",_command cmd_obj.run() File "/opt/anaconda/envs/flightmare/lib/python3.6/site-packages/wheel line 299, in run self.run_command('build') File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/cmd.py", command self.distribution.run_command(command) File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/dist.py",_command cmd_obj.run() File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/command/b5, in run self.run_command(cmd_name) File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/cmd.py", command self.distribution.run_command(command) File "/opt/anaconda/envs/flightmare/lib/python3.6/distutils/dist.py",_command cmd_obj.run() File "/tmp/pip-req-build-p46yvcrt/setup.py", line 59, in run self.build_extension(ext) File "/tmp/pip-req-build-p46yvcrt/setup.py", line 91, in build_extens build_args, cwd=self.build_temp) File "/opt/anaconda/envs/flightmare/lib/python3.6/subprocess.py", linall raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--co '--', '-j4']' returned non-zero exit status 2.

ERROR: Failed building wheel for flightgym

zhaozilong2zl commented 4 weeks ago

Have you ever encountered such an error when installing flightmare, I fell into the trap of pain just like you

sorry i didn't meet the same error. the error info seems like a conflict of different version of zmqpp packages? ( in your message,'/usr/bin/ld: warning: libzmq.so.3, needed by /usr/lib/gcc/x86_64-linux-86_64-linux-gnu/libzmqpp.so, may conflict with libzmq.so.5') maybe reinstall zmqpp could help