Upm installing wrong package

Problem description:

I want to use pyserde, but upm is installing [serde] (can’t link because max two links but it’s on PyPi).

Expected behavior:

Because I poetry install pyserde, UPM is smart enough to understand that library provides serde.

Actual behavior:

I presume UPM is seeing import serde but no serde in the poetry.lock, and is and so is installing it. Then my code fails because serde does not include features which are in pyserde.

Steps to reproduce:

Should be obvious.

Bug appears at this link:
https://replit.com/@davetapley/serde-union-yaml-2#main.py

Browser:
OS:
Device (Android, iOS, NA leave blank):
Desktop app version (Avatar menu->“Version”) or NA:
Plan (Free, Hacker, Pro Plan):

There is a fix (click to view easier):

Example:

import pygame  #upm package(pygame-ce)

Why is this happening?
UPM is replit’s Universal Package Manager. Yes, it is for all languages. Python is kind of unique in that the import statement does not necessarily match the package name (as you’ve experienced). UPM looks in your code and tries to make a big list of package names you import. This obviously might not work for python.
https://docs.replit.com/programming-ide/installing-packages#guessing-failures
Normally, you are able to disable import guessing so it won’t install random stuff, but the configuration is (probably still) broken right now. See the above topic and topics linked in that topic for more info.


edit: configuration is available again, see:

1 Like