How can I install Python modules?
I have been trying to work on some projects and yet I can't because it would be displaying on the console that that module can't be found
Ever Gospel Ndep You can't compare sololearn's compiler to an the ones on your machine because sololearn's compiler is basically for learning purposes only and I don't think it can install external modules
Snehil , using the provided installation procedure should not be part of a regular program (outside of sololearn), since it will run and try to install with each execution of the code file. in sololearn playground it has to be as described. > we may run it in a *try: ... except:..* block, so that it only runs if module can not be imported. > an other point is that the installation runs silently, so no feedback about installation state, messages or warnings are shown.
__import__('os').system('pip install -qq package1 package2') use this statement at the first line of your program
in the terminal pip install module_name
Lothar I appreciate you for pointing that my answer is incomplete. But providing a complete answer would have been more helpful to the user. I think you left that part on me so I'll share the way what actually to do on sololearn's Linux container and on real machine. In the Sololearn environment, as I mentioned, the IDE runs in a Linux Container, and any installed modules are specific to that container and do not persist beyond the program execution. To work with external packages in Sololearn, you can include the necessary installation commands within your Python code using the os module. On a real machine, you can directly execute the pip install command in the terminal or command prompt without the need for any additional steps. -qq used in the command is quite mode flag it hides all the stats of installation. ========= I can't type more details as there's character limit. do research every point and ask further doubts
Hazem Hadj Ahmed where can I get the terminal in sololearn?
Lothar I don't understand
If you have a windows computer, then go to command prompt, and type: pip install library-name Hope this helps.
Danish Zubair there are modules installed on my machine but can't use them here on sololearn
Ever Gospel Ndep Yeah, because Sololearn's compiler is not a professional compiler, such as Pycharm or VS code, try on these compilers, and it should work. Note that online compiler doesn't support any external libraries, they only support the library which are built in in the compiler.