pip install pyqtgraph complains about missing pip._internal.vcs.mercurial module - python

I have been using PyQt6 for a while without a problem. Now I'm trying to do the exercises from a textbook, using pyqtgraph. It does not seem to come bundled with PyQt6 because the import statement failed. I tried installing it with:
pip install pyqtgraph
I tried various combinations of sudo, pip, pip3 (pip points to pip3), python/python3.8/python3.9 -m pip install pyqtgraph (python links to python3). I forced a reinstall of pip from a curl and deleted old site-package versions from .local. I even did a git clone pyqtgraph and tried to build it from scratch. Nothing worked. I always get the same error:
Traceback (most recent call last):
File "/home/richard/.local/bin/pip", line 8, in <module>
sys.exit(main())
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 68, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/commands/__init__.py", line 109, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 14, in <module>
from pip._internal.cli.req_command import (
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
from pip._internal.index.collector import LinkCollector
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/index/collector.py", line 42, in <module>
from pip._internal.network.session import PipSession
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/network/session.py", line 31, in <module>
from pip._internal.network.auth import MultiDomainBasicAuth
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/network/auth.py", line 22, in <module>
from pip._internal.vcs.versioncontrol import AuthInfo
File "/home/richard/.local/lib/python3.9/site-packages/pip/_internal/vcs/__init__.py", line 7, in <module>
import pip._internal.vcs.mercurial
ModuleNotFoundError: No module named 'pip._internal.vcs.mercurial'
I also reinstalled mercurial.
I can't find any posts on pip._internal.vcs.mercurial, although there are plenty of posts on missing pip._internal, none of which helps.

Related

Unable to install BeautifulSoup package for Python 3.10 using pip on Ubuntu 20.04

I was trying to install BeautifulSoup4 in order to learn web scraping. I was using pip to install bs4 package for Python 3.10 but I am unable to install it. Any help to resolve the below traceback error.
Note: I am using WSL2 Ubuntu 20.04
root#mascot:~# pip install bs4
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 15, in <module>
from pip._internal.index.package_finder import PackageFinder
File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 12, in <module>
from pip._vendor import html5lib, requests
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)
use pip install beautifulsoup4 instead of bs4
Currently BS4/Beautifulsoup4 is not compatible with Python 3.10 (probably will working in future)
BS4 Release was in Sep 8, 2021
https://pypi.org/project/beautifulsoup4/#history
Python 3.10 realease in: October 04, 2021
https://devguide.python.org/#status-of-python-branches
I would assume compatibility issues until BS4 will update.
Until then everything should work with 3.9 so I would go with that.

On certain conda commands error: 'Image not found'

These error messages may have been caused by an Xcode update I just did recently but I am not sure. I'm running MacOS 10.15.4.
This is the error I receive upon running conda info in my terminal.
(base) Kevin-Brysons-MacBook-Pro:~ kevinbryson$ conda info
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 84, in _main
exit_code = do_call(args, p)
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 80, in do_call
module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/cli/main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/core/index.py", line 10, in <module>
from .package_cache_data import PackageCacheData
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/core/path_actions.py", line 30, in <module>
from ..gateways.connection.download import download
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/site-packages/conda/gateways/connection/download.py", line 13, in <module>
import ctypes
File "/Users/kevinbryson/opt/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/kevinbryson/opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 2): Library not loaded: #rpath/libffi.6.dylib
Referenced from: /Users/kevinbryson/opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
Reason: image not found
`$ /Users/kevinbryson/opt/anaconda3/bin/conda info`
I am getting similar error reports upon running conda env list, but not conda list.
I have the normal anaconda3 distribution and have not seen issues like this with anaconda before. I think I can just wipe the install directory at ~/opt but I would rather not have to redo all my settings. I've seen similar issues like https://github.com/conda/conda/issues/6183 but their solutions did not work for me despite the similar situation (I tried running the conda update -c rdonnellyr -c main --all command.

ImportError: cannot import name 'ensure_str' from 'six' (/usr/lib/python3.8/site-packages/six.py)

I am receiving this error on multiple commands, similar to the problem explained in this question. But I am not even able to run it in sudo, non-sudo(if thats a thing) and also root account(I specifically logged into the root account to run this, but failed)
Here is the error I am thrown every time.
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/freeze.py", line 12, in <module>
from pip._internal.operations.freeze import freeze
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/freeze.py", line 17, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3.8/site-packages/pip/_internal/req/__init__.py", line 11, in <module>
from .req_file import parse_requirements
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_file.py", line 25, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3.8/site-packages/pip/_internal/req/constructors.py", line 28, in <module>
from pip._internal.req.req_install import InstallRequirement
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 30, in <module>
from pip._internal.operations.install.wheel import install_wheel
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py", line 33, in <module>
from pip._internal.utils.wheel import parse_wheel
File "/usr/lib/python3.8/site-packages/pip/_internal/utils/wheel.py", line 12, in <module>
from pip._vendor.six import PY2, ensure_str
ImportError: cannot import name 'ensure_str' from 'six' (/usr/lib/python3.8/site-packages/six.py)
Note : I was initially trying to install tensorflow, then other commands like pip freeze and pip uninstall some-package also threw this error.
I have already tried reinstalling pip without any errors. I am on Manjaro, so i ran
pacman -Rcn python-pip
and then
pacman -S python-pip
$ pacman -S extra/python-six did the trick!

Trying to install python-social-auth, get ImportError: No module named 'requests.packages'

Question title says it all. I'm not a Python expert, not sure where to go from here. I tried everything I could think of.
I'm using pip3 and python3 with Django 1.8.
Following instructions from https://github.com/omab/python-social-auth I did sudo pip3 install python-social-auth and all the dependencies.
Shell output:
$ python3 manage.py shell
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/usr/local/lib/python3.4/dist-packages/social/apps/django_app/default/models.py", line 8, in <module>
from social.utils import setting_name
File "/usr/local/lib/python3.4/dist-packages/social/utils.py", line 13, in <module>
from requests.packages.urllib3.poolmanager import PoolManager
ImportError: No module named 'requests.packages'
I'm not sure why the python-social-auth module tries to call requests.packages since that does not seem to exist in the "requests" module.
I solved my own problem.
sudo pip3 install requests --upgrade
Fixed it by upgrading my system's "requests" package.
this question may be getting a bunch of new visitors...
requests.packages has been removed from requests:
https://github.com/kennethreitz/requests/pull/4067
install the vendored libraries separately
pip install urllib3

ImportError: cannot import name 'certs'

I'm having this error for the last 2 days. It seems a problem with python requests library, but I've re-installed it several times with no luck.
Traceback (most recent call last):
File "project-src/bla-blah/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "project-src\env\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "project-src\env\lib\site-packages\django\core\management\__init__.py", line 354, in execute
django.setup()
File "project-src\env\lib\site-packages\django\__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "project-src\env\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "project-src\env\lib\site-packages\django\apps\config.py", line 112, in create
mod = import_module(mod_path)
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "project-src\env\lib\site-packages\social\apps\django_app\__init__.py", line 14, in <module>
from social.apps.django_app.utils import load_strategy
File "project-src\env\lib\site-packages\social\apps\django_app\utils.py", line 12, in <module>
from social.backends.utils import get_backend
File "project-src\env\lib\site-packages\social\backends\utils.py", line 2, in <module>
from social.backends.base import BaseAuth
File "project-src\env\lib\site-packages\social\backends\base.py", line 1, in <module>
from requests import request, ConnectionError
File "project-src\env\lib\site-packages\requests\__init__.py", line 58, in <module>
from . import utils
File "project-src\env\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
ImportError: cannot import name 'certs'
Maybe it's a problem with Windows 7 update from 2 days ago, because is the only thing that has changed in the last few days.
By the way, I'm using python 3.4 with virtualenv, PyCharm 3.4.1 IDE and Win7.
Inside certs.py there is the code that has the problem (last line):
try:
from certifi import where
except ImportError:
def where():
"""Return the preferred certificate bundle."""
# vendored bundle inside Requests
return os.path.join(os.path.dirname(__file__), 'cacert.pem')
This worked for me (re-install requests library):
pip uninstall requests
pip install requests
I had also the same problem last week on my Mac (Sierra). Besides, the certs.py module exists, which means that's a problem somehow related to the OS and not to Python itself. In my case, it was a problem of the max files limits, So just increase it with ulimit 200000 200000
In case you're wondering what happened with this problem... I re-installed the operating system, downloaded the git project again, re-configured the python virtualenv and 'magically' it worked. So I'm sure there was a miss-configuration somewhere, but it wasn't requests library problem.
If you have the same problem, I encourage you to install a fresh environment.

Categories