Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'VersionInfo' #173

Closed
anirudhdpai opened this issue May 6, 2022 · 3 comments
Closed

ImportError: cannot import name 'VersionInfo' #173

anirudhdpai opened this issue May 6, 2022 · 3 comments

Comments

@anirudhdpai
Copy link

anirudhdpai commented May 6, 2022

Is this a support request?
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug
Importing VersionInfo in the operators.py file gives out an import error since semver has deprecated VersionInfo and replaced it by Version

To reproduce
Run operators.py file from launchdarkly repo.

Expected behavior
Importing VersionInfo must be successful from launchdarkly

Logs

    from .client import *
  File "/usr/local/lib/python3.6/dist-packages/ldclient/client.py", line 18, in <module>
    from ldclient.flag import EvaluationDetail, evaluate, error_reason
  File "/usr/local/lib/python3.6/dist-packages/ldclient/flag.py", line 12, in <module>
    from ldclient import operators
  File "/usr/local/lib/python3.6/dist-packages/ldclient/operators.py", line 8, in <module>
    from semver import VersionInfo
ImportError: cannot import name 'VersionInfo'

SDK version
Latest version

Language version, developer tools
Python 3.6.9 and 3.6.15

OS/platform
Ubuntu 18.04 and 20.04

Additional context
https://readthedocs.org/projects/python-semver/downloads/pdf/latest/

@eli-darkly
Copy link
Contributor

It's unclear to me how this could be happening. It looks like perhaps you have installed the prerelease 3.0.0-dev.2 or 3.0.0-dev.3 version of semver— the docs you linked to are for 3.0.0-dev.3. But the SDK's dependency on semver specifically requires that the version be less than 3.0.0. You'll see in our requirements.txt:

semver>=2.10.2,<3.0.0

@eli-darkly
Copy link
Contributor

eli-darkly commented May 9, 2022

I'll add that "Run operators.py file from launchdarkly repo" is not really a usable instruction for reproducing the issue. Any given source file like operators.py does not get run by itself in isolation; import errors like you're seeing are dependent on the state of the overall Python environment, i.e. what packages have been installed. We do have unit tests in the repository that exercise all of the code in the SDK, including operators.py, and they are working fine; but they rely on having correctly installed the dependencies that are configured in our requirements.txt. That should happen for you automatically if you're using the LaunchDarkly SDK in an application, but I don't know anything about what your project may be or how you have set up your dependencies or development environment.

@anirudhdpai
Copy link
Author

Looks like this is happening due to the packages we've got in our requirements.txt.

Thanks a lot for the input,
anirudhdpai

LaunchDarklyReleaseBot pushed a commit that referenced this issue Jun 15, 2022
…ate-methods

remove some methods from the public test_data API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants