quanser / Quanser_Interactive_Labs_Resources

Libraries, documentation and tutorials for coding using the Quanser Interactive Labs environment.
0 stars 1 forks source link

package link might need fixing #1

Closed xinyioffice closed 1 year ago

xinyioffice commented 1 year ago

Dear Quanser Tech Team,

I tried to run these tutorials with the up-to-date Quanser Python packages (2023.4.13), but there is an ImportError:

Traceback (most recent call last):
  File "e:\GitHub_Repos\QLabs\Quanser_Interactive_Labs_Resources\python\tutorials\qcar_tutorial1.py", line 14, in <module>
    from qvl.qlabs import QuanserInteractiveLabs
  File "C:\Users\lenovo\Documents\Quanser\libraries\python\qvl\qlabs.py", line 1, in <module>
    from quanser.communications import Stream, StreamError, PollFlag, Timeout
ImportError: cannot import name 'Timeout' from 'quanser.communications' (E:\miniconda\envs\Quanser\Lib\site-packages\quanser\communications\__init__.py)

I have checked the docs.

It seems that you have changed the Timeout type from Quanser Communications API to Quanser Common API in the most recent updates.

But the qlabs.py from the QVL still import Timeout from quanser.communications.

I tried to manually change the qlabs.py from this

from quanser.communications import Stream, StreamError, PollFlag, Timeout

to this

from quanser.communications import Stream, StreamError, PollFlag
from quanser.common import Timeout

Then the error is fixed.

I don't exactly know how is this QVL generated, so can you please fix this?

xinyioffice commented 1 year ago

Sorry, I check the repo PR again, the commit 1acd879 and 9b657e0 have fixed this.

The reason why this would happen to me is that when updated the Quanser Python packages, I reinstalled the QVL, but due to network issue, it couldn't clone the repo with pygit:

Installing Quanser virtual libraries...
Error: Failed to install files from GitHub (Note: this requires a valid internet connection).
Would you like to skip this part for now and finish with the rest of the installation? (y,[n])

I chose to skip this part, so the APIs are new, but the QVL remains the old version.

I used a proxy to clone the repo properly, then solved this issue.

Sorry for opening an issue, as I thought it was a bug. But actually, it was my own operational problem.

petemartin commented 1 year ago

No problem! Glad to hear you're back up and running.