AioHttp Installation: multidict module error - python

I tried installing the AioHttp package, as seen in the extract below. The installation failed with the multidict module.
root#ava:/home/cliquant/server/ava# pip3 install aiohttp
Collecting aiohttp
Using cached https://files.pythonhosted.org/packages/ff/4f/62d9859b7d4e6dc32feda67815c5f5ab4421e6909e48cbc970b6a40d60b7/aiohttp-3.8.3.tar.gz
Complete output from command python setup.py egg_info:
*********************
* Accelerated build *
*********************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0b29nbfp/aiohttp/setup.py", line 54, in <module>
setup(**setup_kwargs)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 494, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 106, in parse_configuration
meta.parse()
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 382, in parse
section_parser_method(section_options)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 355, in parse_section
self[name] = value
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 173, in __setitem__
value = parser(value)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 430, in _parse_version
version = self._parse_attr(value)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 305, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/pip-build-0b29nbfp/aiohttp/aiohttp/__init__.py", line 5, in <module>
from . import hdrs as hdrs
File "/tmp/pip-build-0b29nbfp/aiohttp/aiohttp/hdrs.py", line 8, in <module>
from multidict import istr
ModuleNotFoundError: No module named 'multidict'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0b29nbfp/aiohttp/`
I got error when installing aiohttp with pip3.
How can I fix this?
NB: I can't find in google about it...

Google came to your aid narrowing down on the ModuleNotFoundError: No module named 'multidict'
To resolve, install the multidict module.
python3 -m pip install multidict or
pip3 install multidict
See this GitHub issue #277, and
this SO question
[Edit] For completeness, ensure you are installing in the correct environment env.
Also, check the version(s) of python installed on the system.

Related

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

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.

No module named 'backports'

I am trying to build a python project using 'make build' command but getting below error while doing that. It was working earlier but starting throwing this error recently.
Collecting backports.zoneinfo (from -r requirements.txt (line 4))
Downloading https://<ARTIFACTORY_URL>/artifactory/api/pypi/pypi-release/packages/packages/ad/85/475e514c3140937cf435954f78dedea1861aeab7662d11de232bdaa90655/backports.zoneinfo-0.2.1.tar.gz (74kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-dcqnjb0t/backports.zoneinfo/setup.py", line 26, in <module>
setuptools.setup(ext_modules=[c_extension])
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/dist.py", line 494, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 106, in parse_configuration
meta.parse()
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 382, in parse
section_parser_method(section_options)
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 355, in parse_section
self[name] = value
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 173, in __setitem__
value = parser(value)
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 430, in _parse_version
version = self._parse_attr(value)
File "/usr/src/venv/lib/python3.6/site-packages/setuptools/config.py", line 305, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'backports'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dcqnjb0t/backports.zoneinfo/
You are using pip version 9.0.1, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The package is downloaded when clicked on the artifactory link directly.
I tried installing the package separately using
pip install backports-zoneinfo
but still getting the same issue. The python version of venv is Python 3.8.8
Here is the requirements file:
gunicorn==19.9.0
MarkupSafe==1.1.1
backports.zoneinfo
flask
flake8
blinker==1.4
marshmallow==2.13.5
flasgger==0.9.2
pytest
firewall==1.1
sftpip==1.1
python-json-logger
pytest-cov
hvac
apscheduler
cryptography==2.2.2
pip list:
Package Version
------------------ ----------
appdirs 1.4.4
APScheduler 3.7.0
asn1crypto 1.4.0
attrs 20.3.0
backports.weakref 1.0.post1
backports.zoneinfo 0.2.1
.....
I did not manage to get this working, so I upgraded to python3.9. There import zoneinfo is enough...

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.

shell_plus installed with Django giving error - ImportError: cannot import name 'Type

I am getting the following error when trying to launch shell_plus after installing django_extensions. Here are the steps i followed
1-Installed django_extensions using
pip install django_extensions
2-Added django_extensions to installed apps
Then I get the following error
$ ./manage.py shell_plus
Traceback (most recent call last):
File "./manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 216, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 36, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django_extensions/management/commands/shell_plus.py", line 14, in <module>
from django_extensions.management.shells import import_objects
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django_extensions/management/shells.py", line 5, in <module>
from typing import ( # NOQA
ImportError: cannot import name 'Type'
Any suggestions on what might be going wrong ?
Python 3.5 comes with its own version of typing module. What is most likely happening is that you have the other typing module specified in your requirements (the one that doesn't include Type class) and its getting picked up by django_extensions instead of the native Python one. Check your installed modules, or try running:
pip uninstall typing

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

Categories