TeamPyOgg / PyOgg

Simple OGG Vorbis, Opus and FLAC bindings for Python
The Unlicense
63 stars 27 forks source link

ImportError: cannot import name 'OpusEncoder' from 'pyogg' #56

Open tobischw opened 3 years ago

tobischw commented 3 years ago

Hi,

I am on Windows 10 and followed the instructions for installing PyOgg. However, everytime I attempt to use it, I am greeted with this error:

ImportError: cannot import name 'OpusEncoder' from 'pyogg'

I installed it the normal way using pip install in an Anaconda environment. Any help would be appreciated.

mattgwwalker commented 3 years ago

That sounds very frustrating. I too would have just expected it to work out-of-the-box.

I wasn't aware that'd we'd released any versions with OpusEncoder included.

The version that I see that is available on PyPI is PyOgg 0.6.14a1 (https://pypi.org/project/PyOgg/)

And when I look up that version on GitHub I don't see any references to OpusEncoder. (https://github.com/TeamPyOgg/PyOgg/tree/c53233cdbbb485ca365337d9621fe33a0e39152a/pyogg)

So I'm at a bit of a loss. @Zuzu-Typ do you know how Tobi might have a version that includes OpusEncoder?

@tobischw, is it possible that you specified the in-development version from the GitHub repository when you issued the pip install command? Could you please share with us the full command that you used?

What version does pip list report for pyogg?

Cheers,

Matthew

mattgwwalker commented 3 years ago

It's worth notating however that I haven't tried using PyOgg with Anaconda.

Zuzu-Typ commented 3 years ago

Hi there you two,

@mattgwwalker I think you misinterpreted the issue. The problem is not that OpusEncoder exists, but rather that it does not, even though it's used in the examples on GitHub. It's most likely imported like this from pyogg import OpusEncoder and that doesn't work with the old versions of course.

@tobischw As of now, we haven't yet published the many changes that matthew has made to the PyPI yet, probably because we don't feel like it's completed yet. For the time being, try to refer to the documentation on here. Alternatively, you can also clone (i.e. download) the project from here, which should work the intended way (e.g. by using pip install git+https://github.com/TeamPyOgg/PyOgg).

Maybe we should push an updated version some time in the not too far future.

Cheers, --Zuzu_Typ--

mattgwwalker commented 3 years ago

You’re quite right Zuzu-Typ, I should have asked what it was that you were doing that caused the error Tobi. We’re you indeed trying the examples?

I would not yet recommend we publish the most recent additions. I have spent the last few weeks looking at the issues under Windows and the changes I made. The changes are most certainly not ready for prime time just yet.

However if the documentation’s lack of alignment with the released version is a problem, maybe that should be fixed urgently.

Tobi, I’d appreciate understanding a bit more about how you encountered the problem.

Cheers,

Matthew

On Tue, 27 Oct 2020 at 18:30, Zuzu-Typ notifications@github.com wrote:

Hi there you two,

@mattgwwalker https://github.com/mattgwwalker I think you misinterpreted the issue. The problem is not that OpusEncoder exists, but rather that it does not, even though it's used in the examples on GitHub. It's most likely imported like this from pyogg import OpusEncoder and that doesn't work with the old versions of course.

@tobischw https://github.com/tobischw As of now, we haven't yet published the many changes that matthew has made to the PyPI yet, probably because we don't feel like it's completed yet. For the time being, try to refer to the documentation on here https://pypi.org/project/PyOgg/. Alternatively, you can also clone (i.e. download) the project from here, which should work the intended way (e.g. by using pip install git+https://github.com/TeamPyOgg/PyOgg).

Maybe we should push an updated version some time in the not too far future.

Cheers, --Zuzu_Typ--

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TeamPyOgg/PyOgg/issues/56#issuecomment-716992937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA653XFPVCVEVBC6BSBIF7TSMZLHVANCNFSM4TADKQ3Q .

tobischw commented 3 years ago

Hi,

from reading your comments, I am assuming that OpusEncoder was simply not published yet, hence why it cannot be imported. I actively was looking for a library that makes Opus encoding a bit easier, so I assumed that this was part of it. That's most likely my fault for assuming that it has been released - not quite sure how I landed on the documentation then. No worries, I appreciate your work and your help.

Thanks, Tobi

ctron commented 3 years ago

I just ran into the same issue, just with the OpusBufferedEncoder.

Installed with:

pip3 install pyogg

And then the examples don't work, as the file containing OpusBufferedEncoder seems to be missing.

mattgwwalker commented 3 years ago

Sorry that you had the same issue. It will be resolved when we release the next version of PyOgg, which should happen soon.

If you would like to use the as-yet-unreleased code (which includes OpusBufferedEncoder), please clone the master branch of the repository and install that:

git clone https://github.com/TeamPyOgg/PyOgg.git
pip install -e .

Cheers,

Matthew

ctron commented 3 years ago

Thanks for the response. I completely understand. It was just confusing for me, as the README file points to the docs, and the docs already contain the information. Maybe have two docs: "latest released" and "latest"

I went with the solution mentioned above:

pip3 install git+https://github.com/TeamPyOgg/PyOgg@c78487ef52960d98ab3af5b66a744af8a5efe686

Which gives me some "stable" (in the form of a git commit hash) version, and still provides the unreleased functionality. Looked good so far. Thanks!