Hi all.im having some issues.can someone list steps on how to download the libre translate on windows in vs code,thanks
Hey @Karthik have you followed the instructions from GitHub - LibreTranslate/LibreTranslate: Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup. ?
Yeah,but im have issues in downloading.i would like to get step by step explanation as this is my first project im attempting to do.thanks for your time.
What issues are you having? Can you post a screenshot or error log?
So i installed libre translate in python using’ pip install libre translate’.so now, how to download the specific language modules and all modules command and how to host it in local host command.
It would be helpful if u can share the commands.thank you.
PS C:\Users\Hp\LibreTranslate> libretranslate
libretranslate : The term ‘libretranslate’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
- libretranslate
-
+ CategoryInfo : ObjectNotFound: (libretranslate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Hp\LibreTranslate> python app.py
C:\Users\Hp\AppData\Local\Microsoft\WindowsApps\python.exe: can’t open file ‘C:\Users\Hp\LibreTranslate\app.py’: [Errno 2] No such file or directory
PS C:\Users\Hp\LibreTranslate> libretranslate
libretranslate : The term ‘libretranslate’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- libretranslate
-
+ CategoryInfo : ObjectNotFound: (libretranslate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
i cant install the language modules.what to do
error log:
PS C:\Users\Hp\LibreTranslate> libretranslate
libretranslate : The term ‘libretranslate’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
- libretranslate
-
+ CategoryInfo : ObjectNotFound: (libretranslate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Mm, strange. After issuing pip install -U libretranslate
there should be a path to libretranslate.exe:
PS C:\Users\pt> (get-command libretranslate).Path
C:\Users\pt\AppData\Local\Programs\Python\Python311\Scripts\libretranslate.exe
What version of Python are you using?
I am using vs code but having python extension.does it only work in puthon IDLE?
Hi, I´m still a noob, but managed to make an install script for Libretranslate via batch script and python, here I share it with you:
Open the notepad, paste the code that I will give you and save as
Install LibreTranslate.bat
make sure that at the moment of saving that you select all files as file type.
:: Start script
@echo off
:: Clear the screen
cls
:: Set window tittle
title LibreTranslate Automated Installation by Mr J.
echo /////////////////////////////////////////////////////////////////////////
echo welcome to Mr J. LibreTranslate un-official install script for windows.
echo *************************************************************************
echo please wait, relax and sit back while we setup LibreTranslate.
echo this should take aprox. 3 min depending on your pc specs.
:: active folder is automatically set to the folder it is executed from
:: Created an isolated environment before installation.
echo preparting installation:
echo -------------------------------------
echo step 1: Creating a python environment.
python -m venv Libretranslate_venv
echo Done!
:: Enable Python Enviroment you just created.
echo ----------------------------
echo step 2: activating env path.
call .\Libretranslate_venv\Scripts\activate.bat
echo Done!
:: Install from python repository
echo ----------------------------
echo step 3 Instaling LibreTranslate and its libraries, this is the longest step.
echo please be patient...
pip install libretranslate
echo Done!
:: Enable the GPU by default
echo ----------------------------
echo Post-Installation:
echo setting GPU to run as default.
set ARGOS_DEVICE_TYPE=cuda
echo Done!
:: Fixing Numpy new version bug, in the future it will be fixed.
:: if installation fails and you are using this script anytime after 2024, erase this command because most like your installation failed because this bug is probably fixed.
echo -------------------------------
echo Applying small workaround for Numpy version bug
pip uninstall -y numpy
pip install "numpy<2"
echo Done!
:: Notify user of succesful installation
echo -----------------------------------
echo LibreTranslate was succefully installed.
echo LibreTranslate fue instalado exitosamente.
echo //////////////////////////////////////////
:: Ask the user if user would like to start Libretranslate right away.
SET /P userInput="Do you want start LibreTranslate right now? (Y/N): "
echo -------------------------------------------------
:: Convert input to uppercase for easier comparison
SET userInput=%userInput:~0,1%
SET userInput=%userInput: =%
:: Check the user's response
if /I "%userInput%"=="Y" (
:: Executing Libre translate
echo Excellent choise! Thanks for using my script.
echo LibreTranslate is starting...
:: Enable Python Enviroment
call .\Libretranslate_venv\Scripts\activate.bat
:: Set the GPU as compute unit
set ARGOS_DEVICE_TYPE=cuda
:: Start LibreTranslate
start "LibreTranslate Console" ".\Libretranslate_venv\Scripts\libretranslate.exe"
) else if /I "%userInput%"=="N" (
:: Explaning user how to start the program in the future
echo ------------------------------------
echo You can start LibreTranslate anytime
echo by doble-clicking the script named Run LibreTranslate with GPU.bat.
echo all done! thank you for using my script,
echo God bless you, Bye!.
) else (
echo -----------------------------------------
echo Invalid input! Should have entered Y or N.
echo //////////////////////////////////////////
echo You can start LibreTranslate anytime
echo by doble-clicking the script named Run LibreTranslate with GPU.bat.
echo -------------------------------------------------------------------
echo All done! Thank you for using my script,
echo God bless you, Bye!.
)
:: allow the script to wait for the user to see the output
PAUSE
Once installed you can use the following script, same, paste in notepad and save as
Run Libretranslate.bat
@echo off
:: Set window tittle
title LibreTranslate Console
echo ///////////////////////////////
echo LibreTranslate is Initialazing
echo ------------------------------
:: Enable Python Enviroment
echo Enabling Python Enviroment
call .\Libretranslate_venv\Scripts\activate.bat
echo Done!
:: Enable the GPU, will fall back to CPU if GPU is not availalble
echo ---------------------------------------
echo setting the GPU as default Compute Unit
set ARGOS_DEVICE_TYPE=cuda
echo Done!
:: Execute LibreTranslate
echo ---------------------------
echo Executing LibreTranslate...
start "LibreTranslate Console" ".\Libretranslate_venv\Scripts\libretranslate.exe"
It should download automatically all the languages once it starts the first time, but be ready it is somewhere about 7 or 8 gb of models,
they´re stored in C:\Users\youruser.local\share\argos-translate\packages
I apologize for my very crude code, I´m still a beginner.
Let me know if you need further assistance!