Conflicting Packages with the same name in Python Replit

I am trying to install this marvin python package (Installation - Marvin) and am successful doing so with pip install marvin, per the instructions. However, when I do import marvin in my python script, even if I do something like, from marvin import ai_fn, the script imports this marvin (sdss-marvin · PyPI), which though it has a different installation (pip install sdss-marvin), it also uses import marvin.

I have tried everything I could think of, but can’t figure out how to prevent this other marvin (sdss-marvin) from being imported and it breaks my repl environment every time. Any suggestions?

Why not just pip uninstall sdss-marvin?

I just tried the following.

  1. I created a new blank python repl
  2. pip install marvin (installed the correct marvin)
  3. I added to my main.py: from marvin import AIApplication and print(“test”)
  4. I ran the script and then it started installing sdss-marvin and it’s 55 dependencies
  5. I tried to pip uninstall sdss-marvin and got “SyntaxError: invalid syntax”

Whenever it imports sdss-marvin it essentially breaks the repl and I can’t even print to the console unless I remove all import marvin code.

To note, I was also using the Marvin package just fine the last few days and it still works from an old repl I have. I just can no longer create a new repl and install it. It might be related to the switch to the beta version of the Python template using Replit’s new Nix module system. I just started getting that message today when I create a new Python repl.

Ah. Replit wants to guess your packages.
Try doing this before installing marvin:

1 Like

Thanks for the help Firepup. I ended up disabling the Explorer role and that fixed the issue. To note, your suggestion to set guessImports = false works perfectly if the Explorer role is disabled and Replit’s new Nix module system isn’t active. When Explorer was on and the Nix module system is active the guessImports = false wasn’t being respected.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.