NIX conversion issue: spurious numpy.polynomial issue

Bug description:
After a nix conversion of a python repl
After pip install numpy in the shell
Running the repl generates a numpy.polynomial module error

Expected vs Current Behavior:
installing the numpy library should workj for this script, which does not use the numpy.polynomial library

Steps to reproduce:
run the repl, see output in console

Traceback (most recent call last):
  File "", line 4, in <module>
    import numpy
  File "/home/runner/lab17-numpy-polynomial-polynomial-issue/venv/lib/python3.8/site-packages/numpy/", line 151, in <module>
    from . import polynomial
  File "/home/runner/lab17-numpy-polynomial-polynomial-issue/venv/lib/python3.8/site-packages/numpy/polynomial/", line 116, in <module>
    from .polynomial import Polynomial
ModuleNotFoundError: No module named 'numpy.polynomial.polynomial'

Bug appears at this link:

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Replit Profile:

A fix would be to uninstall and reinstall numpy. (poetry remove numpy, poetry add numpy).
Alternatively, one could create a new python repl and copy in the code.

an SO question on this:

I see you’ve fixed it by telling your students to use pip install.
But using replit’s fork of pip directly causes confusion. And you’re forcing numpy to run on a python version that it no longer supports. And in general, poetry’s a better package manager.
Although, in this case, I’d prefer if it was smarter and installed the latest version of numpy that supports python 3.8. I would update the repl to match the config for python 3.11.

1 Like

FWIW: Here’s what I see when execute “poetry remove numpy” in the shell on a fork of this repl:

~/lab17-numpy-polynomial-polynomial-issue-2$ poetry remove numpy
Creating virtualenv python-template-s3BkAFKV-py3.8 in /home/runner/lab17-numpy-polynomial-polynomial-issue-2/.cache/pypoetry/virtualenvs


  Package numpy not found

  at venv/lib/python3.8/site-packages/poetry/console/commands/ in handle
      48│                     requirements[key] = poetry_content[section][key]
      49│                     break
      51│             if not found:
    → 52│                 raise ValueError("Package {} not found".format(name))
      54│         for key in requirements:
      55│             del poetry_content[section][key]

It is probably easiest to create a new python repl and copy in the code, if this is possible.
Your repl is on an older template, and was also converted to nix, so it isn’t that surprising that it has some issues with packages. As Umar says, the version of numpy and the version of python may be incompatible.
(I do not know how else to fix this issue)