Installing dropbox fails and corrupts pip3 - python-3.x

I'm running Python 3.4.2 on Raspbian Jessie on a Pi3
pip3 works just fine until I try this:
sudo pip3 install dropbox
Which yields:
Downloading/unpacking dropbox
Requirement already satisfied (use --upgrade to upgrade): urllib3 in /usr/lib/python3/dist-packages (from dropbox)
Requirement already satisfied (use --upgrade to upgrade): six>=1.3.0 in /usr/lib/python3/dist-packages (from dropbox)
Downloading/unpacking requests>=2.5.1,!=2.6.1 (from dropbox)
Downloading/unpacking idna>=2.5,<2.6 (from requests>=2.5.1,!=2.6.1->dropbox)
Downloading/unpacking certifi>=2017.4.17 (from requests>=2.5.1,!=2.6.1->dropbox)
Downloading/unpacking chardet>=3.0.2,<3.1.0 (from requests>=2.5.1,!=2.6.1->dropbox)
Installing collected packages: dropbox, requests, idna, certifi, chardet
Found existing installation: requests 2.4.3
Not uninstalling requests at /usr/lib/python3/dist-packages, owned by OS
Found existing installation: chardet 2.3.0
Not uninstalling chardet at /usr/lib/python3/dist-packages, owned by OS
Successfully installed dropbox requests idna certifi chardet
Cleaning up...
After which, pip3 (but not pip) is now corrupt and simply running:
sudo pip3
gives the following error message:
/usr/local/lib/python3.4/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.9.1) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python3/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 90, in <module>
from urllib3.exceptions import DependencyWarning
ImportError: cannot import name 'DependencyWarning'
I've installed a lot of other packages from source including ffmpeg, gstreamer 1.10.5, opencv 3.2.0, so I suspect that process is at fault, but only trying to install dropbox using pip3 corrupts pip3.
Any help in solving this would be appreciated.

#mdasari Thanks a ton for your help. I'm running Python 3.4.2, so I used easy_install3 to remove and reinstall pip as you suggested. This time dropbox appears to have installed correctly (haven't tested it yet), but pip3 is once again corrupted and giving me the same error as before. However, after rebooting, the error went away and pip3 appears to be fine. For others, this is exactly what I did to correct the problem (once again, I'm using Python 3.4.2):
sudo apt-get remove python-pip
sudo apt-get autoremove
sudo easy_install3 -U pip
sudo pip3 install dropbox
reboot

I think the problem is with pip, not dropbox. Did you try uninstalling current version pip and reinstall it?
apt-get remove python-pip
easy_install-3.5 -U pip
You can look at previous issues here and here

Related

Unable to run NanoPlot due to import error from Scipy

I am new to python and I'm trying to run NanoPlot 1.40.0 on my Ubuntu 20.04.4 LTS.
When I try to run NanoPlot I receive this error:
Traceback (most recent call last):
File "/home/grid/.local/bin/NanoPlot", line 5, in <module>
from nanoplot.NanoPlot import main
File "/home/grid/.local/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 18, in <module>
from scipy import stats
File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 119, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "/usr/lib/python3/dist-packages/scipy/_lib/_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c' from 'scipy._lib' (/usr/lib/python3/dist-packages/scipy/_lib/__init__.py)
Some background info; there was an initial Python2.7 and I upgraded to the python3.7 version - made this my default. Scipy was installed using sudo apt-get install python3-scipy. The version is Scipy 1.3.3
When I installed NanoPlot, it was done using pip and not pip3 with the pip install NanoPlot and then pip install NanoPlot --upgrade
After installation, I got this message
Script nanoplot is installed in home/grid/.local/bin which is not on
PATH.
So I then edited the path using nano ~/.bashrc to include home/grid/.local/bin and executed using source ~/.bashrc I checked $PATH to verify the change and the directory was added. But I always receive the callback error. I uninstalled Scipy, reinstalled it, didn't work. Did all the updates, didn't work.
Any help on how I can rectify this callback error would be really appreciated. Thank you in advance for your time!
UPDATE: RESOLVED!
I uninstalled scipy using sudo apt-get autoremove python3-scipy
Also did a purge to check if any config files remained sudo apt-get purge python3-scipy
Reinstalled scipy using pip3 install --user scipy
Did an update sudo apt-get update
Uninstalled Nanoplot pip3 uninstall NanoPlot
Installed it back pip3 install NanoPlot
Did an upgrade pip3 install NanoPlot --upgrade
Tested a code NanoPlot -h
Worked!

unable to install matplotlib with python3 on m1 mac using pip3

I'm unable to install matplotlib through pip on my M1 Mac. I have Python 3.9.1 installed through Homebrew. I've tried the solution here: Pip install matplotlib fails on M1 Mac but it does not work for me.
I get this long error:
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): no suitable image found. Did find:
/opt/homebrew/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture
/opt/homebrew/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-mrz7uc56/matplotlib_20151701613b4e6fb6955488fa89e81e/setup.py", line 256, in <module>
setup( # Finally, pass this all along to distutils to do the heavy lifting.
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 299, in run
self.find_sources()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 306, in find_sources
mm.run()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 541, in run
self.add_defaults()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 577, in add_defaults
sdist.add_defaults(self)
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 228, in add_defaults
self._add_defaults_ext()
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/opt/homebrew/Cellar/python#3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/private/tmp/pip-install-mrz7uc56/matplotlib_20151701613b4e6fb6955488fa89e81e/setup.py", line 88, in finalize_options
self.distribution.ext_modules[:] = [
File "/private/tmp/pip-install-mrz7uc56/matplotlib_20151701613b4e6fb6955488fa89e81e/setup.py", line 91, in <listcomp>
for ext in package.get_extensions()
File "/private/tmp/pip-install-mrz7uc56/matplotlib_20151701613b4e6fb6955488fa89e81e/setupext.py", line 345, in get_extensions
add_numpy_flags(ext)
File "/private/tmp/pip-install-mrz7uc56/matplotlib_20151701613b4e6fb6955488fa89e81e/setupext.py", line 468, in add_numpy_flags
import numpy as np
File "/opt/homebrew/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module>
from . import core
File "/opt/homebrew/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
I am able to import matplotlib with python 2.7 on my Rosetta Terminal but I am trying to use matplotlib with python3 instead.
Any help would be appreciated!
November 2021 Update
Just run the following command:
$ pip3 install matplotlib
Worked on Mac mini (M1, 2020), Monterey 12.0.1. Python 3.9.7
Feb 2021 Answer Below
In order to install matplotlib with pip3 on an M1 mac, you first need to install the dependencies Cython, numpy and Pillow from source. The following method worked for me.
Install Cython
pip3 install Cython
Install numpy
$ git clone https://github.com/numpy/numpy.git
$ cd numpy
$ pip3 install . --no-binary :all: --no-use-pep517
Install Pillow
libjpeg is necessary for Pillow so you might want to install it via brew.
$ brew install libjpeg
$ git clone https://github.com/python-pillow/Pillow.git
$ cd Pillow
$ pip3 install . --no-binary :all: --no-use-pep517
Install matplotlib
$ git clone https://github.com/matplotlib/matplotlib.git
Then you need to manually download qhull and extract the archive. (http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz on Qhull Downloads)
You will get a folder named qhull-2020.2. You then have to place the folder at matplotlib/build. The build folder may not exist so you might have to create it.
Lastly, the following command will install the matplotlib on your M1 mac.
$ cd matplotlib
$ pip3 install . --no-binary :all:
Tested for Python 3.9.1 on non-Rosetta terminal on M1 Mac mini (Big Sur 11.2.1).
I solved this by just uninstalling homebrew first and downloaded matplotlib with python3. After that i reinstalled homebrew using non-rosetta terminal. Idk how it works cause im very new to these stuff but what works works i guess.
I solved this by realizing that I had two seperate Python instances installed. When you run which python3 you get the path of your Python installation. Check to see if the path corresponds to the Python version you installed.
I fixed it by uninstalling the version of Python3 I had installed with homebrew with brew uninstall python3.
When I did which python3 again it showed a different Python installation path. I then did pip3 install Matplotlib and I was able to import Matplotlib.
1. Uninstall Following Package
pip uninstall pillow
pip uninstall numpy
pip uninstall wordcloud
pip uninstall matplotlib
pip uninstall pyparsing
pip uninstall kiwisolver
pip uninstall python-dateutil
pip uninstall cycler
pip uninstall packaging
pip uninstall fonttools
pip uninstall contourpy
pip uninstall six
2. Install matplotlib
pip install matplotlib
I originally installed python 3.9 using homebrew, but my matplotlib problem was fixed by uninstalling python and reinstalling using the download from the python website(because of architecture problems).
I found another nice way with pyenv,miniforge and conda.
pyenv install miniforge3-4.10
conda create -n env_new python=3.9
conda activate env_new
conda install poetry
peotry new project
poetry add matplotlib
Maybe it is not perfect, but it works for a variety of moduls and you can even choose python=3.8 and other python versions and everything is running on the M1.

pip3 install not working - No module named 'pip._vendor.pkg_resources'

When trying to install a package for Python 3 (in Ubuntu), using pip3 install packageName (or sudo pip3 install packageName), I get the following error message:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.pkg_resources'
I have been reading for days and have tried the following WITHOUT any success:
Un-installing and re-installing pip3 using the following code: sudo apt-get remove python3-pip followed by sudo apt-get install python3-pip. This was suggested in several posts that say that sometimes pip3 doesn't install properly for Ubuntu. However, it didn't work.
Other post suggested it was an ssl package problem and that if the ssl package doesn't load on Python3, that's the issue. However the following command does not raise any error: python3 -c "import ssl".
Some other post suggested the problem was with the requests package. I then tried sudo apt-get remove python3-requests followed by sudo apt-get install python3-requests also to no avail.
Other information you may need:
pip3 --version gives me the same error reported above.
dpkg -L python3-pip gives me the following information:
/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/requires.txt
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/pip-8.1.1.egg-info/top_level.txt
/usr/lib/python3/dist-packages/pip
/usr/lib/python3/dist-packages/pip/baseparser.py
/usr/lib/python3/dist-packages/pip/__main__.py
/usr/lib/python3/dist-packages/pip/req
/usr/lib/python3/dist-packages/pip/req/req_set.py
/usr/lib/python3/dist-packages/pip/req/req_install.py
/usr/lib/python3/dist-packages/pip/req/__init__.py
/usr/lib/python3/dist-packages/pip/req/req_file.py
/usr/lib/python3/dist-packages/pip/req/req_uninstall.py
/usr/lib/python3/dist-packages/pip/index.py
/usr/lib/python3/dist-packages/pip/status_codes.py
/usr/lib/python3/dist-packages/pip/utils
/usr/lib/python3/dist-packages/pip/utils/setuptools_build.py
/usr/lib/python3/dist-packages/pip/utils/appdirs.py
/usr/lib/python3/dist-packages/pip/utils/outdated.py
/usr/lib/python3/dist-packages/pip/utils/ui.py
/usr/lib/python3/dist-packages/pip/utils/logging.py
/usr/lib/python3/dist-packages/pip/utils/encoding.py
/usr/lib/python3/dist-packages/pip/utils/deprecation.py
/usr/lib/python3/dist-packages/pip/utils/__init__.py
/usr/lib/python3/dist-packages/pip/utils/filesystem.py
/usr/lib/python3/dist-packages/pip/utils/hashes.py
/usr/lib/python3/dist-packages/pip/utils/build.py
/usr/lib/python3/dist-packages/pip/compat
/usr/lib/python3/dist-packages/pip/compat/dictconfig.py
/usr/lib/python3/dist-packages/pip/compat/__init__.py
/usr/lib/python3/dist-packages/pip/compat/ordereddict.py
/usr/lib/python3/dist-packages/pip/models
/usr/lib/python3/dist-packages/pip/models/index.py
/usr/lib/python3/dist-packages/pip/models/__init__.py
/usr/lib/python3/dist-packages/pip/vcs
/usr/lib/python3/dist-packages/pip/vcs/bazaar.py
/usr/lib/python3/dist-packages/pip/vcs/subversion.py
/usr/lib/python3/dist-packages/pip/vcs/mercurial.py
/usr/lib/python3/dist-packages/pip/vcs/__init__.py
/usr/lib/python3/dist-packages/pip/vcs/git.py
/usr/lib/python3/dist-packages/pip/cmdoptions.py
/usr/lib/python3/dist-packages/pip/basecommand.py
/usr/lib/python3/dist-packages/pip/commands
/usr/lib/python3/dist-packages/pip/commands/completion.py
/usr/lib/python3/dist-packages/pip/commands/install.py
/usr/lib/python3/dist-packages/pip/commands/hash.py
/usr/lib/python3/dist-packages/pip/commands/uninstall.py
/usr/lib/python3/dist-packages/pip/commands/__init__.py
/usr/lib/python3/dist-packages/pip/commands/list.py
/usr/lib/python3/dist-packages/pip/commands/search.py
/usr/lib/python3/dist-packages/pip/commands/show.py
/usr/lib/python3/dist-packages/pip/commands/download.py
/usr/lib/python3/dist-packages/pip/commands/wheel.py
/usr/lib/python3/dist-packages/pip/commands/freeze.py
/usr/lib/python3/dist-packages/pip/commands/help.py
/usr/lib/python3/dist-packages/pip/_vendor
/usr/lib/python3/dist-packages/pip/_vendor/__init__.py
/usr/lib/python3/dist-packages/pip/operations
/usr/lib/python3/dist-packages/pip/operations/__init__.py
/usr/lib/python3/dist-packages/pip/operations/freeze.py
/usr/lib/python3/dist-packages/pip/__init__.py
/usr/lib/python3/dist-packages/pip/locations.py
/usr/lib/python3/dist-packages/pip/pep425tags.py
/usr/lib/python3/dist-packages/pip/exceptions.py
/usr/lib/python3/dist-packages/pip/download.py
/usr/lib/python3/dist-packages/pip/wheel.py
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pip3.1.gz
/usr/share/doc
/usr/share/doc/python3-pip
/usr/share/doc/python3-pip/copyright
/usr/bin
/usr/bin/pip3
/usr/share/doc/python3-pip/changelog.Debian.gz
How can I make pip3 work?
NOTE: pip for Python2 works just fine.
================================================
EDIT:
When trying to import setuptools in Python3 I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/lib/python3/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
#_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
callback(dist)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
declare_namespace(pkg)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
When running the following command sed -n '31,37p' < /usr/lib/python3/dist-packages/pip/_vendor/__init__.py in the terminal, I get the following:
try:
__import__(vendored_name, globals(), locals(), level=0)
except ImportError:
try:
__import__(modulename, globals(), locals(), level=0)
except ImportError:
===========================================
EDIT2:
My python3 --version is Python 3.5.2.
List of installed packages obtained running the code ls /usr/lib/python3/dist-packages.
apport
apport_python_hook.py
apt
aptdaemon
apt_inst.cpython-35m-x86_64-linux-gnu.so
apt_pkg.cpython-35m-x86_64-linux-gnu.so
aptsources
AptUrl
apturl-0.5.2.egg-info
beautifulsoup4-4.4.1.egg-info
blinker
blinker-1.3.egg-info
Brlapi-0.6.4.egg-info
brlapi.cpython-35m-x86_64-linux-gnu.so
bs4
cairo
_cffi_backend.cpython-35m-x86_64-linux-gnu.so
chardet
chardet-2.3.0.egg-info
checkbox_support
checkbox_support-0.22.egg-info
CommandNotFound
command_not_found-0.3.egg-info
cryptography
cryptography-1.2.3.egg-info
cups.cpython-35m-x86_64-linux-gnu.so
cupsext.cpython-35m-x86_64-linux-gnu.so
curl
cycler-0.9.0.egg-info
cycler.py
dateutil
dbus
_dbus_bindings.cpython-35m-x86_64-linux-gnu.so
_dbus_glib_bindings.cpython-35m-x86_64-linux-gnu.so
deb822.py
debconf.py
debian
debian_bundle
decorator-4.0.6.egg-info
decorator.py
defer
defer-1.0.6.egg-info
DistUpgrade
easy_install.py
feedparser-5.1.3.egg-info
feedparser.py
feedparser_sgmllib3.py
gi
guacamole
guacamole-0.9.2.egg-info
hpmudext.cpython-35m-x86_64-linux-gnu.so
html5lib
html5lib-0.999.egg-info
httplib2
httplib2-0.9.1.egg-info
idna
idna-2.0.egg-info
janitor
jinja2
Jinja2-2.8.egg-info
jwt
LanguageSelector
language_selector-0.1.egg-info
language_support_pkgs.py
louis
louis-2.6.4.egg-info
lsb_release.py
lxml
lxml-3.5.0.egg-info
mako
Mako-1.0.3.egg-info
markupsafe
MarkupSafe-0.23.egg-info
matplotlib
matplotlib-1.5.1.egg-info
matplotlib-1.5.1-nspkg.pth
mpl_toolkits
networkx
networkx-1.11.egg-info
numexpr
numexpr-2.4.3.egg-info
numpy
numpy-1.11.0.egg-info
NvidiaDetector
oauthlib
oauthlib-1.0.3.egg-info
Onboard
onboard-1.2.0.egg-info
orca
padme
padme-1.1.1.egg-info
pandas
pandas-0.17.1.egg-info
pcardext.cpython-35m-x86_64-linux-gnu.so
pexpect
pexpect-4.0.1.egg-info
PIL
Pillow-3.1.2.egg-info
pip
pip-8.1.1.egg-info
pkg_resources
plotly
plotly-1.9.5.egg-info
problem_report.py
ptyprocess
ptyprocess-0.5.egg-info
pyasn1
pyasn1-0.1.9.egg-info
pyatspi
__pycache__
pycups-1.9.73.egg-info
pycurl-7.43.0.egg-info
pycurl.cpython-35m-x86_64-linux-gnu.so
pygobject-3.20.0.egg-info
pygtkcompat
PyJWT-1.3.0.egg-info
pylab.py
pyparsing-2.0.3.egg-info
pyparsing.py
python_apt-1.1.0.b1_ubuntu0.16.04.1.egg-info
python_dateutil-2.4.2.egg-info
python_debian-0.1.27.egg-info
python_systemd-231.egg-info
pytz
pytz-2014.10.egg-info
pyxdg-0.25.egg-info
PyYAML-3.11.egg-info
Quirks
reportlab
reportlab-3.3.0.egg-info
requests
requests-2.9.1.egg-info
scanext.cpython-35m-x86_64-linux-gnu.so
scipy
scipy-0.17.0.egg-info
sessioninstaller
sessioninstaller-0.0.0.egg-info
setuptools
setuptools-20.7.0.egg-info
six-1.10.0.egg-info
six.py
softwareproperties
speechd
speechd_config
systemd
system_service-0.3.egg-info
tables
tables-3.2.2.egg-info
UbuntuDrivers
ubuntu_drivers_common-0.0.0.egg-info
UbuntuSystemService
ufw
ufw-0.35.egg-info
unattended_upgrades-0.1.egg-info
unity_scope_calculator-0.1.egg-info
unity_scope_chromiumbookmarks-0.1.egg-info
unity_scope_colourlovers-0.1.egg-info
unity_scope_devhelp-0.1.egg-info
unity_scope_firefoxbookmarks-0.1.egg-info
unity_scope_gdrive-0.7.egg-info
unity_scope_manpages-0.1.egg-info
unity_scope_openclipart-0.1.egg-info
unity_scope_texdoc-0.1.egg-info
unity_scope_tomboy-0.1.egg-info
unity_scope_virtualbox-0.1.egg-info
unity_scope_yelp-0.1.egg-info
unity_scope_zotero-0.1.egg-info
unohelper.py
uno.py
UpdateManager
urllib3
urllib3-1.13.1.egg-info
usbcreator
usb_creator-0.3.0.egg-info
wheel
wheel-0.29.0.egg-info
xdg
xdiagnose
xdiagnose-3.8.4.1.egg-info
xkit
xkit-0.0.0.egg-info
xlsxwriter
XlsxWriter-0.7.3.egg-info
yaml
_yaml.cpython-35m-x86_64-linux-gnu.so
This solved it for me:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
try use virtualenv for every specific project not messing with ubuntu subsystem.
I got this error on WSL Ubuntu and the most upvoted solution didn't work for me.
The one that works:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py --force-reinstall
Thanks #s_s.411
I solve this problem with the following commands:
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3
type pip3
hash -r
pip3
I ran into the same problem, on Ubuntu 16.04, using the system python 3.5.2 like you, with pip installed via apt (sudo apt install python3-pip) like you, having installed some packages in my home directory with pip3 install --user like you (documented in your chat with hoefling).
The solution was as follows:
Temporarily move away all packages installed with pip3 install --user:
mv ~/.local/lib/python3.5/site-packages{,_backup}
This made pip3 work again, but of course I wanted to keep the packages. (Note: just moving out setuptools was not enough; I am not sure which constellation of packages caused this.)
Install an upgraded pip into home directory:
pip3 install --upgrade --user pip
Now the pip3 command fails (ImportError: cannot import name 'main') because it's still called from the old /usr/bin/pip3 location in the current shell, as indicated by type pip3. To solve this, run:
hash -r
Alternatively, you can always fall back to typing python3 -m pip instead of pip3.
Restore the packages:
mv ~/.local/lib/python3.5/site-packages{_backup/*,}
rmdir ~/.local/lib/python3.5/site-packages_backup
Now pip was working, but python3 -m 'import setuptools' failed with the same exception you saw, AttributeError: '_NamespacePath' object has no attribute 'sort'. This could be solved by uninstalling, then reinstalling the setuptools package in my home directory (uninstalling alone was not enough):
pip3 uninstall setuptools
pip3 install --user --upgrade setuptools
Finally, pip3 and the python3 -c 'import setuptools' are fine.
No module named 'pip._vendor.packaging'
The solution for me was to uninstall the system pipenv (installed with the package manager, pacman), and install pipenv from pip (which is managed with pyenv):
pip install pipenv
I no longer have issues when running pipenv install.
I tried all fixes on this page and it didn't work, finally I found out my virtualenv was broken and I had to reinstall the virtualenv like so
deactivate - deactivate first to be safe
virtualenv --python=/usr/bin/python3.8 /path/to/my_virtualenv_python3
source /path/to/my_virtualenv_python3/bin/activate - activate the env egain
Of course replace /path/to/my_virtualenv_python with your own path and python3.8 with a custom version of python if you don't use version 3.8 :)
Also please note this may or may not remove already installed packages, so just reinstall every requirements.txt you need afterwards.
I also have same problem and I solved it by this command.
pip uninstall pkg-resources==0.0.0
I use an old virtualenv version, it is OK.
The old version is 15.1.0.
I had a similar issue with Debian 11, my Debian has been updated to major releases several times and it looks like some files were not removed. I had to clean them:
# remove pip
sudo apt purge python3-pip
# check that the files don't belong to any package
dpkg -S /usr/share/python-wheels/* /usr/share/python-support/private/*
# remove the files
sudo rm -rfv /usr/share/python-wheels/ /usr/share/python-support/private/
# remove old files since Python is now 3.9
rm -rfv ~/.local/lib/python3.7/
# reinstall pip
sudo apt install python3-pip
And pip worked again.

Cannot install sent2trash with pip

I tried to install send2trash with pip and got the following error message:
$ pip install send2trash
Collecting send2trash
Downloading Send2Trash-1.3.0.tar.gz
Building wheels for collected packages: send2trash
Running setup.py bdist_wheel for send2trash
Stored in directory: /Users/kylefoley/Library/Caches/pip/wheels/15/76/b3/a81bb5d0bfc6157d1e5df52d34cbea6ffe8a0fc6fea83bddb0
Successfully built send2trash
Installing collected packages: send2trash
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 646, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 310, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/send2trash'
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
When I try to import the module i get the following error message:
ModuleNotFoundError: No module named 'send2trash'
Maybe the problem is that I'm using Python 3 and the pip installed it into Python 2.7. I don't know how to install send2trash so that python 3 uses it.
Update:
Hi Marekful, Thanks for trying to help me out. I tried your suggestions but they did not work
$ sudo pip install send2trash
Password:
The directory '/Users/kylefoley/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/kylefoley/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting send2trash
Installing collected packages: send2trash
Successfully installed send2trash-1.3.0
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Admins-MacBook-Pro-2:~ kylefoley$ sudo -H pip install send2trash
Requirement already satisfied (use --upgrade to upgrade): send2trash in /Library/Python/2.7/site-packages
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I had the same problem. It was indeed due to the fact that send2trash was downloaded in the python2.7 folder.
(Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (18.0)).
I just went into this folder and copied the two folders named send2trash and Send2Trash-1.5.0.dist-info into the similar path corresponding to the python3.7 version:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Now it works for me. Hope this helps.
Later edit:
To install a module in a certain version of Python on Linux and Mac OS X use the -m switch in the command line:
python2 -m pip install SomePackage # default Python 2
python2.7 -m pip install SomePackage # specifically Python 2.7
python3 -m pip install SomePackage # default Python 3
python3.4 -m pip install SomePackage # specifically Python 3.4
Build succeeds but install fails due to permission problems.
OSError: [Errno 13] Permission denied:
'/Library/Python/2.7/site-packages/send2trash'
Run the command with sudo:
Admins-MacBook-Pro-2:~ kylefoley$ sudo pip install send2trash
Use pip3 instead of just pip to run pip on python 3.*
First update your package index:
sudo apt update
If you have not installed pip on python 3 yet, do this:
sudo apt install python3-pip
If you have already installed pip on python 3, update it:
pip3 install --upgrade pip
Then install send2trash:
pip3 install send2trash

Python 3 pip upgrade from 7.1.2 to 8.0.1 fails

pip says that I shall consider an upgrade. When I'm doing so and using
python -m pip install --upgrade pip
I get the following UnicodeDecode error message:
C:\Users\Sören>python -m pip install --upgrade pip
Collecting pip
Using cached pip-8.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 7.1.2
Exception:
Traceback (most recent call last):
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_install.py", line 673, in uninstall
for path in pip.wheel.uninstallation_paths(dist):
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\wheel.py", line 512, in unique
for item in fn(*args, **kw):
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\wheel.py", line 531, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1619, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\Users\Sören\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1616, in get_metadata
return self._get(self._fn(self.egg_info, name)).decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 22366: invalid start byte
You are using pip version 7.1.2, however version 8.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I'm running Python 3 in the 32-bit version on a Windows 10 machine. I don't know if that has anything to do with it, but I had VisualStudio, version 10, installed on my system. Now it is removed.
Kind regards
John
Thanks blackpingus, your answer helped me to find the problem.
The problem was the 'ö' character, which is the name, I am using on Windows. Because of that, this name is also placed in the system path.
A workaround for that problem is to install the package using another user account, which has not any 'umlaute' in his name.
To install updated pip
From start, find the "Command Prompt
Right click on "Command Prompt"
Run as Administrator
Provide the user name and the password if prompted
Now you can upgrade pip: python -m pip install --upgrade pip

Resources