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

Poetry installing wrong package #69

Closed
rayzchen opened this issue Jun 13, 2021 · 8 comments · Fixed by #191
Closed

Poetry installing wrong package #69

rayzchen opened this issue Jun 13, 2021 · 8 comments · Fixed by #191

Comments

@rayzchen
Copy link

On PyPi, there are 2 packages called glm: glm and PyGLM. The former is now unmaintained and is (I believe) a json parser, whereas the other is an OpenGL mathematics library. I am developing a library which depends on the latter, but it is imported with import glm. However, upm guess will automatically resolve the dependencies by installing glm which then screws up PyGLM. Is there a way to turn off upm guess from running automatically when I run my repl?

@francosang
Copy link

francosang commented Aug 15, 2021

I have the same problem with the Discord API wrapper.

The code for importing the package is import discord, so UPM wrongly guesses that the package is called discord and adds it with poetry add discord.
(According to https://pypi.org/project/discord/ that package should not be used, the correct package is discord.py).

Anyways, my problem is that I need to use the master branch of that package's repo, so I added the package manually to the toml file:

[tool.poetry.dependencies]
python = "^3.8"
"discord.py" = { git = "https://github.com/Rapptz/discord.py.git", branch = "master" }

But UPM adds discord again even if discord.py is already imported.
So, in the end, my toml file ends up looking like this...

[tool.poetry.dependencies]
python = "^3.8"
"discord.py" = { git = "https://github.com/Rapptz/discord.py.git", branch = "master" }
discord = "^1.7.3"

...with two different versions of the same package imported twice. Which is not great.


Turning UPM off or stopping it would be a good solution.

@techpixel
Copy link

techpixel commented Sep 19, 2021

No need for this. Replit just failed to guess the package.

To get around this, add #upm package(package-name) at the end of your import statement

Ex.

import discord #upm package(discord.py)

For more information check the docs

@JDJGInc
Copy link

JDJGInc commented Jun 3, 2023

this shouldn't be needed here, it should just use the right library.

@lmmx
Copy link

lmmx commented Dec 10, 2023

This is not a scalable way to install Python packages, this should be turned off if packaging metadata is available (and should create that packaging metadata on first run, therefore switching itself off). I.e. the correct thing to do is to defer to pyproject.toml dependencies, and not haphazardly guess from import statements. I keep checking back to find it not fixed, I’d love to try Replit but this is a show stopper for me.

I’d really like to see this prioritised and thought I should comment rather than just intermittently checking for progress.

@blast-hardcheese
Copy link
Collaborator

This dovetails with some of the work we've been doing recently to improve the dependencies search pane, I'll see what can be done to improve this. Thanks for your patience, all, agreed that this should definitely not be up to the user to inform the tool to behave correctly.

blast-hardcheese added a commit that referenced this issue Dec 19, 2023
blast-hardcheese added a commit that referenced this issue Dec 19, 2023
blast-hardcheese added a commit that referenced this issue Dec 19, 2023
blast-hardcheese added a commit that referenced this issue Dec 19, 2023
* Explain why this is in here

* Some more package renames

Resolves #69
@lmmx
Copy link

lmmx commented Dec 27, 2023

Er... I was using this issue to track whether this bug was resolved or not. It just got closed after a list of manual replacements has been added to in #191 ("guess package suggestions"). I don't think this is solving the problem

@blast-hardcheese
Copy link
Collaborator

@lmmx Sorry for closing this issue without comment, there were a few different threads here that I was trying to address, it looks like I missed the main one.

Is there a way to turn off upm guess from running automatically when I run my repl?

Yes. Add the following line in the root section of your .replit file (up top, at the same level as run):

disableGuessImports = true

This will disable upm guessing entirely. This configuration option is not publicly documented, but there is discussion on Ask, which suggests the omission of that config option in our docs should be addressed.

More broadly, work on improving the guesser has continued in #15. Hopefully this resolves the issue, and again I do apologize for not communicating more around how/why this issue was closed.

@lmmx
Copy link

lmmx commented Dec 28, 2023

Oh thank you for documenting here! Sorry I thought it was just being swept under the rug lol, love to see it! Congrats on solving at long last 😃

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

Successfully merging a pull request may close this issue.

6 participants