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

Circular Import Error in fresh venv #344

Closed
lirkwood opened this issue Jan 11, 2022 · 4 comments · May be fixed by #346
Closed

Circular Import Error in fresh venv #344

lirkwood opened this issue Jan 11, 2022 · 4 comments · May be fixed by #346

Comments

@lirkwood
Copy link

When importing pyppeteer at all on my Ubuntu 21.10 system I recieve a circular import error as seen below. This is in a fresh virtualenv using Python 3.9.7.

Traceback (most recent call last):                                                                                     
  File "/home/linus/tmp/test.py", line 1, in <module>                                                                  
    import pyppeteer                                                                                                   
  File "/home/linus/.virtualenvs/test/lib/python3.9/site-packages/pyppeteer/__init__.py", line 10, in <module>         
    from pyppeteer.launcher import connect, executablePath, launch                                                     
  File "/home/linus/.virtualenvs/test/lib/python3.9/site-packages/pyppeteer/launcher.py", line 25, in <module>         
    from pyppeteer import __pyppeteer_home__                                                                           
ImportError: cannot import name '__pyppeteer_home__' from partially initialized module 'pyppeteer' (most likely due to 
a circular import) (/home/linus/.virtualenvs/test/lib/python3.9/site-packages/pyppeteer/__init__.py)
@kickononnell
Copy link

kickononnell commented Jan 11, 2022

I've also run into this issue while trying to use requests_html (I am not actually importing pyppeteer directly). For reference, I'm on Windows 11 with Python 3.10.1. Seems like there is no way around this bug atm.

@JackieFei
Copy link

+1, Python 3.8.8 on Mac

ImportError: cannot import name '__pyppeteer_home__' from partially initialized module 'pyppeteer' (most likely due to a circular import)

@Mattwmaster58
Copy link
Member

I'll take a look into this tonight. Does this occur in 1.0.0? I don't recall changing anything major and I thought I did test 1.0.1

Mattwmaster58 added a commit that referenced this issue Jan 11, 2022
@Mattwmaster58
Copy link
Member

Pushed 1.0.2 to fix this

mar10 added a commit to mar10/pyppeteer that referenced this issue Jan 12, 2022
The fix pyppeteer#344 did not work completely, since setting `__version__ = None`  in the exception handler will crash when calling ` version.split('.'))`  further down below.

Setting to a dummy `"0.0.0"` fixed it for me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants