M
Modularβ€’14mo ago
Elaid Tebabkha

Can't find libpython

See the photo.πŸ™πŸ™πŸ™
No description
25 Replies
Jack Clayton
Jack Claytonβ€’14mo ago
@Elaid Tebabkha try these steps: First find your python:
which python
which python
Then cd one level above and into lib, so if python is located at usr/bin/python then do:
cd /usr/lib
cd /usr/lib
Then find the name of your libpython:
ls libpython*
ls libpython*
Then put the full path into that env var e.g:
export MOJO_PYTHON_LIBRARY="/usr/lib/libpython3.11.so"
export MOJO_PYTHON_LIBRARY="/usr/lib/libpython3.11.so"
Then try running it again, if it works put it into your shell startup script e.g. bash:
echo "export MOJO_PYTHON_LIBRARY=/usr/lib/libpython3.11.so" >> ~/.bashrc
echo "export MOJO_PYTHON_LIBRARY=/usr/lib/libpython3.11.so" >> ~/.bashrc
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
Please explain me more with photos. My os Ubuntu 20.04.6 LTS . Please πŸ™πŸ™πŸ™
Jack Clayton
Jack Claytonβ€’14mo ago
Which step from above are you getting stuck on?
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
From step 1 to 3. When I did these steps, in the phase to run a program mojo an error occurred. Of course I deleted this from .bashrc to solve everything. Then when I install Pyside6 by pip, in the phase when I try to execute program mojo with for example lib matplotlib an error occurred like : Qt plug-in not found, try to re-install it, Simbolyzer.. To solve this I have to uninstall pyside6
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
Not working.
No description
Jack Clayton
Jack Claytonβ€’14mo ago
@Elaid Tebabkha what is the output of step 1:
which python
which python
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
ModularBot
ModularBotβ€’14mo ago
Congrats @Elaid Tebabkha, you just advanced to level 2!
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
No thing
Jack Clayton
Jack Claytonβ€’14mo ago
What about: which python3
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
No description
Jack Clayton
Jack Claytonβ€’14mo ago
It looks like this is no longer a problem for you, I just saw this thread: https://discord.com/channels/1087530497313357884/1157689606062493696/1157689606062493696 So your libpython must be linked correctly
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
How to link it
Jack Clayton
Jack Claytonβ€’14mo ago
Do:
cd /usr/lib
ls libpython*
cd /usr/lib
ls libpython*
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
No description
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
Is MOJO have a methods in Mojo to receive the inputs from users?
Jack Clayton
Jack Claytonβ€’14mo ago
Yeah you have no libpython on that system, here's what I recommend: install miniconda: https://docs.conda.io/projects/miniconda/en/latest/ create a virtual environment:
conda create -yn py311 python=3.11
conda create -yn py311 python=3.11
Link to the libpython that is now installed:
export MOJO_PYTHON_LIBRARY="$(ls $(conda info --base)/envs/py311/lib/libpython*)"

echo "export MOJO_PYTHON_LIBRARY=$MOJO_PYTHON_LIBRARY" >> ~/.bashrc
export MOJO_PYTHON_LIBRARY="$(ls $(conda info --base)/envs/py311/lib/libpython*)"

echo "export MOJO_PYTHON_LIBRARY=$MOJO_PYTHON_LIBRARY" >> ~/.bashrc
ksandvik
ksandvikβ€’14mo ago
See beginning part of https://www.youtube.com/watch?v=5Sm9IVMet9c&t=2862s that shows how to use Python input in mojo code.
freeCodeCamp.org
YouTube
Mojo Programming Language – Full Course for Beginners
Learn Mojo in this full tutorial. The Mojo programming language combines the usability of Python with the performance of C. It's basically an enhanced version of Python specifically designed for Artificial Intelligence developers. πŸ’» Code: https://github.com/Infatoshi/intro-to-mojo ✏️ Course created by @elliotarledge Elliot's discord: https://...
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
It exists input in python, I want in MOJO. Please can you explain me more step by step πŸ™πŸ™πŸ™
ksandvik
ksandvikβ€’14mo ago
None in Mojo yet, but the Python interop one works.
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
lippython3.11.so exists in x86_64-linux-gnu. Now, All things work.πŸ™ Thanks
Weichen-16ε°ζ™‚ηš„θ‡ͺη”±δΊΊ
I encountered the same problem. I followed you instructions, then the problem got solved. The only different part is that my libpython is under /usr/lib/x86_64-linux-gnu/ instead of /usr/lib I'm using WSL2. I guess that's why my libpython is under different location. Thank you, Jack.
Weichen-16ε°ζ™‚ηš„θ‡ͺη”±δΊΊ
https://github.com/modularml/mojo/issues/551 This post also helps me a lot.
GitHub
error: Unable to locate a suitable libpython when running Mojo ex...
Bug description Compiled Mojo programs that import Python code fail with the message Unable to locate a suitable libpython, please set MOJO_PYTHON_LIBRARY. This is because Mojo currently does not e...
Elaid Tebabkha
Elaid TebabkhaOPβ€’14mo ago
Me too
Jack Clayton
Jack Claytonβ€’14mo ago
Awesome thanks for reporting back
Want results from more Discord servers?
Add your server