Skip to content

on macOS, getting "ImportError: cannot import name 'linux_distribution' from 'platform' error #12

@buckleyc

Description

@buckleyc

Trying to use latest ipify-1.0.0 with python 3.10.2 on macOS 11.6.5.
Returns "ImportError: cannot import name 'linux_distribution' from 'platform'"

╭─[zephyr] as buckley in ~ using node v17.8.0   
╰──➤  python3 -m pip install --upgrade ipify
Collecting ipify
  Using cached ipify-1.0.0-py2.py3-none-any.whl (8.9 kB)
Requirement already satisfied: requests>=2.7.0 in ./.pyenv/versions/3.10.2/lib/python3.10/site-packages (from ipify) (2.27.1)
Collecting backoff>=1.0.7
  Using cached backoff-1.11.1-py2.py3-none-any.whl (13 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.pyenv/versions/3.10.2/lib/python3.10/site-packages (from requests>=2.7.0->ipify) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in ./.pyenv/versions/3.10.2/lib/python3.10/site-packages (from requests>=2.7.0->ipify) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in ./.pyenv/versions/3.10.2/lib/python3.10/site-packages (from requests>=2.7.0->ipify) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in ./.pyenv/versions/3.10.2/lib/python3.10/site-packages (from requests>=2.7.0->ipify) (2.0.12)
Installing collected packages: backoff, ipify
Successfully installed backoff-1.11.1 ipify-1.0.0
                                                                                                                                                                                         
╭─[zephyr] as buckley in ~ using node v17.8.0  
╰──➤  python3                               
Python 3.10.2 (main, Mar 10 2022, 20:48:21) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ipify import get_ip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/buckley/.pyenv/versions/3.10.2/lib/python3.10/site-packages/ipify/__init__.py", line 31, in <module>
    from .ipify import get_ip
  File "/Users/buckley/.pyenv/versions/3.10.2/lib/python3.10/site-packages/ipify/ipify.py", line 14, in <module>
    from .settings import API_URI, MAX_TRIES, USER_AGENT
  File "/Users/buckley/.pyenv/versions/3.10.2/lib/python3.10/site-packages/ipify/settings.py", line 9, in <module>
    from platform import mac_ver, win32_ver, linux_distribution, system
ImportError: cannot import name 'linux_distribution' from 'platform' (/Users/buckley/.pyenv/versions/3.10.2/lib/python3.10/platform.py)
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions