How to install logging module? [duplicate] - python

This question already has an answer here:
Unable to install logging module (Python)
(1 answer)
Closed 11 months ago.
I got this error while using 'pip install logging':
> pip install logging
Collecting logging
Using cached logging-0.4.9.6.tar.gz (96 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [32 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\__init__.py", line 18, in <module>
from setuptools.dist import Distribution
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 "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\_virtualenv.py", line 89, in exec_module
old(module)
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\dist.py", line 32, in <module>
from setuptools.extern.more_itertools import unique_everseen
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 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\extern\__init__.py", line 52, in create_module
return self.load_module(spec.name)
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\extern\__init__.py", line 37, in load_module
__import__(extant)
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\_vendor\more_itertools\__init__.py", line 1, in <module>
from .more import * # noqa
File "c:\users\asr\pycharmprojects\groupmanagerbot\venv\lib\site-packages\setuptools\_vendor\more_itertools\more.py", line 5, in <module>
from concurrent.futures import ThreadPoolExecutor
File "C:\Users\Asr\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\Asr\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 7, in <module>
import logging
File "C:\Users\Asr\AppData\Local\Temp\pip-install-e8vt44bg\logging_ae969009ecd74e96b07ddaa395b71854\logging\__init__.py", line 618
raise NotImplementedError, 'emit must be implemented '\
^
SyntaxError: invalid syntax
[end of output]
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

You don't need to pip install logging - the logging package is now part of the Python standard library. The logging package on pip is old and hasn't been used or updated for many years.

Related

AioHttp Installation: multidict module error

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.

PyCharm can't install packages: "VC 6.0 is not supported by this module"

I'm trying to configure an interpreter and install packages, but I get this error. I have previously installed and used Pycharm Community without any problems.
I tried to install via cmd and updated pip to the latest version. I tried to used the base interpreter and also create a new one.
Do anyone now an answer to this?
Collecting pandas
Using cached pandas-1.5.2.tar.gz (5.2 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error
pip subprocess to install build dependencies did not run successfully.
exit code: 1
[71 lines of output]
Collecting setuptools>=51.0.0
Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting Cython<3,>=0.29.32
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting oldest-supported-numpy>=2022.8.16
Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
Collecting numpy==1.21.6
Using cached numpy-1.21.6.zip (10.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
[40 lines of output]
Traceback (most recent call last):
File "C:\Users\Wiltsu\venv\lib\python3.10\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
main()
File "C:\Users\Wiltsu\venv\lib\python3.10\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\Wiltsu\venv\lib\python3.10\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
File "C:\Users\Wiltsu\venv\lib\python3.10\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
File "C:\msys64\mingw64\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 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
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 887, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Wiltsu\AppData\Local\Temp\pip-build-env-0ws0et5_\overlay\lib\python3.10\site-packages\setuptools\__init__.py", line 242, in <module>
monkey.patch_all()
File "C:\Users\Wiltsu\AppData\Local\Temp\pip-build-env-0ws0et5_\overlay\lib\python3.10\site-packages\setuptools\monkey.py", line 99, in patch_all
patch_for_msvc_specialized_compiler()
File "C:\Users\Wiltsu\AppData\Local\Temp\pip-build-env-0ws0et5_\overlay\lib\python3.10\site-packages\setuptools\monkey.py", line 162, in patch_for_msvc_specialized_compiler
patch_func(*msvc9('find_vcvarsall'))
File "C:\Users\Wiltsu\AppData\Local\Temp\pip-build-env-0ws0et5_\overlay\lib\python3.10\site-packages\setuptools\monkey.py", line 149, in patch_params
mod = import_module(mod_name)
File "C:\msys64\mingw64\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 887, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Wiltsu\AppData\Local\Temp\pip-build-env-0ws0et5_\overlay\lib\python3.10\site-packages\setuptools\_distutils\msvc9compiler.py", line 295, in <module>
raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
pip subprocess to install build dependencies did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.

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.

How to fix ImportError "_psutil_linux" on Heroku

I need psutil in my code but I get the error "importError _psutil_linux" on Heroku
it's for a status application on the use of the system and what's left of free.
I've already tried:
- to force the installation with pip (not work)
- to change the version with the file requirements.txt (not work)
requirements.txt :
Unidecode==1.0.22
youtube_dl==2018.7.21
chardet==3.0.4
urlextract==0.8.3
feedparser==5.2.1
requests==2.18.4
setuptools==40.2.0
aiohttp==1.0.5
urllib3==1.22
discord.py==0.16.12
psutil==5.4.7
pip==9.0.3
pyparsing==2.2.0
Pillow==5.3.0
beautifulsoup4==4.6.3
httplib2==0.11.3
imgurpython==1.1.7
keyboard==0.13.2
google_api_python_client==1.7.4
pyfiglet==0.7.5
pylast==2.4.0
r6sapi==0.8.0
raven==6.9.0
raven_aiohttp==0.7.0
tabulate==0.8.2
typing==3.6.6
my use of psutil :
import psutil
CPU = psutil.cpu_percent()
RAM =psutil.virtual_memory().percent
(in a discord bot command.)
Traceback (most recent call last):
File "/app/cogs/owner.py", line 65, in load
self._load_cog(module)
File "/app/cogs/owner.py", line 946, in _load_cog
mod_obj = importlib.import_module(cogname)
File "/app/.heroku/python/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 "/app/cogs/cyvgeneral.py", line 7, in <module>
import psutil
File "lib/psutil/__init__.py", line 100, in <module>
from . import _pslinux as _psplatform
File "lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux'
I expect Psutil to load correctly.
thank you in advance.

Categories