APIs & Integrations

eibach-cv
Contributor

No module named 'hubspot.crm'; 'hubspot' is not a package

SOLVE

Hi,

I am using Python to run API requests, recently my script stopped working and started giving me an error:

 

Traceback (most recent call last):
File "C:\Users\...\Documents\hubspot\abandoned-carts.py", line 7, in <module>
import hubspot
File "C:\Users\...\Documents\hubspot\hubspot.py", line 9, in <module>
from hubspot.crm.contacts import PublicObjectSearchRequest, SimplePublicObjectInput, ApiException
ModuleNotFoundError: No module named 'hubspot.crm'; 'hubspot' is not a package

 

I just completely unisntalled and reinstalled Python and the hubspot module using 

pip install hubspot-api-client

 

If I run `pip list` it shows I have hubspot 0.1.14.dev0 and
hubspot-api-client 7.5.0.

 

Not sure what else to try.

0 Upvotes
1 Accepted solution
tominal
Solution
Guide | Partner
Guide | Partner

No module named 'hubspot.crm'; 'hubspot' is not a package

SOLVE

Hey @eibach-cv,

 

I have my own bias against the automatically-generated HubSpot API SDKs to write your own requests instead. It will save you a massive learning curve and further stress in the future.

 

For Python, you could do requests like this:

 

import requests
response = requests.get("http://api.hubapi.com/crm/v3/objects/contacts?hapikey=<private app key here>")
print(response)
>>>> Response<200>

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com

View solution in original post

3 Replies 3
Sna458
Member

No module named 'hubspot.crm'; 'hubspot' is not a package

SOLVE

I was running into this same problem and it was because my python file was named hubspot.py so it was trying to import that 😑

0 Upvotes
tominal
Solution
Guide | Partner
Guide | Partner

No module named 'hubspot.crm'; 'hubspot' is not a package

SOLVE

Hey @eibach-cv,

 

I have my own bias against the automatically-generated HubSpot API SDKs to write your own requests instead. It will save you a massive learning curve and further stress in the future.

 

For Python, you could do requests like this:

 

import requests
response = requests.get("http://api.hubapi.com/crm/v3/objects/contacts?hapikey=<private app key here>")
print(response)
>>>> Response<200>

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com
Jaycee_Lewis
Community Manager
Community Manager

No module named 'hubspot.crm'; 'hubspot' is not a package

SOLVE

Hi, @eibach-cv 👋 Thanks for your question. Hey, @taran42 @tominal, have you run into this issue? 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes