R
Railway2y ago
Billy

Chrome / Chrome Driver paths

Has anyone figured a good way to get the chrome path / install chrome driver if necessary? Using python.
36 Replies
Percy
Percy2y ago
Project ID: N/A
Percy
Percy2y ago
⚠️ experimental feature
Billy
BillyOP2y ago
N/A Maybe this would work, how to run "apt install chromium-chromedriver" on build?
root
root2y ago
add a NIXPACKS_APT_PKGS=chromium-chromedriver environment variable.
Billy
BillyOP2y ago
"Command '/bin/chromium-browser' requires the chromium snap to be installed."
root
root2y ago
:augh: ubuntu uhm #🎤|chit-chat - add NIXPACKS_DEBIAN=1 to your environment variables.
milo
milo2y ago
@HairyBarry let us know how it goes
Billy
BillyOP2y ago
executor failed running [/bin/bash -ol pipefail -c apt-get update && apt-get install -y --no-install-recommends chromium-chromedriver]: exit code: 1 Error: Docker build failed
milo
milo2y ago
more logs pls
Billy
BillyOP2y ago
What about how to install nix packages "chromedriver" and "google-chrome"? #9 [stage-0 5/9] RUN apt-get update && apt-get install -y --no-install-recommends chromium-chromedriver #9 sha256:94a3705aa14f16b7b7a54fec590814404cdec4dbfbc3f6287f831ef06ab67941 #9 0.456 apt-get: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.33' not found (required by /nix/store/c8zdsf7csk8msjb914bhccdhq0ycmqys-gcc-11.3.0-lib/lib/libstdc++.so.6) #9 0.456 apt-get: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.32' not found (required by /nix/store/c8zdsf7csk8msjb914bhccdhq0ycmqys-gcc-11.3.0-lib/lib/libstdc++.so.6) #9 0.456 apt-get: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.34' not found (required by /nix/store/c8zdsf7csk8msjb914bhccdhq0ycmqys-gcc-11.3.0-lib/lib/libstdc++.so.6) #9 0.456 apt-get: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.34' not found (required by /nix/store/c8zdsf7csk8msjb914bhccdhq0ycmqys-gcc-11.3.0-lib/lib/libgcc_s.so.1) #9 ERROR: executor failed running [/bin/bash -ol pipefail -c apt-get update && apt-get install -y --no-install-recommends chromium-chromedriver]: exit code: 1 #8 42.01 17 store paths deleted, 156.17 MiB freed
milo
milo2y ago
shared objects @aleks u wanna have some fun with this or na
root
root2y ago
oh wait I'm stupid you can use nix I think Instead of NIXPACKS_APT_PKGS and NIXPACKS_DEBIAN, just put in NIXPACKS_PKGS=chromedriver
Billy
BillyOP2y ago
Seems that worked to install the chromedriver. For my app, i need to reference the chrome path. Any idea how to find that?
root
root2y ago
Try calling out to the shell with which google-chrome If you need the filesystem root, run nix-store -q $(which google-chrome)
Billy
BillyOP2y ago
How to do this? Like how do I call out to the shell?
root
root2y ago
I'm not sure. I think it's os.system or something
Billy
BillyOP2y ago
Ok i found the path to chrome but this is the error i get thrown when using it: [0224/183825.677310:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory [0224/183825.677730:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory [0224/183825.680655:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable. [0224/183825.708983:WARNING:sandbox_linux.cc(380)] InitializeSandbox() called with multiple threads in process gpu-process. [0224/183825.798524:ERROR:process_memory_range.cc(75)] read out of range [0224/183825.801605:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) [0224/183825.801647:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2) [0224/183826.115015:ERROR:headless_shell.cc(397)] Abnormal renderer termination. "This buildpack installs shims that always add --headless, --disable-gpu, --no-sandbox, and --remote-debugging-port=9222 to any google-chrome command as you'll have trouble running Chrome on a Heroku dyno otherwise." This is from the heroku-buildpack-google-chrome docs. Maybe could solve the last error. Any ideas how to do this on railway? "Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory" any ideas on this error?
Brody
Brody2y ago
i see youve been having problems with this for a few days now, im willing to take a crack at this if you can provide a minimal reproducible example for me to work with, though i make no promises
Billy
BillyOP2y ago
import pandas as pd import dataframe_image as dfi data = [['tom', 43], ['nick', 55], ['juli', 28]]
df = pd.DataFrame(data, columns=['Name', 'Age']) dfi.export(df, "df.png", chrome_path="/root/.nix-profile/bin/chromium") NIXPACKS_PKGS=ungoogled-chromium (or google-chrome in which case chrome_path="/root/.nix-profile/bin/google-chrome-stable")
Brody
Brody2y ago
hmm okay, not much to go off of, but ill try
Billy
BillyOP2y ago
GitHub
GitHub - dexplo/dataframe_image: A python package for embedding pan...
A python package for embedding pandas DataFrames as images into pdf and markdown documents - GitHub - dexplo/dataframe_image: A python package for embedding pandas DataFrames as images into pdf and...
Billy
BillyOP2y ago
This is the package of the "export" function that fails
Billy
BillyOP2y ago
GitHub
SyntaxError: not a PNG file · Issue #68 · dexplo/dataframe_image
Hi, I've been using the dataframe-image package for some time and as of this week it stopped working for me. The relevant code is simply: dfi.export(cal_sorted,"Earnings Calendar &...
Billy
BillyOP2y ago
And discussion related to chrome Procfile web: python bot/main.py
Brody
Brody2y ago
cool ill try to get this running on railway, no promises so dont get your hopes up
Billy
BillyOP2y ago
heck ya, thanks for the help
Brody
Brody2y ago
bro you should just use matplotlib Using Chrome to do things is usually always a bad idea anyway So yeah I can't get it to work with chrome, sorry
Billy
BillyOP2y ago
ya only thing is with matplotlib i lose formatting in my app i export a "styler" (formatted dataframe) but lose the formatting if i export the styler with matplotlib
Brody
Brody2y ago
there has to be a better way than using chrome
Billy
BillyOP2y ago
i think i got it to work by reading the heroku-buildpack-google-chrome docs had to install helper apt packages
Brody
Brody2y ago
do share how you did it
Billy
BillyOP2y ago
it still throws this error and a few warnings but exports the image correctly
Brody
Brody2y ago
well im sorry i couldn't have been more help, but if it works it works i guess 🤷‍♂️
Billy
BillyOP2y ago
NIXPACKS_APT_PKGS=fonts-liberation,libappindicator3-1,libasound2,libatk-bridge2.0-0,libatk1.0-0,libgbm1,libgtk-3-0,libnspr4,libnss3,libx11-xcb1,libxcomposite1,libxcursor1,libxdamage1,libxfixes3,libxi6,libxrandr2,libxss1,libxtst6,xdg-utils,gconf-service,libgconf-2-4 if anyones reading this try this^ lol
Billy
BillyOP2y ago
GitHub
GitHub - ryannono/Puppeteer-Railway-Buildpack: Installs dependencie...
Installs dependencies needed in order to run puppeteer on Railway. - GitHub - ryannono/Puppeteer-Railway-Buildpack: Installs dependencies needed in order to run puppeteer on Railway.
Billy
BillyOP2y ago
thanks anyway, its been a headache
Want results from more Discord servers?
Add your server