Python bug

When trying to install it in my Pika OS:
brito@AuroraBorealisWorkstation:~$ curl https://get.modular.com | MODULAR_AUTH=[redacted] sh - | distro=pika version=23.04 codename=lunar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3176 100 3176 0 0 9158 0 --:--:-- --:--:-- --:--:-- 9152
brito@AuroraBorealisWorkstation:~$ modular install mojo
# Found release for https://packages.modular.com/mojo @ 0.2.1, installing to /home/brito/.modular/pkg/packages.modular.com_mojo
# Downloads complete, setting configs...
# Configs complete, running post-install hooks...
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
modular: error: failed to run python:
brito@AuroraBorealisWorkstation:~$
brito@AuroraBorealisWorkstation:~$ curl https://get.modular.com | MODULAR_AUTH=[redacted] sh - | distro=pika version=23.04 codename=lunar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3176 100 3176 0 0 9158 0 --:--:-- --:--:-- --:--:-- 9152
brito@AuroraBorealisWorkstation:~$ modular install mojo
# Found release for https://packages.modular.com/mojo @ 0.2.1, installing to /home/brito/.modular/pkg/packages.modular.com_mojo
# Downloads complete, setting configs...
# Configs complete, running post-install hooks...
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
modular: error: failed to run python:
brito@AuroraBorealisWorkstation:~$
22 Replies
Stole
Stole14mo ago
@🪶 𝕴𝖔𝖘𝖊𝖕𝖍 Best not to post your Modular auth token. That's the one that starts with mut_. I'd redact it out if I were you.
Dawn's Knight
Dawn's KnightOP14mo ago
Did I do it?
ModularBot
ModularBot14mo ago
Congrats @🪶 𝕴𝖔𝖘𝖊𝖕𝖍, you just advanced to level 1!
Stole
Stole14mo ago
Yep
Dawn's Knight
Dawn's KnightOP14mo ago
Thanks
Stole
Stole14mo ago
It looks like Pika OS doesn't use apt even though it does have an Ubuntu base. Modular officially only supports a couple Ubuntu versions at the moment Maybe you could try modifying the installer script to use pikman if it's similar enough to apt? Though that's likely a botched solution, just a thought I'm not acquainted with Pika OS
❤🔥
❤🔥14mo ago
As far as I understand, mojo uses the system python. In the latest version of python on Linux, you cannot install packages using pip without using env, but this is very easily fixed. Just delete 1 file
rm /usr/lib/python3.11/EXTERNALLY-MANAGED
rm /usr/lib/python3.11/EXTERNALLY-MANAGED
And try to run the mojo installation again.
Dawn's Knight
Dawn's KnightOP14mo ago
Thanks for the fix! New one though:
❤🔥
❤🔥14mo ago
Try entering
modular clean
modular clean
And install mojo again
modular install mojo
modular install mojo
Dawn's Knight
Dawn's KnightOP14mo ago
Same bug
❤🔥
❤🔥14mo ago
try execute
modular install mojo
modular install mojo
from root user
Dawn's Knight
Dawn's KnightOP14mo ago
Everything went well 😄 Now I have a question Will I only be able to use that installation in root, then? Or is it system-wide?
❤🔥
❤🔥14mo ago
Did you write the commands that the installer issued after installation?
Dawn's Knight
Dawn's KnightOP14mo ago
Not yet, but it seems they tell me to use root paths 🔥 Mojo installed! 🔥 Now run the following commands if you are using bash: echo 'export MODULAR_HOME="/root/.modular"' >> ~/.bashrc echo 'export PATH="/root/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc source ~/.bashrc If you are using ZSH, run the following commands: echo 'export MODULAR_HOME="/root/.modular"' >> ~/.zshrc echo 'export PATH="/root/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.zshrc source ~/.zshrc Then enter 'mojo' to start the Mojo REPL. For tool help, enter 'mojo --help'. For more docs, see https://docs.modular.com/mojo.
❤🔥
❤🔥14mo ago
One idea, try copying .modular to your user's folder and replacing /root/ with /home/YOUR USER/
sudo cp -r /root/.modular /home/YOUR USER
echo 'export MODULAR_HOME="/home/YOUR USER/.modular"' >> ~/.bashrc
echo 'export PATH="/home/YOUR USER/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
sudo cp -r /root/.modular /home/YOUR USER
echo 'export MODULAR_HOME="/home/YOUR USER/.modular"' >> ~/.bashrc
echo 'export PATH="/home/YOUR USER/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Dawn's Knight
Dawn's KnightOP14mo ago
@❤🔥 I was able to get it working, thanks! 😄 I think the third line should start with a /home/ to set the "PATH"
❤🔥
❤🔥14mo ago
Yeah, I forgot to add that.
Mahmoud Abduljawad
I wouldn't suggest this publicly without adding a reference to what that is and what it means. For those reading: https://peps.python.org/pep-0668/ Since many OS depend on Python for system tasks, installing certain packages on default environment could result in conflicts that break the OS itself. For that, this feature was introduced to prevent PIP from modifying default environment. Few others have already made it by using venv and modifying mojo config to point to venv, which is safer on the OS.
❤🔥
❤🔥14mo ago
Hmm, I didn’t know that python packages could somehow affect the operation of the system, I always installed the packages and there were no problems with the system. I don't think it's that critical.
Mahmoud Abduljawad
While this doesn't happen so much in the wild, it still does to a certain percentage the prompted the PSF to consider a PEP for it.
❤🔥
❤🔥14mo ago
Well then you need to make an issue on Github so that they make an update for installing mojo, so that they do the installation using venv
Mahmoud Abduljawad
Agree.
Want results from more Discord servers?
Add your server