APIs & Integrations

GBeckwith
Contributor

hubspot-api-client Distribution

SOLVE

Hello,

 

I am new to hubspot and this is my first posting.  I am having an issue when compiling my program using PyInstaller.  I am unable to run the .exe created by PyInstaller; I get the following error:

 

 

 

C:\Projects>HubSpot_GET_Companies.exe
Traceback (most recent call last):
  File "HubSpot_GET_Companies.py", line 7, in <module>
  File "hubspot\discovery\crm\companies\discovery.py", line 24, in get_all
  File "hubspot\discovery\crm\companies\discovery.py", line 9, in basic_api
  File "hubspot\discovery\discovery_base.py", line 20, in _configure_api_client
  File "pkg_resources\__init__.py", line 899, in require
  File "pkg_resources\__init__.py", line 785, in resolve
pkg_resources.DistributionNotFound: The 'hubspot-api-client' distribution was not found and is required by the application
[10632] Failed to execute script HubSpot_GET_Companies

 

 

 

I have attempted to use the --hidden-import parameter of PyInstaller with several different variations of what I think is the correct module name (tried "hubspot", "HubSpot", "hubspot-api-client", but when PyInstaller compiles, it does not include any library data for hubspot modules.  Therefore my application will not run on my local or remote machine.

 

 

C:\python\Scripts>PyInstaller --onefile "C:\Users\xxxxx\PycharmProjects\xxxxx\HubSpot_GET_Companies.py"  --hidden-import="hubspot-api-client" --paths "C:\python38\Lib\site-packages

 

 

In the header of my script, I have imported hubspot:

 

 

from hubspot import HubSpot
import pandas as pd
import os

 

 

 

Any idea what am I doing wrong?  I feel like it is something simple, but I have been struggling with this all day, and I can't seem to find anything online about how to solve this.

 

Any help would be MUCH apprecaited.  TIA   beckwiga

0 Upvotes
1 Accepted solution
GBeckwith
Solution
Contributor

hubspot-api-client Distribution

SOLVE

Hi Taran, thanks for the reply.  Yeah ... could be the module, I tried installing and uninstalling via pip.  Same result.  I was unable to figure this out, but decided just to use the compiled .pyc files (which run as expected from the __pycached__ folder) instead of spending any more time on trying to compile .exes.

View solution in original post

3 Replies 3
taran42
Contributor

hubspot-api-client Distribution

SOLVE

@dennisedson I am not familiar with PyInstaller, so I am only able to speculate as to what could be wrong here.

 

@GBeckwith I would say to make sure you're including the correct HubSpot module; I think there are a few of them floating around. It may also depend on if you're using v2 or v3.

GBeckwith
Solution
Contributor

hubspot-api-client Distribution

SOLVE

Hi Taran, thanks for the reply.  Yeah ... could be the module, I tried installing and uninstalling via pip.  Same result.  I was unable to figure this out, but decided just to use the compiled .pyc files (which run as expected from the __pycached__ folder) instead of spending any more time on trying to compile .exes.

dennisedson
HubSpot Product Team
HubSpot Product Team

hubspot-api-client Distribution

SOLVE

@GBeckwith 

When it comes to python, I always enlist the kind service of @taran42 .  Mainly because I like the avatar 😉

@taran42 , could you lend a hand 🙏

0 Upvotes