-
Notifications
You must be signed in to change notification settings - Fork 81
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
auto install modules #64
base: main
Are you sure you want to change the base?
Conversation
Simple script to automatically install the requirements.
I could argue that this isn't needed since it's just one command, but to someone less technically inclined, making it easier could be the difference between using the bot and not, so this is actually a good idea in that regard. One addition I'd like to suggest though, we could also check to make sure the other dependencies are installed as well (poppler, ffmpeg and LaTeX) and maybe offer the user to to install them. I can probably implement that if you want. For poppler: import io
import pdf2image
import requests
import sys
import zipfile
try:
pdf2image.convert_from_path('')
except pdf2image.exceptions.PDFInfoNotInstalledError:
if input('Poppler is not installed, would you like to install it now? [y/N] ')[0] in ('Y', 'y'):
if sys.platform == 'linux':
print('Install the `poppler-utils` package and rerun this script')
sys.exit()
elif sys.platform == 'win32':
zipfile.ZipFile(io.BytesIO(requests.get('https://github.com/oschwartz10612/poppler-windows/releases/download/v21.11.0-0/Release-21.11.0-0.zip').content)).extractall(path='C:/Program Files')
# Need to figure out how to add 'C:/Program Files/poppler-21.11.0/Library/bin' to PATH in windows
elif sys.platform == 'darwin':
os.system('brew install poppler')
try:
pdf2image.convert_from_path('')
except pdf2image.exceptions.PDFInfoNotInstalledError:
print('Installing poppler failed, refer to https://pdf2image.readthedocs.io/en/latest/installation.html#windows to install it manually')
sys.exit()
except:
print('Poppler installed successfully')
else:
print('Aborting')
sys.exit()
except:
pass Not complete (I couldn't find out how to add to windows PATH, but it's a start) edit: added mac support |
Come to think of it, we don't need ffmpeg anymore since they removed the captcha, so we can remove it as a dependency. I've added a commit to my pr to address this. |
I edited this and made a rough draft of adding it to path. I also replaced print statements with input since some might run the file directly and not from cmd
this creates a backup of the path cause you never know, then temporarily adds poppler to path. this is as close you can really get without admin privileges. |
@Dogey11 nice
The |
For LaTeX, I have no clue about windows, but on linux you need to install the You can check if it's installed by running |
mb. ive done this before but it's been a while |
i think you get it from here on windows |
@Dogey11
You can probably use that, but the size is 1.1 GB. And that's just the zip file. |
Simple script to automatically install the requirements.txt