How to delete all packages from my ubuntu terminal in windows 10? - linux

I have all these packages and I would like to remove them (removing pip and apache-airflow is my priority)
alembic 1.8.1
anyio 3.6.2
apache-airflow 2.4.2
apache-airflow-providers-common-sql 1.2.0
apache-airflow-providers-ftp 3.1.0
apache-airflow-providers-http 4.0.0
apache-airflow-providers-imap 3.0.0
apache-airflow-providers-sqlite 3.2.1
apispec 3.3.2
argcomplete 2.0.0
attrs 22.1.0
Babel 2.11.0
blinker 1.4
cachelib 0.9.0
cattrs 22.2.0
certifi 2022.9.24
charset-normalizer 2.1.1
pendulum 2.1.2
pip 22.0.2
pluggy 1.0.0
prison 0.2.1
psutil 5.9.4
Pygments 2.13.0
PyGObject 3.42.1
PyJWT 2.3.0
pyparsing 2.4.7
pyrsistent 0.19.2
python-apt 2.3.0+ubuntu2.1
python-daemon 2.3.2
python-dateutil 2.8.2
python-nvd3 0.15.0
python-slugify 6.1.2
pytz 2022.6
pytzdata 2020.1
PyYAML 5.4.1
requests 2.28.1
requests-toolbelt 0.10.1
rfc3986 1.5.0
uc-micro-py 1.0.1
ufw 0.36.1
Download ubuntu console for windows 10 and install pip and apache airflow without creating an environment (my mistake)
I run pip freeze --user | xargs pip uninstall -y to remove all and I get this error:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/shutil.py", line 815, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/alembic' -> '/tmp/pip-uninstall- lj7qg0bv/alembic'

If you're sure you really need to uninstall packages installed under /usr/local/ use superuser privileges:
pip freeze --user | xargs sudo pip uninstall -y

Related

Python3 flask ModuleNotFoundError: No module named 'blurhash' error

I am new to Python. Recently, I am using Python 3.9.12 and Flask 2.1.2 to work on a project. When I run flask run, it throw me an error: ModuleNotFoundError: No module named 'blurhash'.However I have installed blurhash by pip3 install blurhash. When I do pip3 list, it shows:
Package Version
------------------ ---------
blurhash 1.1.4
certifi 2021.10.8
cffi 1.15.0
click 8.1.3
distlib 0.3.4
filelock 3.6.0
Flask 2.1.2
importlib-metadata 4.11.3
itsdangerous 2.1.2
Jinja2 3.1.2
MarkupSafe 2.1.1
Pillow 9.1.0
pip 22.0.4
pipenv 2022.5.2
platformdirs 2.5.2
pycparser 2.21
setuptools 60.10.0
six 1.16.0
virtualenv 20.14.1
virtualenv-clone 0.5.7
Werkzeug 2.1.2
wheel 0.37.1
zipp 3.8.0
Any ideas about this? Many Thanks!

Install Tensorflow 2.2 on linux

I have GNU/Linux box, I am trying to install Tensorflow 2.2. Currently I have
python3.6 --version
Python 3.6.12
and when I try to run my code it says
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`
So when I try to install Tensorflow 2.2
sudo pip-3.6 install --upgrade tensorflow==2.2.0
Collecting tensorflow==2.2.0
Could not find a version that satisfies the requirement tensorflow==2.2.0 (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow==2.2.0
I get the above error. Any idea how to fix this issue?
Update:
sudo pip-3.6 --version
pip 9.0.3 from /usr/lib/python3.6/dist-packages (python 3.6)
-Raj
Starting with Tensorflow 2.0 Google stopped providing manylinux1 wheels and switched to manylinux2010 which is probably not recognized by your pip because it's too old. Try to upgrade: sudo pip-3.6 install -U pip, then verify sudo pip-3.6 --version and retry sudo pip-3.6 install -U tensorflow==2.2.0
TensorFlow 2 packages require a pip version >19.0.
https://www.tensorflow.org/install

Importing the numpy c-extensions failed in MacOS

Importing the numpy c-extensions failed
I am trying to use numpy in terminal, when i imported it it returned an error.But whe I import numpy in pytharm Python Console,it worked well.I have python 2.7.10 and 3.7.5,python 3.7.5 was used in pytharm. I uninstalled numpy on all versions of python and reinstalled it on python 3.7.5 only, but it returned the same error. I reinstall packages via the command line by entering:
python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
but it returned the same error too.I guess it's a multi-environment problem.
Tried uninstall and install numpy and setuptools like this:
pip uninstall -y numpy
pip uninstall -y setuptools
pip install setuptools
pip install numpy
but it returned the same error too.
My python3 pip list:
absl-py 0.9.0
aiodns 2.0.0
aiohttp 3.5.4
appnope 0.1.0
astor 0.8.1
async-timeout 3.0.1
attrs 19.1.0
backcall 0.1.0
beautifulsoup4 4.5.3
bleach 3.1.0
browsermob-proxy 0.8.0
bs4 0.0.1
cchardet 2.1.4
certifi 2019.3.9
cffi 1.12.3
chardet 3.0.4
cssselect 1.0.3
cycler 0.10.0
decorator 4.4.1
defusedxml 0.6.0
entrypoints 0.3
fake-useragent 0.1.11
gast 0.3.2
google-pasta 0.1.8
grpcio 1.26.0
h5py 2.10.0
idna 2.6
importlib-metadata 1.3.0
ipykernel 5.1.3
ipython 5.4.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.15.2
Jinja2 2.10.3
joblib 0.14.1
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 5.3.4
jupyter-console 5.2.0
jupyter-core 4.6.1
Keras 2.2.4
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
lxml 4.3.3
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.2
mistune 0.8.4
more-itertools 8.0.2
mpmath 1.1.0
multidict 4.5.2
nbconvert 5.6.1
nbformat 4.4.0
nose 1.3.7
notebook 6.0.2
ntplib 0.3.3
numpy 1.17.4
opencv-python 4.1.2.30
pandas 0.25.3
pandocfilters 1.4.2
parso 0.5.2
pexpect 4.7.0
pickleshare 0.7.5
Pillow 6.2.1
pip 19.3.1
prometheus-client 0.7.1
prompt-toolkit 1.0.18
protobuf 3.11.2
ptyprocess 0.6.0
pycares 3.0.0
pycparser 2.19
pycrypto 2.6.1
Pygments 2.5.2
PyMySQL 0.9.3
pyparsing 2.4.5
pyquery 1.4.0
pyrsistent 0.15.6
python-dateutil 2.8.1
pytz 2019.3
PyYAML 5.2
pyzmq 18.1.1
qtconsole 4.6.0
redis 3.3.11
requests 2.18.4
scikit-learn 0.22
scipy 1.4.1
selenium 3.11.0
Send2Trash 1.5.0
setuptools 42.0.2
simplegeneric 0.8.1
six 1.13.0
sklearn 0.0
soupsieve 1.9.1
splinter 0.13.0
sympy 1.5
tensorboard 1.14.0
tensorflow 1.14.0
tensorflow-estimator 1.14.0
termcolor 1.1.0
terminado 0.8.3
testpath 0.4.4
tornado 6.0.3
traitlets 4.3.3
urllib3 1.22
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
widgetsnbextension 3.5.1
wrapcache 1.0.8
wrapt 1.11.1
xvfbwrapper 0.2.9
yarl 1.3.0
zipp 0.6.0
How can I solve this problem?
Reproducing code example:
import numpy
Error message:
Blockquote
Python 3.7.5 (default, Nov 1 2019, 02:16:32) [Clang 11.0.0
(clang-1100.0.33.8)] on darwin Type "help", "copyright", "credits" or
"license" for more information.
import numpy Traceback (most recent call last): File "/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/init.py",
line 17, in
from . import multiarray File "/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/multiarray.py",
line 14, in
from . import overrides File "/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/overrides.py",
line 7, in
from numpy.core._multiarray_umath import ( ImportError: dlopen(/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so,
2): Symbol not found: ___addtf3 Referenced from:
/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/../.dylibs/libquadmath.0.dylib Expected in: /usr/lib/libSystem.B.dylib in
/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/../.dylibs/libquadmath.0.dylib
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in
File
"/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/init.py",
line 142, in
from . import core File "/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/init.py",
line 47, in
raise ImportError(msg) ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "/usr/local/opt/python/bin/python3.7",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.17.4" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
If you're working with a numpy git repository, try git clean -xdf (removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was:
dlopen(/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so,
2): Symbol not found: ___addtf3 Referenced from:
/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/../.dylibs/libquadmath.0.dylib Expected in: /usr/lib/libSystem.B.dylib in
/Users/chuck/Library/Python/3.7/lib/python/site-packages/numpy/core/../.dylibs/libquadmath.0.dylib
I solved this issue like this:
bogon:bin chuck$ brew unlink python3
Unlinking /usr/local/Cellar/python/3.7.5... 0 symlinks removed
bogon:bin chuck$ brew link python3
Linking /usr/local/Cellar/python/3.7.5...
Error: Could not symlink bin/easy_install-3.7
Target /usr/local/bin/easy_install-3.7
already exists. You may want to remove it:
rm '/usr/local/bin/easy_install-3.7'
To force the link and overwrite all conflicting files:
brew link --overwrite python
To list all files that would be deleted:
brew link --overwrite --dry-run python
bogon:bin chuck$ brew link --overwrite python3
Linking /usr/local/Cellar/python/3.7.5... 24 symlinks created

pip install in virtualenv on EC2 missing packages in requirements.txt file on install

I am pip installing a variety of packages inside a virtual environment on an EC2 instance (2018-03). Pip successfully installs some of the packages, but not all. I am using pip install --force-reinstall -r requirements.txt on the following requirements file, which was created on a system with a working instance with Python 3.7.4 on Macos:
alembic==1.1.0
bcrypt==3.1.7
boto3==1.9.156
botocore==1.12.249
certifi==2019.9.11
cffi==1.12.3
chardet==3.0.4
Click==7.0
coverage==4.5.4
docutils==0.15.2
Flask==1.0.2
Flask-Bcrypt==0.7.1
Flask-Login==0.4.1
Flask-Migrate==2.5.2
Flask-Script==2.0.6
Flask-Session==0.3.1
Flask-SQLAlchemy==2.4.0
Flask-WTF==0.14.2
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.1
jmespath==0.9.4
lxml==4.3.2
Mako==1.1.0
MarkupSafe==1.1.1
numpy==1.16.2
pandas==0.24.2
patsy==0.5.1
psycopg2==2.8.3
pycparser==2.19
python-dateutil==2.8.0
python-editor==1.0.4
pytz==2019.2
requests==2.21.0
s3transfer==0.2.1
scikit-learn==0.20.3
scipy==1.2.1
six==1.12.0
SQLAlchemy==1.3.8
statsmodels==0.9.0
trimesh==3.1.11
urllib3==1.24.3
Werkzeug==0.15.5
WTForms==2.2.1
And pip gives me the following message:
Successfully installed Click-7.0 Flask-1.0.2 Flask-Bcrypt-0.7.1 Flask-Login-0.4.1 Flask-Migrate-2.5.2 Flask-SQLAlchemy-2.4.0 Flask-Script-2.0.6 Flask-Session-0.3.1 Flask-WTF-0.14.2 Jinja2-2.10.1 Mako-1.1.0 MarkupSafe-1.1.1 SQLAlchemy-1.3.8 WTForms-2.2.1 Werkzeug-0.15.5 alembic-1.1.0 bcrypt-3.1.7 boto3-1.9.156 botocore-1.12.249 certifi-2019.9.11 cffi-1.12.3 chardet-3.0.4 coverage-4.5.4 docutils-0.15.2 idna-2.8 itsdangerous-1.1.0 jmespath-0.9.4 lxml-4.3.2 numpy-1.16.2 pandas-0.24.2 patsy-0.5.1 psycopg2-2.8.3 pycparser-2.19 python-dateutil-2.8.0 python-editor-1.0.4 pytz-2019.2 requests-2.21.0 s3transfer-0.2.1 scikit-learn-0.20.3 scipy-1.2.1 six-1.12.0 statsmodels-0.9.0 trimesh-3.1.11 urllib3-1.24.3
However when I do a pip list I only see the following packages installed. Note that coverage and psycopg2, for example, were listed as successfully installed, but don't show. Consequently, a quick python -c "import coverage" will fail.
Package Version
---------------- ---------
alembic 1.1.0
boto3 1.9.156
botocore 1.12.249
certifi 2019.9.11
chardet 3.0.4
Click 7.0
docutils 0.15.2
Flask 1.0.2
Flask-Bcrypt 0.7.1
Flask-Login 0.4.1
Flask-Migrate 2.5.2
Flask-Script 2.0.6
Flask-Session 0.3.1
Flask-SQLAlchemy 2.4.0
Flask-WTF 0.14.2
idna 2.8
itsdangerous 1.1.0
Jinja2 2.10.1
jmespath 0.9.4
Mako 1.1.0
patsy 0.5.1
pip 19.3.1
pycparser 2.19
python-dateutil 2.8.0
python-editor 1.0.4
pytz 2019.2
requests 2.21.0
s3transfer 0.2.1
setuptools 41.6.0
six 1.12.0
trimesh 3.1.11
urllib3 1.24.3
Werkzeug 0.15.5
wheel 0.33.6
WTForms 2.2.1
My questions are:
Are there ways to resolve with pip options other than --force-reinstall and --no-cache-dir, which I have already tried?
Could my issue relate to the fact that the latest supported package of Python I can grab on EC2 is 3.6.8, but my requirements.txt file was created on a 3.7.4 system? (Yes yes, I know, next time I'll be wiser and just use docker from the start.)
After much hand-wringing and nearly doing Docker bootcamp, I decided to go back for another round and found the underlying problem. Inside my virtual environment, I noticed that pip list was only listing packages as listed in the $MYENV/lib/Python3.6/data/dist-packages, whereas the offending packages were all located in $MYENV/lib64/Python3.6/data/dist-packages. This led to some additional searching and this response, which suggests symlinking the lib64 version of dist-packages to the lib version, which did the trick and resolved my issue. I'm using pip version 19.3.1, and the referenced article is from over 2 years ago, so I will definitely be talking to some folks.
However, for those who want the quick solution, here are the steps.
Fresh virtual environment: Set up a fresh virtual environment as you normally would.
Symlink BEFORE pip: Do your symlinking before you start installing any packages. Generally this will look something like:
ln -s $YOURENV/lib/Python3.x/data/dist-packages $YOURENV/lib64/Python3.x/data/dist-packages
Go ahead and pip: No you can pip install -r requirements.txt as you normally would. Double-check with a pip list and you should see all your packages listed.

ImportError after Successful Installing Packages in Conda Environment

I installed python-3.5 on Ubuntu 16.04.3 and planned to have python-3.6 as well with conda environment. For the conda enviornment with python-3.6, I named it as py36. However, though I installed package a package in (py36) environment, python complained that there was no such module. Why was python confused?
Below is the code I ran:
$conda create --name py36 python=3.6
$ source activate py36
(py36) xxx#Alienware:~/crawler$ conda install --name py36 -c anaconda cached-pro
(py36) xxx#Alienware:~/crawler$ conda list -n py36
# packages in environment at /home/xxx/anaconda3/envs/py36:
#
ca-certificates 2018.03.07 0
cached-property 1.5.1 <pip>
cached-property 1.5.1 py36_0 anaconda
certifi 2018.11.29 py36_0
libedit 3.1.20170329 h6b74fdf_2
libffi 3.2.1 hd88cf55_4
libgcc-ng 8.2.0 hdf63c60_1
libstdcxx-ng 8.2.0 hdf63c60_1
ncurses 6.1 he6710b0_1
openssl 1.1.1a h7b6447c_0
pip 18.1 py36_0
python 3.6.7 h0371630_0
readline 7.0 h7b6447c_5
scrapy 1.5.1 py36_0
setuptools 40.6.3 py36_0
sqlite 3.26.0 h7b6447c_0
tk 8.6.8 hbc83047_0
wheel 0.32.3 py36_0
xz 5.2.4 h14c3975_4
zlib 1.2.11 h7b6447c_3
(py36) xxx#Alienware:~/crawler$ scrapy crawl transcripts --logfile output.log
Yet I got the following output. But I just checked that cached_property was installed in my environment. What did I miss here?
ImportError: No module named 'cached_property'

Resources