Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

469
Vistas
pipenv and pyinstaller not packaging dependencies

I'm fairly new to python I'm trying to create an executable of my python project that is run in pipenv. However, when I try and compile and run the code using pyinstaller it can't find any dependencies since they aren't installed globally. I don't want to install them globally, this is supposed to be a deployable build that shouldn't require any setup beyond just the exe.

Am I missing something? Is this even the right way to go?

I can run the project easily like so:

pipenv run python iot.py

It has a dependency:

from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient

And I try and compile the project like so:

pipenv run pyinstaller --onefile iot.py

It creates an executable that fails to find imported modules.

Traceback (most recent call last):
  File "iot.py", line 18, in <module>
ImportError: No module named AWSIoTPythonSDK.MQTTLib
[48823] Failed to execute script iot

Am I just so off in my attempt or is there just a simple missing link?

Thanks for any help.

10 months ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

This is because you installed pyinstaller globally.

Use pipenv install -d pyinstaller before packing.

10 months ago · Santiago Trujillo Denunciar

0

I found that pyinstaller won't package dependencies inside the pipenv.

If I install the dependencies globally I can ship the exe.

For now, I'll make a build machine that handles downloading dependencies and building the exe.

10 months ago · Santiago Trujillo Denunciar

0

You can tell pyinstaller to look in the virtual env created by pipenv when searching for the required modules.

$ pipenv --venv
path\to\.virtualenvs\project

$ pipenv run pyinstaller --paths path\to\.virtualenvs\project project.py
10 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.