ERROR PYTHON

¿Algo falla o no sabes como funciona? Pide ayuda aquí!
Responder
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Buenas, soy Pol, no tengo ni idea del mundo de rasoberry, a ver si alguien podría ayudarme un poco... estoy intentando instalar pibooth en la raspberry pi 3B+, es un proyecto para montar un fotomatón, pero me sale este error y tengo que crear un entorno virtual.



pip install buildhat
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.

For more information visit http://rptl.io/venv

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.



Muchas gracias de antemano! :suerte
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

Creo que te está diciendo que ese paquete se instala desde repositorios.
¿Has probado a instalarlo con apt, como te indica?
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

si he probado esto y nada... lo que no sé es como crear un entorno virtual, que creo que es la solución
Gracias
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

Ok, el entorno virtual es lo más habitual en la actualidad, para no mezclar ni versiones ni dependencias.
Simplemente crea un entorno (venv) en un directorio:

Código: Seleccionar todo

python -m venv nombre_dir
Y luego lo inicializas

Código: Seleccionar todo

source nombre_dir/bin/activate
P.D. El módulo venv lo podrás instalar con apt:

Código: Seleccionar todo

sudo apt install python3-venv
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Cuando te refieres a un directorio que quieres decir? Le pongo un nombre cualquiera? Tengo que crear alguna carpeta en mi raspberry?
Cuando tengo que usar esto?

Then use path/to/venv/bin/python and path/to/venv/bin/pip.

Me pone que python3 ya esta en su versión más reciente (3.11.2-1+1)

Gracias
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

polsallar escribió: 07 Dic 2024, 10:25 Cuando te refieres a un directorio que quieres decir? Le pongo un nombre cualquiera? Tengo que crear alguna carpeta en mi raspberry?
Si, cualquier nombre, generalmente es el nombre del proytecto o similar.
No tienes que crear el directorio, se crea con ese comando.
polsallar escribió: 07 Dic 2024, 10:25 Me pone que python3 ya esta en su versión más reciente (3.11.2-1+1)
En realidad te tendría que decir que "python3-venv" está instalado (o no)
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

He adjuntado lo que me sale... :destroyer

No se ahora el paso que dar
Adjuntos
me sale esto
me sale esto
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Ahora esto...
Adjuntos
---
---
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

polsallar escribió: 07 Dic 2024, 10:56 Ahora esto...
Ahí veo un texto rojo arriba, pero no sé qué comando has metido para obtener ese mensaje de error.
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Le he metido el python -m pip install pibooth

También el pip install pibooth
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

He probado estos pasos en mi raspi y ha funcionado correctamente:

Código: Seleccionar todo

python -m venv ejemplo
source ejemplo/bin/activate
pip install pibooth
1. Creo el entorno
2. Activo el entorno
3. instalo el módulo
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Voy a probar de formatear la tarjeta otra vez... pq algo estará mal entonces.

Hay alguna manera mas de hacer un reset a la raspberry? que modelo tienes?
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

Esto lo he probado en una Raspberry pi 4, pero debe ser idéntico en otras versiones.
Lo importante es tener la última versión del sistema operativo y tenerlo actualizado
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Muchas gracias, ayer probé de formatear la sd y tmpoco me funciona...
me sigue saliendo el error:

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.

For more information visit http://rptl.io/venv
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

polsallar escribió: 08 Dic 2024, 09:28
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.

For more information visit http://rptl.io/venv
Como te decía ayer, dame la información completa, no sólo la respuesta de error.
¿Qué comando o grupo de comandos te devuelve esta respuesta?
polsallar
Pi Alpha
Pi Alpha
Mensajes: 10
Registrado: 07 Dic 2024, 08:23
Agradecido: 0
Agradecimiento recibido: 0

Esto me aparece...
Adjuntos
..
..
Avatar de Usuario
egrueda
Pi God
Pi God
Mensajes: 3426
Registrado: 10 Feb 2017, 19:31
Agradecido: 7 veces
Agradecimiento recibido: 269 veces

Antes me decías que te daba un error: "error: externally-managed-environment"
Y ahora me mandas una captura de pantalla en la que no sale ese error.
No tengo ni idea de qué estás haciendo.

En una respuesta anterior te di tres comandos:
- crear entorno
- activar entorno
- instalar módulo

Y te dí el comando para cada uno, lo voy a adaptar a tu ejemplo ("lumen")

Código: Seleccionar todo

python -m venv lumen
source lumen/bin/activate
pip install pibooth
Tú has metido el comando primero y el segundo.
Pero en lugar de meter el tercero, tú metes el comando "apt install python3-venv"
Es obvio que ese módulo (venv) ya está instalado, porque si no no te habría dejado usarlo con el primer comando (python -m venv lumen)
Y además te dice que no puedes usar apt porque no eres root, deberías usar sudo. Pero da igual, ahí no necesitas usar ese comando.

Si tu finalidad es instalar pibooth, te dejo de nuevo los comandos:

Código: Seleccionar todo

python -m venv lumen
source lumen/bin/activate
pip install pibooth
Responder