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 "main.py", line 4, in <module>
import numpy
File "/home/runner/lab17-numpy-polynomial-polynomial-issue/venv/lib/python3.8/site-packages/numpy/__init__.py", line 151, in <module>
from . import polynomial
File "/home/runner/lab17-numpy-polynomial-polynomial-issue/venv/lib/python3.8/site-packages/numpy/polynomial/__init__.py", line 116, in <module>
from .polynomial import Polynomial
ModuleNotFoundError: No module named 'numpy.polynomial.polynomial'
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.
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.
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
ValueError
Package numpy not found
at venv/lib/python3.8/site-packages/poetry/console/commands/remove.py:52 in handle
48│ requirements[key] = poetry_content[section][key]
49│ break
50│
51│ if not found:
→ 52│ raise ValueError("Package {} not found".format(name))
53│
54│ for key in requirements:
55│ del poetry_content[section][key]
56│
~/lab17-numpy-polynomial-polynomial-issue-2$
Hmm.
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)