Felipe's Blog

Your go-to source for Linux/Unix-like – tech – engineering.

Archive for the ‘Debian’ Category

The – externally-managed-environment – in Python

without comments

To avoid this message which is to force you somehow to create a virtual environment in python:

$ pip install .
error: externally-managed-environment

× This environment is externally managed
??> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.

    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.

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

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.

Just remove this in Linux:

sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED

If you are using Homebrew just go to:

cd /home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12

and remove the file EXTERNALLY-MANAGED as well.

If on the other side, prefer to create a virtual environment, this is the way, install this package:

python3-venv

In the environment you prefer to work with, use this command:

python3 -m venv .venv

You can check all the installed packaged here:

user@server# ls .venv/
bin  include  lib  lib64  pyvenv.cfg

Then you have to activate the environment:

source .venv/bin/activate

Then it’s possible to use pip to install packages in that environment:

pip install -r requirements.txt
pip install openai

That’s it.

To deactivate the environment:

deactivate

Written by Felipe

March 6th, 2024 at 9:10 pm

Installing Apache2 on Arch Linux

without comments

Free and open source Apache is one of the most popular servers in the world.
It is based on a focused architecture and supports all major operating systems, Linux, Windows, macOS and Solaris.
Apache is customizable and can be integrated with other, It offers many features, including load balancing , URL tracking, automatic indexing , robust support, and more.

I’ll make it simple:

Let’s do the update:

sudo pacman -Syu

On Debian is very simple:

sudo apt-get install apache2

On Arch Linux:

pacman -S apache

Then we can create the symbolic link, to boot apache on the start.
and we use these commands:

systemctl start httpd
systemctl enable httpd

We can check the status:

systemctl status httpd

Apache. You can create it in the Apache default root directory using the following command:

nano /srv/http/index.html

Let’s just add some html code in a file:

<html>
 <title>APACHE2 - ARCH LINUX</title>
  <body>
   <h2>APACHE2 - ARCH LINUX</h2>
  </body>
</html>

Written by Felipe

April 25th, 2023 at 10:33 pm

Posted in Arch,Debian,Linux

Tagged with , ,