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

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.

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

Best,

Jaycee

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!

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 :expressionless_face: