kiyoopoon / multiserver-bumper

A multiserver auto bump bot
MIT License
6 stars 6 forks source link

error: externally-managed-environment #2

Open robotter112 opened 7 months ago

robotter112 commented 7 months ago

Hello, I cannot execute the command python3 -m pip install -U .

root@new:~/discord.py-self# python3 -m pip install -U . 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.

kiyoopoon commented 7 months ago

Hello! Thanks for reaching out!

The error you are getting is most probably because Linux is stopping the command from installing packages globally. It is for safety reasons. I will recommend you to use a virtual environment or a docker container

Virtual environments are easy to setup so I will recommend you to go with that one if you don't know docker properly.

Note: If you get that same error when installing venv then install venv using apt sudo apt install python3-venv This will install the venv package globally.

Make sure you have the virtualenv package installed. If you don't have it installed then run pip install virtualenv it will install the package for you

The you can make an env using this command python<version> -m venv <virtual-environment-name> for example if you have python version 3.12 and you want to name the virtual env autobump then your command will be something like python3.12 -m venv autobump. To activate the env you will need to run this command source env/bin/activate for Unix based system. Which I think you are using or env/Scripts/activate.bat in CMD if you are using Windows.

Then you can run the normal pip install -r requirements.txt command to install the packages in your virtual env.

Hope this helps! LMK if you face any other problem.