DeepFaceLab icon indicating copy to clipboard operation
DeepFaceLab copied to clipboard

No module named 'numpy' when accessing leras/__init__.py. python -mpip install numpy is not working.

Open rolandinthedeep opened this issue 2 years ago • 4 comments

Expected behavior

I am running my extract script for the MacOS version of DeepFaceLab. The script (2_extract_images_from_video_data_src.sh) is simply:

#!/usr/bin/env bash
cd "$(dirname $0)/.."
source scripts/env.sh

python "$DFL_MAIN" videoed extract-video \
  --input-file "$WORKSPACE/data_src.*" \
  --output-dir "$WORKSPACE/data_src"

Actual behavior

The error is as follows:

Traceback (most recent call last):
File "/Users/myusername/DeepFaceLab_MacOS/.dfl/DeepFaceLab/main.py", line 6, in
from core.leras import nn
File "/Users/myusername/DeepFaceLab_MacOS/.dfl/DeepFaceLab/core/leras/init.py", line 1, in
from .nn import nn
File "/Users/myusername/DeepFaceLab_MacOS/.dfl/DeepFaceLab/core/leras/nn.py", line 25, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'

Steps to reproduce

I have tried all of the suggestions listed in https://github.com/numpy/numpy/issues/15424.

Using python -mpip install numpy yields:

Requirement already satisfied: numpy in /Users/myusername/opt/anaconda3/envs/deepfake_env/lib/python3.6/site-packages (1.16.4)

I also receive the same message when I do pip3 install numpy.

I attempted to uninstall/reinstall. It throws an error. The only thing that changed is that when I attempt to python -mpip install numpy, I get:

Requirement already satisfied: numpy in /Users/myusername/opt/anaconda3/envs/deepfake_env/lib/python3.6/site-packages (1.19.5)

Additionally, uninstalling my Python IDE (as suggested in https://github.com/numpy/numpy/issues/15424) also did not work.

If it helps, if I do which python once I activate my environment, I get:

/Users/myusername/opt/anaconda3/envs/deepfake_env/bin/python

Other relevant information

  • Operating system and version: macOS
  • Python version: 3.6

rolandinthedeep avatar Apr 14 '22 17:04 rolandinthedeep

I have the same issue on centos 7

mattAndruff avatar May 31 '22 13:05 mattAndruff

For what it's worth. This project requires Python 3.7. This is set in Conda environment, and also in env.sh script. because the python version is set in the script to use "python3.7" it will override the conda environment and develop a mismatch and use the native python3.7 environment. If you upgrade your native environment to 3.7 you can resolve this issue. (or it seemed to resolve the issue for me.) It's possible this issue would also be resolved by setting env.sh to "python" as this would use the conda environment python instead.(Strictly speculation as I did not try it.)

mattAndruff avatar May 31 '22 18:05 mattAndruff

Same error here have you guys fixed it?

ngardelis avatar Feb 27 '23 06:02 ngardelis

@mattAndruff how did you update to 3.7 ? when I tried it said: [email protected] has been deprecated! [email protected]: The x86_64 architecture is required for this software.

ngardelis avatar Feb 27 '23 06:02 ngardelis

Did you ever find the answer? If so, would you mind sharing it and closing this issue?

joolstorrentecalo avatar Jun 08 '23 23:06 joolstorrentecalo