DEV Community

Discussion on: How to Download YouTube videos in Python.

Collapse
 
mwangidenis11 profile image
Mwangi Denis

i getting this error:

AttributeError: partially initialized module 'pytube' has no attribute 'YouTube' (most likely due to a circular import)

My file:

`import pytube

print("Give URL:")
url = 'input()'

pytube.YouTube(url).streams.get_highest_resolution().download()`

Collapse
 
ariaenggar profile image
Aria Enggar Pamungkas • Edited

I'm getting the same error.. python 3.8, using pytube3 library.

update: it worked after I uninstall then reinstall pytube3, I think you must install pytube3 in the first place and don't try to install pytube.

Collapse
 
seijind profile image
George Karanikolas

Have you download the module?
With this command - > pip install pytube

Collapse
 
mwangidenis11 profile image
Mwangi Denis

That was the first thing I did.

Thread Thread
 
seijind profile image
George Karanikolas

Try to install pytube3 (sometimes is need it)

Thread Thread
 
mwangidenis11 profile image
Mwangi Denis

Still Nothing;

youtube = pytube.YouTube(url)
AttributeError: partially initialized module 'pytube' has no attribute 'YouTube' (most likely due to a circular import)

Thread Thread
 
tangopj profile image
TangoPJ

I got this error: ImportError: cannot import name 'quote' from 'pytube.compat'. Then I installed pytube3 - now it works. Thank you a lot :)

Thread Thread
 
brahimbc profile image
brahimbc

Hi,
verify that the name of your script is not "pytube.py"

Collapse
 
mwangidenis11 profile image
Mwangi Denis

That was the first thing I did