Unable to to update yt-dlp using pip command - python

I am unable to update yt-dlp on MacOS Ventura 13.2.1 - hopefully someone can help me.
My details are:
[debug] Command-line config: ['-v']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (pip)
[debug] Python 3.11.1 (CPython arm64 64bit) - macOS-13.2.1-arm64-arm-64bit (OpenSSL 1.1.1t 7 Feb 2023)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
If I type python3 --version I get:
Python 3.9.6
I installed yt-dlp using pip, so when I try to update in the normal way I'm getting these messages:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: yt-dlp in ./Library/Python/3.9/lib/python/site-packages (2023.2.17)
Requirement already satisfied: brotli in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (1.0.9)
Requirement already satisfied: websockets in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (10.4)
Requirement already satisfied: pycryptodomex in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (3.17)
Requirement already satisfied: mutagen in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (1.46.0)
Requirement already satisfied: certifi in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (2022.12.7)
My pip3 version is:
pip 23.0.1 from /Users/user/Library/Python/3.9/lib/python/site-packages/pip (python 3.9)
​
I am the only user of the machine and am on the admin account. I tried logging out and back in again and it still won't update. I'm not sure what the problem is, but any help would be most welcome.
I am unable to update yt-dlp on MacOS and hopefully someone can help me.
My details are:
[debug] Command-line config: ['-v']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (pip)
[debug] Python 3.11.1 (CPython arm64 64bit) - macOS-13.2.1-arm64-arm-64bit (OpenSSL 1.1.1t 7 Feb 2023)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
If I type python3 --version I get:
Python 3.9.6
I installed yt-dlp using pip, so I try to update yt-dlp using this command:
pip3 install --upgrade yt-dlp
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: yt-dlp in ./Library/Python/3.9/lib/python/site-packages (2023.2.17)
Requirement already satisfied: brotli in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (1.0.9)
Requirement already satisfied: websockets in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (10.4)
Requirement already satisfied: pycryptodomex in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (3.17)
Requirement already satisfied: mutagen in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (1.46.0)
Requirement already satisfied: certifi in ./Library/Python/3.9/lib/python/site-packages (from yt-dlp) (2022.12.7)
My pip3 version is:
pip 23.0.1 from /Users/user/Library/Python/3.9/lib/python/site-packages/pip (python 3.9)
​
I am the only user of the machine and am on the admin account. I tried logging out and back in again and it still won't update. I'm not sure what the problem is, but any help would be most welcome.

Related

ModuleNotFoundError: No module named 'flask_cors' on python anywhere

To state from the get go this is no criticism of pythonanywhere, but I want to run a script that used to work using the line:
from flask_cors import CORS
But I get the following error mesage:
ModuleNotFoundError: No module named 'flask_cors'
Then tried to install in my version of python:
pip3.9 install Flask-Cors
The result was:
Defaulting to user installation because normal site-packages is not
writeable Looking in links: /usr/share/pip-wheels Requirement already
satisfied: Flask-Cors in ./.local/lib/python3.9/site-packages (3.0.10)
Requirement already satisfied: Six in
/usr/local/lib/python3.9/site-packages (from Flask-Cors) (1.16.0)
Requirement already satisfied: Flask>=0.9 in
/usr/local/lib/python3.9/site-packages (from Flask-Cors) (2.0.0)
Requirement already satisfied: Werkzeug>=2.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(2.0.1) Requirement already satisfied: itsdangerous>=2.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(2.0.1 ) Requirement already satisfied: click>=7.1.2 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(7.1.2) Requirement already satisfied: Jinja2>=3.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(3.0.1) Requirement already satisfied: MarkupSafe>=2.0 in
/usr/local/lib/python3.9/site-packages (from
Jinja2>=3.0->Flask>=0.9->Flask-C ors) (2.0.1) 15:33 ~$ pip show
Flask-Cors
Name: Flask-Cors Version: 3.0.10 Summary: A Flask extension adding a decorator for CORS support Home-page:
https://github.com/corydolphin/flask-cors Author: Cory Dolphin
Author-email: corydolphin#gmail.com License: MIT Location:
/home/elksie5000/.local/lib/python3.9/site-packages Requires: Six,
Flask
What gives and how do I fix it?
I think you should try the following:
Go to your Bash Console in "Consoles" menu.
Open the bash control
Select your virtualenv:
For example my virtualenv name is flaskapp, I would wirte "workon
flaskapp" in the bash console.
Now type in your desired command
pip3.9 install flask-cors in your case (try in lower case)
Make sure you are working in the same virtualenv and the same python version
(I think you want to make an API using cors maybe)

pipenv is installed, but $ pipenv --version shows as command not found

Newbie here not understanding how pipenv can simultaneously show as installed and not installed at the same time. Am using Windows 10 (2004) in the VS Code terminal:
$ pip install pipenv returns this:
Requirement already satisfied: pipenv in c:\users\billa\appdata\roaming\python\python37\site-packages (2018.11.26)
Requirement already satisfied: virtualenv-clone>=0.2.5 in c:\users\billa\appdata\roaming\python\python37\site-packages (from pipenv) (0.5.3)
Requirement already satisfied: certifi in c:\users\billa\appdata\local\programs\python\python37\lib\site-packages (from pipenv) (2019.6.16)
Requirement already satisfied: virtualenv in c:\users\billa\appdata\local\programs\python\python37\lib\site-packages (from pipenv) (16.7.7)
Requirement already satisfied: setuptools>=36.2.1 in c:\users\billa\appdata\local\programs\python\python37\lib\site-packages (from pipenv) (44.0.0)
Requirement already satisfied: pip>=9.0.1 in c:\users\billa\appdata\local\programs\python\python37\lib\site-packages (from pipenv) (20.1.1)
But:
$ pipenv --version
Returns this:
$ pipenv: command not found
Perplexingly, if I use Ubuntu in Windows terminal, it reports back properly:
$ pipenv, version 2020.6.2
Thanks in advance.

Importing matplotlib gives error even though installed

I was hoping someone could help me out.
System is MacOS Catalina.
Python 3.8
IDE: VS
I installed matplotlib using pip install matplotlib which I saw stuck in under python2.7. I uninstalled matplotlib and reinstalled it using pip3 install matplotlib and received the following message:
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.7/site-packages (from matplotlib) (1.18.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: six in /Users/apple/Library/Python/3.7/lib/python/site-packages (from cycler>=0.10->matplotlib) (1.13.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (46.0.0)
However, when I try to run my .py file with 'import matplotlib' it gives this error:
import matplotlib as mpl
ModuleNotFoundError: No module named 'matplotlib'
I've tried searching different sources for the solution but I am now stuck.
You are mostly running your python script with the command python your_file.py, try running as python3 your_file.py in your terminal. pip3 installs packages under python3, not the default python2.
This is because I believe your mac terminal uses python 2.x by default, therefore the command python uses python 2.x version and python3 uses 3.x version that is available to execute the files. So if you want to install any packages under python 2.x you use pip as the command and to install packages under python 3.x you use pip3 as the command

from google.cloud import language ModuleNotFoundError: No module named 'google.cloud'

I had a code that I was able to run last year using Google Cloud Natural Language. I am not able to this year due to a library problem. I used the following methods to install it. However, not successful. How should install it?
[jalal#goku sentiment]$ pip install --user --upgrade google-cloud
Collecting google-cloud
Downloading https://files.pythonhosted.org/packages/ba/b1/7c54d1950e7808df06642274e677dbcedba57f75307adf2e5ad8d39e5e0e/google_cloud-0.34.0-py2.py3-none-any.whl
Installing collected packages: google-cloud
Successfully installed google-cloud-0.34.0
[jalal#goku sentiment]$ python sentiment.py
Traceback (most recent call last):
File "sentiment.py", line 20, in <module>
from google.cloud import language
ModuleNotFoundError: No module named 'google.cloud'
[jalal#goku sentiment]$ python -m pip install google-cloud
Requirement already satisfied: google-cloud in /home/grad3/jalal/.local/lib/python3.6/site-packages (0.34.0)
The error is:
$ python sentiment.py
Traceback (most recent call last):
File "sentiment.py", line 20, in <module>
from google.cloud import language
ModuleNotFoundError: No module named 'google.cloud'
A little about my system setup:
$ which python
/scratch/sjn-p3/anaconda/anaconda3/bin/python
$ python
Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.6.1810 (Core)
Release: 7.6.1810
Codename: Core
Also, I find it very weird when I am installing the pip package with Anacoda pip why does it install it into native Python and not Anaconda Python?
$ /scratch/sjn-p3/anaconda/anaconda3/bin/pip install --user --upgrade google-cloud
Requirement already up-to-date: google-cloud in /home/grad3/jalal/.local/lib/python3.6/site-packages (0.34.0)
The issue is you are using the --user flag and pip but wish to run the Anaconda distribution of Python.
If you do python -c 'import site; print(site.USER_BASE)' from the CLI it will return /home/grad3/jalal/.local hence why packages are installed there when you pass the --user flag to pip. Since you want to use the Anaconda distribution you should stay consistent and use their version of a package manager, which would be conda in this case, which you can find about more --> here.
However, I highly recommend using virtual environments so that this issue can be avoided in the future. You can find out more about Anaconda virtual environments over --> here.
If you wish to keep using pip along with Anaconda you can modify your target directory in the ~/.pip/pip.conf file to point at the location you want. Probably something along these lines will work:
[global]
target=/scratch/sjn-p3/anaconda/anaconda3/lib/python{version}/site-packages
Solved the problem by the following command. You have to install the specific product from the Google Cloud (in this case Natural Language):
$ pip install --user --upgrade google-cloud-language
Collecting google-cloud-language
Using cached https://files.pythonhosted.org/packages/b1/3a/6f5808421aea97363cb19a095f73ed6eed12bbaee1e67f2145af7125585d/google_cloud_language-1.1.1-py2.py3-none-any.whl
Collecting google-api-core[grpc]<2.0.0dev,>=1.6.0 (from google-cloud-language)
Using cached https://files.pythonhosted.org/packages/7d/73/e4877e921fe59307ec6b1b0b0c2ad9fde2d1c6bab8dd06ec913891a20dc6/google_api_core-1.8.2-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: protobuf>=3.4.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (3.6.1)
Requirement already satisfied, skipping upgrade: pytz in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (2017.3)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (1.11.0)
Requirement already satisfied, skipping upgrade: requests<3.0.0dev,>=2.18.0 in /home/grad3/jalal/.local/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (2.21.0)
Collecting google-auth<2.0dev,>=0.4.0 (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Using cached https://files.pythonhosted.org/packages/c5/9b/ed0516cc1f7609fb0217e3057ff4f0f9f3e3ce79a369c6af4a6c5ca25664/google_auth-1.6.3-py2.py3-none-any.whl
Collecting googleapis-common-protos!=1.5.4,<2.0dev,>=1.5.3 (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Requirement already satisfied, skipping upgrade: setuptools>=34.0.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (38.4.0)
Requirement already satisfied, skipping upgrade: grpcio>=1.8.2; extra == "grpc" in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (1.15.0)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (2.6)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (1.22)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (2018.10.15)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language) (3.0.4)
Collecting pyasn1-modules>=0.2.1 (from google-auth<2.0dev,>=0.4.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Using cached https://files.pythonhosted.org/packages/da/98/8ddd9fa4d84065926832bcf2255a2b69f1d03330aa4d1c49cc7317ac888e/pyasn1_modules-0.2.4-py2.py3-none-any.whl
Collecting cachetools>=2.0.0 (from google-auth<2.0dev,>=0.4.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Using cached https://files.pythonhosted.org/packages/39/2b/d87fc2369242bd743883232c463f28205902b8579cb68dcf5b11eee1652f/cachetools-3.1.0-py2.py3-none-any.whl
Collecting rsa>=3.1.4 (from google-auth<2.0dev,>=0.4.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Using cached https://files.pythonhosted.org/packages/02/e5/38518af393f7c214357079ce67a317307936896e961e35450b70fad2a9cf/rsa-4.0-py2.py3-none-any.whl
Collecting pyasn1<0.5.0,>=0.4.1 (from pyasn1-modules>=0.2.1->google-auth<2.0dev,>=0.4.0->google-api-core[grpc]<2.0.0dev,>=1.6.0->google-cloud-language)
Using cached https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-any.whl
Installing collected packages: pyasn1, pyasn1-modules, cachetools, rsa, google-auth, googleapis-common-protos, google-api-core, google-cloud-language
The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/grad3/jalal/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed cachetools-3.1.0 google-api-core-1.8.2 google-auth-1.6.3 google-cloud-language-1.1.1 googleapis-common-protos-1.5.9 pyasn1-0.4.5 pyasn1-modules-0.2.4 rsa-4.0
$ vi ~/.bashrc
Added this line to the end of my ~/.bashrc (or whatever it is told to you):
export PATH=/home/grad3/jalal/.local/bin:$PATH
$ source ~/.bashrc

Python cannot find flask package which is installed

When I run my flask project on my server, I get the following error:
Traceback (most recent call last):
File "File.py", line 1, in <module>
from flask import Flask, request
ImportError: No module named 'flask'
But I have flask installed!
$sudo pip install flask
Requirement already satisfied: flask in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/lib/python2.7/dist-packages (from flask)
Requirement already satisfied: click>=2.0 in /usr/local/lib/python2.7/dist-packages (from flask)
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from flask)
Requirement already satisfied: Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from flask)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/dist-packages (from Jinja2>=2.4->flask)
This is driving me crazy. I've tried what other SO answers have suggested, including using a venv, but they all produce this same error. Anyone have a suggestion?
$ which python
/usr/bin/python
$ which python3
/usr/bin/python3
I'm running python 3.5.2
I'm running python 3.5.2
As the text says, Flask is not installed there.
Requirement already satisfied: flask in /usr/local/lib/python2.7/dist-packages
This folder is also the system Python, not the virtualenv, if you are using one. You can set virtualenv to use the system installed packages, but again, that path is not Python3.
The root issue is that using sudo executed pip under a different user account
Either use Python2, or install using pip3 or python3 -m pip and you shouldn't need sudo

Categories

Resources