# Python 'hubspot' is not a package

**URL:** <https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [August 26, 2022, 2:59pm UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832 "2022-08-26T14:59:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HHawley](https://avatars.discourse-cdn.com/v4/letter/h/e9bcb4/32.png) [@HHawley](https://community.hubspot.com/u/HHawley)\
**Post date:** [August 26, 2022, 2:59pm UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832/1 "2022-08-26T14:59:19Z")

</div>

Hi all, I have been banging my head against the wall for a while on this one. I had several Python scripts utilizing the HubSpot API that were working fine for me, but upon re-visiting them and writing a new one, I keep running into this error:

_ModuleNotFoundError: No module named ‘hubspot.crm’; ‘hubspot’ is not a package_

**Here is my code (super basic script to try and get this working):**

import hubspot

from pprint import pprint

from hubspot.crm.contacts import ApiException

client = hubspot.Client.create(access\_token=“YOUR\_ACCESS\_TOKEN”)

try:

api\_response = client.crm.contacts.basic\_api.get\_page(limit=10, archived=False)

pprint(api\_response)

except ApiException as e:

print(“Exception when calling basic\_api-\>get\_page: %s\n” % e)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 29, 2022, 4:26pm UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832/2 "2022-08-29T16:26:57Z")

</div>

Hi, @HHawley 👋 Welcome to the community! Hey, @taran42 @MichaelC @albertsg, can you lend a hand here? Or do you have thoughts on how @HHawley can troubleshoot here?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![hkampen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/hkampen/32/44643_2.png) [@hkampen](https://community.hubspot.com/u/hkampen)\
**Post date:** [July 29, 2024, 8:58am UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832/3 "2024-07-29T08:58:57Z")

</div>

It does not make sense.

The current version of hubspot-api-client exists in the .venv directory.

I have this import in for the class HubSpotContactRepos:

`from hubspot.crm.contacts import SimplePublicObjectInputForCreate`

The import of the class is

`from shared_hubspot.lib.repos.hubspot_contact_repos import HubSpotContactRepos`

When I import the class in a pytest script, it works. Whem I put a python script in the same folder, it doesn’t. In addition, I get this missleading error message when import hubspot faills indirectly by importing HubSpotContactRepos:

`ImportError: cannot import name 'HubSpotContactRepos' from partially initialized module 'shared_hubspot.lib.repos.hubspot_contact_repos' (most likely due to a circular import) (C:\path\to\shared_hubspot\lib\repos\hubspot_contact_repos.py)`

---

<div class="post-metadata">

**Author:** ![hkampen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/hkampen/32/44643_2.png) [@hkampen](https://community.hubspot.com/u/hkampen)\
**Post date:** [July 29, 2024, 9:38am UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832/4 "2024-07-29T09:38:33Z")

</div>

It was a name conflict in my case. I named the script hubspot.py. After renaming the file, it worked.

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [August 29, 2022, 5:15pm UTC](https://community.hubspot.com/t/python-hubspot-is-not-a-package/63832/5 "2022-08-29T17:15:39Z")

</div>

@HHawley I would maybe say, since you rebuilt the script, to double check that the module is installed and in the correct directory. Also try updating Python. There are multiple version of the API, so it may be conflicting with your current version.
