Skip to content
Importing issue with duplicate import names
Profile icon
StingChameleon

Sorry for not providing a repl, but it shouldn't be necessary.

Here's my issue: I'm trying to use pyjwt for encoding tokens for my webapp. This library is imported via import jwt. Unfortunately, this import statement causes Replit to install the jwt library instead of pyjwt. As a result, I keep getting an error that the encode module doesn't exist (because it's trying to import it from jwt instead of pyjwt).

I've tried removing jwt from my poetry files, I had some brief success using pip to uninstall both libraries and then reinstalling pyjwt, but nothing seems to stick and now I can't even get that workaround to succeed. Bottom line: I need replit to stop installing the wrong jwt library.

Any suggestions?

You are viewing a single comment. View All
Profile icon
ibaraAsro

Sorry for the late reply. I just came across your question while searching for the same issue. Luckily, I have found one solution from replit's documentation. Just add comment next your "duplicate" import library with the right one. It's something like this:

import jwt #upm package(pyjwt)

ps. I'm not really sure upm package part but you only need to specify the correct library in the brackets. And I didn't save the link to the documentation, sorry.