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

Imports incorrect modules in Python when Poetry already has correct module #15

Open
AlexBlandin opened this issue Nov 1, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@AlexBlandin
Copy link

So some packages, such as py-ulid, have a different name from the imported module, in this case import ulid, or as usually done, from ulid import ULID.

If you import with Repl.it, then the first time you run it everything works fine. If you close and open again, the next time it tries to import the module ulid, which has a completely different interface and doesn't have a ULID class to import, and now no longer runs as ulid, which python attempts to resolve against rather than py-ulid (and doesn't keep checking after the failure), doesn't have a ULID to import.

Namely, UPM needs to either check against the existing packages that have been added, seeing if they are applicable, or it needs to check whether the packages it tried to include actually satisfy the interface of the program (even just flagging up that the ulid package doesn't have ULID while py-ulid, which is already in the Poetry file, does).

This isn't really the fault of UPM, since Python is the one not checking for these when it is trying to resolve the imports, however this needs to be worked around in order to be Universal until (if ever) Python fixes this, especially for versions that do not have the fixed version should it ever happen.

@raxod502
Copy link
Contributor

raxod502 commented Nov 2, 2019

This should have been fixed by #6 cc @turbio but I guess it wasn't.

@kaijchang
Copy link

Still an issue for me.

@jahands
Copy link

jahands commented Mar 31, 2021

Looks like a user is having this same issue trying to use "pyjwt" instead of "jwt":

https://replit.com/talk/ask/Importing-issue-with-duplicate-import-names/132288

@blast-hardcheese blast-hardcheese added the bug Something isn't working label Dec 23, 2023
@blast-hardcheese
Copy link
Collaborator

Looking into this, thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants