Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import errors when launching rvctool #6

Open
BobMorane22 opened this issue Sep 10, 2023 · 3 comments
Open

Import errors when launching rvctool #6

BobMorane22 opened this issue Sep 10, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@BobMorane22
Copy link

Describe the bug
I followed the instructions on this repository to install the rvctool environment on my machine (Ubuntu 20.04.6 LTS). I did not use Conda, since I am not using Python for any other projects. When I lunch rvctool, I get import errors at startup (see below).

To Reproduce

  1. Run pip install rvc3python. All seems to go well.
  2. Launch rvctool (In my case it is not in PATH, but I can launch it from ~/.local/bin.)
  3. You get the "startup page" in the terminal, but import errors are reported.

Expected behavior
There should be no import errors.

Screenshots
Here is the contents of my "startup page":

john@doe:~/.local/bin$ ./rvctool 
 ____       _           _   _             __     ___     _                ___      ____            _             _   _____ 
|  _ \ ___ | |__   ___ | |_(_) ___ ___    \ \   / (_)___(_) ___  _ __    ( _ )    / ___|___  _ __ | |_ _ __ ___ | | |___ / 
| |_) / _ \| '_ \ / _ \| __| |/ __/ __|    \ \ / /| / __| |/ _ \| '_ \   / _ \/\ | |   / _ \| '_ \| __| '__/ _ \| |   |_ \ 
|  _ < (_) | |_) | (_) | |_| | (__\__ \_    \ V / | \__ \ | (_) | | | | | (_>  < | |__| (_) | | | | |_| | | (_) | |  ___) |
|_| \_\___/|_.__/ \___/ \__|_|\___|___( )    \_/  |_|___/_|\___/|_| |_|  \___/\/  \____\___/|_| |_|\__|_|  \___/|_| |____/ 
                                          |/                                                                                   
for Python (RTB==1.1.0, MVTB==0.9.6, SG==1.1.8, SMTB==1.1.8, NumPy==1.24.4, SciPy==1.10.1, Matplotlib==3.7.2)

    import math
    import numpy as np
    from scipy import linalg, optimize
    import matplotlib.pyplot as plt
    from spatialmath import *
    from spatialmath.base import *
    from spatialmath.base import sym
    from spatialgeometry import *
    from roboticstoolbox import *
    from machinevisiontoolbox import *
    import machinevisiontoolbox.base as mvb
    
    # useful variables
    from math import pi
    puma = models.DH.Puma560()
    panda = models.DH.Panda()

    func/object?       - show brief help
    help(func/object)  - show detailed help
    func/object??      - show source code
    
Results of assignments will be displayed, use trailing ; to suppress

Python 3.8.10 (default, May 26 2023, 14:05:08) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.2 -- An enhanced Interactive Python. Type '?' for help.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 startup()

File ~/.local/lib/python3.8/site-packages/RVC3/bin/rvctool.py:235, in startup()
    234 def startup():
--> 235     plt.ion()

File ~/.local/lib/python3.8/site-packages/matplotlib/pyplot.py:555, in ion()
    553 stack.callback(ion if isinteractive() else ioff)
    554 matplotlib.interactive(True)
--> 555 install_repl_displayhook()
    556 return stack

File ~/.local/lib/python3.8/site-packages/matplotlib/pyplot.py:157, in install_repl_displayhook()
    155 ipython_gui_name = backend2gui.get(get_backend())
    156 if ipython_gui_name:
--> 157     ip.enable_gui(ipython_gui_name)

File ~/.local/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py:932, in TerminalInteractiveShell.enable_gui(self, gui)
    928     self.active_eventloop = self._inputhook = None
    930 if gui and (gui not in {"inline", "webagg"}):
    931     # This hook runs with each cycle of the `prompt_toolkit`'s event loop.
--> 932     self.active_eventloop, self._inputhook = get_inputhook_name_and_func(gui)
    933 else:
    934     self.active_eventloop = self._inputhook = None

File ~/.local/lib/python3.8/site-packages/IPython/terminal/pt_inputhooks/__init__.py:134, in get_inputhook_name_and_func(gui)
    132 gui_mod = gui
    133 if gui.startswith("qt"):
--> 134     gui = set_qt_api(gui)
    135     gui_mod = "qt"
    137 mod = importlib.import_module("IPython.terminal.pt_inputhooks." + gui_mod)

File ~/.local/lib/python3.8/site-packages/IPython/terminal/pt_inputhooks/__init__.py:117, in set_qt_api(gui)
    114     return
    116 # Import it now so we can figure out which version it is.
--> 117 from IPython.external.qt_for_kernel import QT_API
    119 return qt_env2gui[QT_API]

File ~/.local/lib/python3.8/site-packages/IPython/external/qt_for_kernel.py:123
    119         return [qt_api]
    122 api_opts = get_options()
--> 123 QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
    124 enum_helper = enum_factory(QT_API, QtCore)

File ~/.local/lib/python3.8/site-packages/IPython/external/qt_loaders.py:376, in load_qt(api_options)
    373     if "QT_API" in os.environ:
    374         del os.environ["QT_API"]
--> 376     raise ImportError(
    377         """
    378 Could not load requested Qt binding. Please ensure that
    379 PyQt4 >= 4.7, PyQt5, PyQt6, PySide >= 1.0.3, PySide2, or
    380 PySide6 is available, and only one is imported per session.
    381 
    382 Currently-imported Qt library:                              %r
    383 PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
    384 PyQt6 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
    385 PySide2 installed:                                          %s
    386 PySide6 installed:                                          %s
    387 Tried to load:                                              %r
    388 """
    389         % (
    390             loaded_api(),
    391             has_binding(QT_API_PYQT5),
    392             has_binding(QT_API_PYQT6),
    393             has_binding(QT_API_PYSIDE2),
    394             has_binding(QT_API_PYSIDE6),
    395             api_options,
    396         )
    397     )

ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5, PyQt6, PySide >= 1.0.3, PySide2, or
    PySide6 is available, and only one is imported per session.

    Currently-imported Qt library:                              'pyqt5'
    PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): False
    PyQt6 available (requires QtCore, QtGui, QtSvg, QtWidgets): False
    PySide2 installed:                                          False
    PySide6 installed:                                          False
    Tried to load:                                              ['pyqt5']
    
'%.3g;'

>>> 

Additional context

  1. I am not a Python user, so I might be missing something very simple...
  2. May be related, since I see Qt stuff in the import errors: when trying the trplot2(R) command on page 34, I get a blank window:
    image
    (The window contains the information visible in the terminal over which it appeared).
@BobMorane22 BobMorane22 added the bug Something isn't working label Sep 10, 2023
@BobMorane22
Copy link
Author

While trying to solve this, I ran across this page in which a similar problem is described. This answer solved it for me. I can also see the graph from trplot2(R) on page 34.

I have no idea why it works, however...

@petercorke
Copy link
Owner

Hi Bob, sorry to be slow. Can you confirm you did the fix mentioned here ? If yes, I'll add it to an FAQ on the wiki.

I've found Qt to be more problematic than I expected it ever to be, for Macs with new Apple Silicon it was a nightmare...

@BobMorane22
Copy link
Author

@petercorke , I can confirm the fix mentioned in the link you provided remove all the startup errors for me.

Thanks to have taken the time to make these tools available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants