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

pyppeteer.errors.BrowserError: Browser closed unexpectedly #95

Closed
NeelDroid opened this issue May 22, 2020 · 13 comments
Closed

pyppeteer.errors.BrowserError: Browser closed unexpectedly #95

NeelDroid opened this issue May 22, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@NeelDroid
Copy link

NeelDroid commented May 22, 2020

System is Ubuntu 16.04 LTS
I am using a virtualenv which uses python3.7.
>>> api.byHashtag('cat', count=30)

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 176, in byHashtag id = self.getHashtagObject(hashtag)['challengeInfo']['challenge']['id'] File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 211, in getHashtagObject b = browser(api_url) File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/TikTokApi/browser.py", line 27, in __init__ asyncio.get_event_loop().run_until_complete(self.start()) File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete return future.result() File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/TikTokApi/browser.py", line 30, in start self.browser = await pyppeteer.launch(self.options) File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/pyppeteer/launcher.py", line 305, in launch return await Launcher(options, **kwargs).launch() File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/pyppeteer/launcher.py", line 166, in launch self.browserWSEndpoint = get_ws_endpoint(self.url) File "/home/ubuntu/tiktok-search/tkenv/lib/python3.7/site-packages/pyppeteer/launcher.py", line 225, in get_ws_endpoint raise BrowserError('Browser closed unexpectedly:\n') pyppeteer.errors.BrowserError: Browser closed unexpectedly:

I am unable to see what's wrong. I was searching around. but did not get anything.

@NeelDroid
Copy link
Author

Ok I tried python3.6 as well. same issue. But surprisingly, it's working on windows anaconda with python3.6

@davidteather
Copy link
Owner

Is your chrome driver in your path? Is the command “chromedriver” registered?

@davidteather davidteather added the bug Something isn't working label May 23, 2020
@NeelDroid
Copy link
Author

NeelDroid commented May 23, 2020

Ok I had to manually install it over apt.
sudo apt-get install chromium-chromedriver

It's fetching JSON now. Thank you a lot. This was very important for me.

So, it means after installing the API & running pyppeteer-install on a virtualenv one needs to install the chromedriver globally or I think running the pyppeteer-install globally should work.

@davidteather
Copy link
Owner

Glad you figured it out. I’ll add that in the next update’s documentation. It’s already on the nightly branch’s documentation.

Thanks!

@thanhnguyen1121
Copy link

I encountered your same problem. I also installed "sudo apt-get install chromium-chromedriver". But it does not work. Please help me!

@davidteather
Copy link
Owner

What does it say when you run the command chromedriver ?

@thanhnguyen1121
Copy link

@davidteather haizzzz... thanks your question. It reminds me that I have not installed "sudo apt install ./google-chrome-stable_current_amd64.deb"! thank you very much.

@mtdunphy-umd
Copy link

Got it to work on my Mac no problem, but has anyone been able to get it to work in a Jupyter notebook? Still getting the "Browser closed unexpectedly" even after adding "!pyppeteer-install" and installing chromedriver with "!pip install chromedriver_installer". Am I just missing something basic here?

@crazygmr101
Copy link
Contributor

I don't see it ever working without something similar to #198, due to the fact Jupyter makes an event loop to run things in. Related to #115

@michellebao
Copy link

Advice for trying to get it to work on Jupyter? I'm working in Colab but also running into the "browser closed unexpectedly error." I tried installing Chromedriver like this: !wget https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_linux64.zip -O /tmp/chromedriver.zip && unzip /tmp/chromedriver.zip -d /opt && sudo chmod 755 /opt/chromedriver && sudo ln -fs /opt/chromedriver /usr/bin/chromedriver && sudo ln -fs /opt/chromedriver /usr/local/bin/chromedriver and like this: !pip install chromedriver_install but am getting the error for both ways. Also, !pip install chromedriver_installer gave this error: ERROR: Failed building wheel for chromedriver-installer. I am also doing the import nest_asyncio nest_asyncio.apply() workaround.

I don't think I'm installing chromedriver correctly, advice appreciated!

@AlexVerrico
Copy link

Just thought I would post this here in case it helps anyone else, I had to run the command sudo apt install chromium-driver to get this to work (Debian 10, Python 3.7)
Cheers,
Alex.

@vikasnavgire
Copy link

Run
sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

It worked for me.

@thomasrice
Copy link

Run
sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

It worked for me.

Thanks, that worked for me too.

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

9 participants