Getting ModuleNotFoundError for an installed module

Problem description:

Trying to create a simple repl to demo a python package. The pyproject.toml file is updated and the Packages section lists it as installed, but when I Run I get ModuleNotFoundError for that package. I am newer to Replit but this seems like a bug.

Expected behavior:

The package is installed and usable. It is available on pypi: zillion · PyPI

I am using the “extras” format to install an extension as well in pyproject.toml:

zillion = {extras = ["nlp"], version = "0.9.7"}

Actual behavior:

The package is not installed.

Steps to reproduce:

Hit Run on the link provided below.

Bug appears at this link:

https://replit.com/@totalhack0/Zillion-Baseball-Databank

Browser/OS/Device:

~Latest Firefox / Ubuntu 22.04 / Laptop.

Try adding zillion via the packager or by running one of these commands in the Shell tab:
poetry add zillion
pip install zillion

Adding via package manager did not work, and that also wouldn’t allow installed “extras”.

I am in the process of installing from the shell now, but that does not address the bug, just works around it. That also hit a separate issue, retrying now though:

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘package-proxy.replit.com’, port=443): Read timed out. (read timeout=15)”)’: /pypi/simple/grpcio-tools/

Error message?

Clarification please

Replit’s guess imports thing is not perfect.

The server might be overloaded? I’m not sure.

1 Like

Whoa, pip install from the shell installed an outdated package version! Is replit doing some weird pip setup/caching that would cause that? Latest version of zillion is 0.9.7 but it installed 0.8.2 when I did not specify a version. Retrying with a version specified in the shell…

Interesting. I can’t think of a reason for this, except that maybe the python version replit is running might be outdated, and therefore needs an older version.

To answer your previous questions:

  • Add via package manager runs into the exact same issue as initially shown on this post. Namely, it leads to ModuleNotFoundError even though it says the module is installed.

  • Clarification on “extras”: please see initial post again. Poetry allows installed extras with the following format: zillion = {extras = ["nlp"], version = "0.9.7"}

  • This bug doesn’t seem to have anything to do with guess imports.

Interesting. I wonder why.

Is “nlp” it’s own package? Otherwise I’ve never heard of “extras” before.

I was referring to the fact that all I saw from your original post was that you were importing zillon, which prompted me assuming guess imports to be at fault.

Extras are just a way of installing additional dependencies that are only relevant for certain scenarios. Many popular python packages do this as a way to not bloat the default install. For Zillion the NLP extension adds some additional packages for integrating with OpenAI to enable NLP features.

Welp, I seem to have found another bug. I deleted that repl to recreate it since I am worried the environment is become a mess now from attempted workarounds, and replit now immediately crashes and boots me from that repl page when I try to open it! I had tried to use the same name so that must be the cause of the bug on their end.

Anyhow, still not having any luck with a fresh repl.

https://replit.com/@totalhack0/ZillionBaseballDatabank

Hmm. I’m testing something, hang on.

You could try poetry update && poetry install, but it seems like it might take a while.

I’ll try that, but it’s not really solving the root issue here which is replit saying something is installed when it’s not. It probably warrants raising a bug with the Replit engineering team, not sure how to do that though.

I got an output, I don’t think it’s what you wanted though.

$ poetry update && poetry install
Updating dependencies
Resolving dependencies... (61.3s)
Resolving dependencies... (61.6s)
Resolving dependencies... (62.5s)
Resolving dependencies... (63.1s)

  SolverProblemError

  Because no versions of replit match >3.2.4,<3.2.5 || >3.2.5,<3.2.6 || >3.2.6,<3.2.7 || >3.2.7,<4.0.0
   and replit (3.2.4) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>=3.2.4,<3.2.5 || >3.2.5,<3.2.6 || >3.2.6,<3.2.7 || >3.2.7,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.2.5) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>=3.2.4,<3.2.6 || >3.2.6,<3.2.7 || >3.2.7,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.2.6) depends on typing_extensions (>=3.7.4,<4.0.0)
   and replit (3.2.7) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>=3.2.4,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  Because zillion (0.9.7) depends on qdrant-client (1.1.3)
   and qdrant-client (1.1.3) depends on typing-extensions (>=4.0.0,<5.0.0), zillion (0.9.7) requires typing-extensions (>=4.0.0,<5.0.0).
  Thus, zillion (0.9.7) is incompatible with replit (>=3.2.4,<4.0.0).
  So, because python-template depends on both replit (^3.2.4) and zillion (0.9.7), version solving failed.

  at venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

Lovely! Poetry is well-intentioned but boy does it get annoying sometimes. I wouldn’t be surprised if these versions all worked fine together but maintainers set upper bounds on versions because they couldn’t be 100% sure things would continue working with a new major version. I will have to setup an environment with pip.

1 Like

Thanks for the suggestion. I’ll try that if I end up using poetry.

Ended up just going with this approach. Thanks.

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