smartystreets / smartystreets-python-sdk

The official client libraries for accessing SmartyStreets APIs from Python 2.7 and 3.5
https://smartystreets.com/docs/sdk/python
Apache License 2.0
28 stars 30 forks source link

pip install does not work in python 3.6/3.7 #5

Closed drj42 closed 5 years ago

drj42 commented 5 years ago

This appears to be related to the library importing itself during setup, to read the version string in __init__.py. Strangely, it works for me on python 2 (but obviously that isn't a sufficient work around).

If requests is already installed in the environment, pip install works. If requests is absent, it fails:

$ pip install smartystreets_python_sdk

Collecting smartystreets_python_sdk
  Downloading https://files.pythonhosted.org/packages/84/5c/c78180adcb787cba08f1f45d083d6ae1177450d63bedf4ab5e388b49a5c4/smartystreets_python_sdk-3.3.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-au0p_thk/smartystreets-python-sdk/setup.py", line 1, in <module>
        import smartystreets_python_sdk
      File "/tmp/pip-install-au0p_thk/smartystreets-python-sdk/smartystreets_python_sdk/__init__.py", line 3, in <module>
        from .requests_sender import RequestsSender
      File "/tmp/pip-install-au0p_thk/smartystreets-python-sdk/smartystreets_python_sdk/requests_sender.py", line 1, in <module>
        from requests import Session, Request
    ModuleNotFoundError: No module named 'requests'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-au0p_thk/smartystreets-python-sdk/
MouaYing commented 5 years ago

Thank you for bringing this to our attention. We are looking into it.

joliver commented 5 years ago

For the moment the workaround is to run:

pip install requests

danaronson commented 5 years ago

This workaround doesn't work for me. I'm using smartystreets with the serverless framework and https://www.npmjs.com/package/serverless-python-requirements and I only get one requirements file.

danaronson commented 5 years ago

3.2.0 works though

mdwhatcott commented 5 years ago

This should be fixed now. We've moved the __version__ variable to its own package that doesn't have any external dependencies (https://github.com/smartystreets/smartystreets-python-sdk/commit/7d4ba8cf250fb142da6253213c8f3769d9928642)

mdwhatcott commented 5 years ago

Please download and install version 4.0.1.