I'm working with Python 3.10.11 on Windows 11 using freshly created venv. I installed moviepy using pip, now if I do
(venv) PS D:\Projects\bot for circles\Telegram-Video-Circle-Bot> pip list
I get
------------------- ---------
anyio 4.0.0
certifi 2023.7.22
charset-normalizer 3.3.2
colorama 0.4.6
decorator 4.4.2
exceptiongroup 1.1.3
h11 0.14.0
httpcore 0.18.0
httpx 0.25.0
idna 3.4
imageio 2.31.6
imageio-ffmpeg 0.4.9
moviepy 1.0.3
numpy 1.26.1
opencv-python 4.8.1.78
Pillow 10.0.1
pip 23.0.1
proglog 0.1.10
python-telegram-bot 20.6
requests 2.31.0
setuptools 65.5.0
sniffio 1.3.0
tqdm 4.66.1
urllib3 2.0.7
So moviepy is in the list. But when I try to import it, it just not working:
(venv) PS D:\Projects\bot for circles\Telegram-Video-Circle-Bot> python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import moviepy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'moviepy'
>>>
What can I do to fix it?
I worked without using venv, when I got that error first time, now I switched to venv and created new enviroment, then installed all packages that I needed. It is error that occurs with moviepy specifically, for example, numpy works perfectly:
(venv) PS D:\Projects\bot for circles\Telegram-Video-Circle-Bot> python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.arange(0, 10, 11)
array([0])
I think your PATH is declared in the wrong way. Your path will have pattern like /path/to/A/bin:/path/to/B/bin:/path/to/your/venv/bin
So the
python
command will exist in also yourpath/to/A
and yourvenv
, but it come from/path/to/A
, then the OS will get the python executed file in/path/to/A/bin
instead of/path/to/your/venv/bin
- which contains the python version that includedmoviepy
.Verify my idea by using
where python
vswhere pip
commandThere is 2 way to fix it:
python -m pip install moviepy
, then usepython main.py
as usual (recommend for newbie)Good luck