stenci
October 12, 2023, 7:30pm
1
Bug description:
When the name of the package does not match the name of the imported module, the wrong package is installed.
It is possible to manually install the correct package, but the code editor keeps showing the red wiggle. For example, after running the following in the shell, the code shown below works, but the red wiggle is still visible:
pip uninstall anvil
pip uninstall anvil-uplink
pip install anvil-uplink
Expected vs Current Behavior:
The correct package should be installed.
The red wiggle should disappear when the import succeeds.
Steps to reproduce:
Create a new python repl, add the following code and run:
import anvil
import anvil.server
print(anvil)
print(anvil.server)
Bug appears at this link: https://replit.com/@stenci/InbornWealthyGigabyte#main.py
Browser/OS/Device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Replit Profile: https://replit.com/@stenci
Hello, auto-importing is an intended feature of UPM
(Universal Package Manager). In python specifically, these guessed imports may be wrong, so you should tell it which package to import.
Example:
import pygame #upm package(pygame-ce)
Related:
Hello,
I’m trying to use a python package called interactions-py to make a Discord bot and when I start my Repl, it automatically installs another package for Discord with poetry.
Is it possible to disable the automatic pip install with poetry on a Python Repl ?
Thanks
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 appear…
It is usually best to disable import guessing in the packager configuration in .replit
file, but unfortunately this is currently broken because of a bug.
Problem -
Sometimes when I run my python repl, the packager starts importing/guessing packages even though it is configured not to in .replit file.
The packager should not be guessing and installing packages in my repl, so the configuration is not working.
How to reproduce -
Create a python (or pygame) repl.
In the .replit file, add some packager configuration, then reload shell:
# disables auto-import according to docs
[packager]
language = "python3"
ignoredPackages = ["pygame", "fold"]
…
Hello,
I’ve noticed the format of .replit file changed to TOML since the last time I used it (Python repl loads an incorrect package - Support / Bug Reports - Replit Ask ).
Now it doesn’t seem I can disable guessing imports.
I have the following in .replit file:
entrypoint = "main.py"
modules = ["python-3.10:v18-20230807-322e88b"]
hidden = [".pythonlibs"]
[nix]
channel = "stable-23_05"
[deployment]
run = ["sh", "-c", "python3 main.py"]
[packager]
language = "python3"
ignoredPackages = ["f…
Problem description:
After transferring an old Python repl to the new template (cloning from Github repository into a new repl) I’m running into a somewhat old problem again: When I hit the Run button poetry starts to install a package gardenlinux:
[gardenlinux]
After the successful installation nothing happens: The program doesn’t run and the the Run button stays activated, ie. it’s actually a Stop button. There’s also a huge CPU utilisation. Running the file from the shell works fine.
As…
Bug description:
Per the documentation, upm ‘package guessing’ can be disabled via .replit configuration
Expected vs Current Behavior:
When placing the following lines in your replit file (per the documentation found here: guessImports , upm should not try to guess packages based on imports:
[packager]
language = "python3"
[packager.features]
guessImports = false
Expected behavior: the package manager should not guess.
Actual behavior: the package manager continues to guess and install…
Hey all!
I was able to reproduce the issue and let the team know. I believe this is to do with our new Modules system that encapsulates configuration for languages such as Python onto our own infrastructure. This seems to prevent users from configuring the packager in the .replit file.
I will follow up once I have an update.
4 Likes
@stenci for you it would be
import anvil #upm package(anvil-uplink)
2 Likes
This is a tad bit of a nuclear option, but it does work:
There’s supposed to be a toggle for it in .replit
, but it doesn’t work. Here’s the workaround:
Friendly reminder that this does break the Packages tool.
1 Like
Replit has released a new setting to disable installs or guessing in configuration:
Hey all!
We have recently released a patch that allows these two fields to be applied to the .replit file:
# Stops the packager from installing packages when running the Repl
disableInstallBeforeRun = true
# Stops the packager from guessing and auto-installing packages, but it still runs to install packages when running the Repl
disableGuessImports = true
1 Like
system
Closed
October 22, 2023, 1:11am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.