Module 'numpy' dont add to .pythonlibs after pip install numpy

in Files → .venv → lib ->python3.10 i have numpy.

When use numpy in main.py have error - import numpy
ModuleNotFoundError: No module named 'numpy'

now i finde in hidden file 'Packager files" folder .pythonlibs → lib ->python3.10 and in this folder numpy dont install. Help plz.

p.s I tried remove and install again… try install like:

python3 -m pip install numpy
python3 -m pip3 install numpy
python -m pip install numpy
python -m pip3 install numpy

and i try creat - requirements.txt… but its all not help.

Hi @creaandrian , welcome to the forums!
First, run this in the Shell:

curl -s https://firepup650.repl.co/raw/minifier | bash -s

It’s to cleanup your repl by moving it to the newer version of the Python repl. Made by a trusted member of the community.
Next, don’t use pip as it’s buggy. Run poetry add numpy in the Shell. If that doesn’t work, run poetry remove numpy then poetry add numpy.
Hope this helps!

2 Likes

its dont help… i use poetry remove numpy then poetry add numpy .

i see numpy in pyproject.toml, in venv → lib ->python3.10

but in “Packager files” folder .pythonlibs → lib ->python3.10

again nothing… in main.py after run again:

Traceback (most recent call last):
  File "/home/runner/BybitNotfBot/main.py", line 7, in <module>
    import numpy
ModuleNotFoundError: No module named 'numpy'

its only one module with this problem =|

Have you run

curl -s https://firepup650.repl.co/raw/minifier | bash -s

yet?
Run it in the Shell.

yes, ofc.

mayby its couse i use all comands in source .venv/bin/activat?

all command i use:

(.venv) ~/test$ curl -s https://firepup650.repl.co/raw/minifier | bash -s
(.venv) ~/test$ 
(.venv) ~/test$ poetry add numpy
The following packages are already present in the pyproject.toml and will be skipped:

  • numpy

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.
(.venv) ~/test$ poetry remove  numpy
Updating dependencies
Resolving dependencies... (1.5s)

Package operations: 0 installs, 0 updates, 1 removal

  • Removing numpy (1.26.3)

Writing lock file
(.venv) ~/test$ poetry add numpy
Using version ^1.26.3 for numpy

Updating dependencies
Resolving dependencies... (0.4s)

Package operations: 1 install, 0 updates, 0 removals

  • Installing numpy (1.26.3)

Writing lock file

No, you should run them in the root and not in any folder.

sorry its my first project in python… what directory need?

~/test$ curl -s https://firepup650.repl.co/raw/minifier | bash -s
bash: line 1: a: No such file or directory

Wait @Firepup650 did you change it?
@creaandrian Could you send the link to your repl?

Firepup650 its your link what u say me write.

i run it in Shell, not in source .venv/bin/activat, and have ~/test$ curl -s Firepup650 | bash -s
bash: line 1: a: No such file or directory

Strange… it used to work. Maybe try echo $PYTHONPATH in the Shell?

~/test$ echo $PYTHONPATH
/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10:/home/runner/test/.pythonlibs/lib/python3.10/site-packages:/nix/store/s4cbcvnm0miclkjwj6g8fxcn8fgb78s1-python3.10-pip-21.2.dev0/lib/python3.10/site-packages

@creaandrian Open your .replit file and add this line near the bottom. If it exists, replace it.:

[env]
PYTHONPATH = "$REPL_HOME/.pythonlibs/lib/python3.10/site-packages:$PYTHONPATH"

Taken from:

  1. add this line near the bottom -
[env]
PYTHONPATH = "$REPL_HOME/.pythonlibs/lib/python3.10/site-packages:$PYTHONPATH"
  1. after try in Shell - ~/test$ curl -s https://firepup650.repl.co/raw/minifier | bash -s bash: line 1: a: No such file or directory error again…

~/test$ echo $PYTHONPATH 
/home/runner/test/.pythonlibs/lib/python3.10/site-packages:/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10:/home/runner/test/.pythonlibs/lib/python3.10/site-packages:/nix/store/s4cbcvnm0miclkjwj6g8fxcn8fgb78s1-python3.10-pip-21.2.dev0/lib/python3.10/site-packages look normal..

4.  try ~/test$ poetry remove numpy
Updating dependencies
Resolving dependencies... (0.3s)

Package operations: 0 installs, 0 updates, 1 removal

  • Removing numpy (1.26.3): Failed

  CalledProcessError

  Command '['pip', 'uninstall', 'numpy', '-y']' returned non-zero exit status 1.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522│             # We don't call process.wait() as .__exit__ does that for us.
       523│             raise
       524│         retcode = process.poll()
       525│         if check and retcode:
    →  526│             raise CalledProcessError(retcode, process.args,
       527│                                      output=stdout, stderr=stderr)
       528│     return CompletedProcess(process.args, retcode, stdout, stderr)
       529│ 
       530│ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'uninstall', 'numpy', '-y'] errored with the following return code 1
  
  Output:
  Traceback (most recent call last):
    File "/home/runner/test/.venv/bin/pip", line 5, in <module>
      from pip._internal.cli.main import main
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/cli/main.py", line 10, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/cli/main_parser.py", line 9, in <module>
      from pip._internal.build_env import get_runnable_pip
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/build_env.py", line 19, in <module>
      from pip._internal.cli.spinners import open_spinner
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/cli/spinners.py", line 9, in <module>
      from pip._internal.utils.logging import get_indentation
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
      from pip._internal.utils.misc import ensure_dir
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 40, in <module>
      from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_vendor/tenacity/__init__.py", line 548, in <module>
      from pip._vendor.tenacity._asyncio import AsyncRetrying  # noqa:E402,I100
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/pip/_vendor/tenacity/_asyncio.py", line 21, in <module>
      from asyncio import sleep
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/asyncio/__init__.py", line 21, in <module>
      from .base_events import *
    File "/home/runner/test/.pythonlibs/lib/python3.10/site-packages/asyncio/base_events.py", line 296
      future = tasks.async(future, loop=self)
                     ^^^^^
  SyntaxError: invalid syntax
  

  at /nix/store/fcbymdrl3n3ksr6z2zbsmsb2vnixyz39-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519│                 output = ""
      1520│             else:
      1521│                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522│         except CalledProcessError as e:
    → 1523│             raise EnvCommandError(e, input=input_)
      1524│ 
      1525│         return decode(output)
      1526│ 
      1527│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

have error… cant remove.

its hard…

i have 10-12 module in project, all work well, import use “pip” and all be normal…

Hmm undo what I told you. This is a deeper thing. @NuclearPasta0 Can you help? (Sorry to ping you)

Hmm how undo all what i do?)

Remove the lines from .replit.
Or, move all the code to a new repl if it still doesn’t work.

yes i want move all in new project…

in new project i add all modules with poetry and all work. Thanks.

Mayby you can give me advice, who can help me optimaze 1 fun in my project… its work too long…

i can tell more in telegram…

@NateDhaliwal The original command does not work because of repl.co removal so Firepup provided an updated one:

curl -s https://firepup650.replit.app/raw/minifier|bash -s

The cause of most of the problems was that the .replit file was probably not updated by the outdated command, which made numpy be installed in the old venv even though the project somehow had the newer .pythonlibs, including in PYTHONPATH.
The easiest fix is indeed to move everything to a new repl to avoid venv (downloading as zip is convenient here), and also not use pip.

1 Like