Errors while installing modules using Pip - python

I'm facing this issue when I was trying to install matplotlib library using pip.
Then I found out that this error still occurs even when I try to install other libraries.
My python installation path -
C:\Program Files\Python38\python.exe
I did this - PS C:\Users\mihir> pip install matplotlib
Using the admin mode inside Windows Terminal. Still shows the same when I run in CMD prompt in admin mode.
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\pip.exe\__main__.py", line 7, in <module>
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "c:\program files\python38\lib\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 "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 17, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
from pip._internal.index.collector import LinkCollector
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_internal\index\collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\html5lib\__init__.py", line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\html5lib\html5parser.py", line 6, in <module>
from . import _inputstream
File "C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\html5lib\_inputstream.py", line 10, in <module>
from pip._vendor import webencodings
ImportError: cannot import name 'webencodings' from 'pip._vendor' (C:\Users\mihir\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\__init__.py)```<br>

You must have inadvertently upgraded your system pip (probably through something like pip install pip --upgrade)
If so, you will need to reinstall pip:
pip uninstall matplotlib
pip install matplotlib

Reinstalling the whole Python Interpreter helped me!

Related

OSError: /usr/lib/libyara.so: cannot open shared object file: No such file or directory

I have some issue trying to run Volatility 3 Framework.
git clone https://github.com/volatilityfoundation/volatility3.git
cd volatility3/
python3 vol.py ../ramdumps/1289.raw windows.pslist.PsList
I got this error traceback:
Volatility 3 Framework 2.0.0
Failed to import '/usr/lib/libyara.so'
PATH = /home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/user/go/bin;/usr/lib
Traceback (most recent call last):
File "vol.py", line 10, in <module>
volatility3.cli.main()
File "/home/user/Documents/volatility3/volatility3/cli/__init__.py", line 625, in main
CommandLine().run()
File "/home/user/Documents/volatility3/volatility3/cli/__init__.py", line 229, in run
True) # Will not log as console's default level is WARNING
File "/home/user/Documents/volatility3/volatility3/framework/__init__.py", line 127, in import_files
ignore_errors)
File "/home/user/Documents/volatility3/volatility3/framework/__init__.py", line 152, in import_file
importlib.import_module(module)
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 "/home/user/Documents/volatility3/volatility3/framework/plugins/yarascan.py", line 17, in <module>
import yara
File "/home/user/.local/lib/python3.6/site-packages/yara/__init__.py", line 7, in <module>
from yara.rules import compile
File "/home/user/.local/lib/python3.6/site-packages/yara/rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "/home/user/.local/lib/python3.6/site-packages/yara/libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "/usr/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libyara.so: cannot open shared object file: No such file or directory
Someone already had the same error a few years ago but none of the answers worked for me.
I'm using python 3.6.9 and Xubuntu 18.04.6
You have to uninstall yara with pip. Only tara-python must be installed.
Did you install the requirements with
pip3 install -r requirements.txt
?

Python Pip Error When Installing Dependencies

I am trying to install the following dependencies:
appdirs==1.4.3
click==6.7
Flask==1.0
itsdangerous==0.24
Jinja2==2.10.1
MarkupSafe==1.0
packaging==16.8
prometheus-client==0.0.19
pyparsing==2.2.0
Werkzeug==0.15.3
But no matter which dependency I try to install I get the following error:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==19.3', 'console_scripts', 'pip')()
File "/usr/lib/python3.8/site-packages/pip/_internal/main.py", line 45, 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/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 28, in <module>
from pip._internal.self_outdated_check import (
File "/usr/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py", line 15, in <module>
from pip._vendor.six import ensure_binary
ImportError: cannot import name 'ensure_binary' from 'six' (/usr/lib/python3.8/site-packages/six.py)
What is the issue?
Posting this answer here specifically for people that use Manjaro Linux (where the use of pip is not recommended as it can break one's environment if not used correctly). It can also result in subsequent distro updates to not happen seamlessly and may result in manual intervention required.
The solution to undo the damage to the environment is to use:
sudo pacman -Syu python-pkgname --overwrite='*'
where pkgname is the name of the python dependency you want to install. After this is done, the environment should be fixed and subsequently it will not be required to apply the --overwrite option.
This whole Python 2 and Python 3 and the resulting pip2 and pip3 tools separation is insane.

dotenv not installed under Ubuntu

I'm trying to get paperless installed, and am running into an issue with dotenv under python. I've some digging, and ended up doing an uninstall of dotenv and then an install of python-dotenv via pip. I'm still running into the same error. Any help would be greatly appreciated!
Traceback (most recent call last):
File "./manage.py", line 18, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 307, in execute
settings.INSTALLED_APPS
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
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 "/var/www/paperless/paperless/src/paperless/settings.py", line 15, in <module>
from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
I'm running
Linux ubuntu 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Python 3.6.3
pip install python-dotenv returns Successfully installed python-dotenv-0.8.2
First check for dotenv with 'pip3 list'
install it if not on the list with: 'pip3 install python-dotenv'
Results:
Collecting python-dotenv
Downloading python_dotenv-0.20.0-py3-none-any.whl (17 kB)
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.20.0

Srapy startproject error - Python 3 - BashOnUbuntuOnWindows

I try to use Scrapy for the first time in a Bash On Ubuntu On Windows 10 and get this error when i start a new project:
(myvenv) mothinx#DESKTOP-4M9JDPL:~/laplanetebleue$ scrapy startproject laplanetebleue
Traceback (most recent call last):
File "/home/mothinx/laplanetebleue/myvenv/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/cmdline.py", line 128, in execute
cmds = _get_commands_dict(settings, inproject)
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes
for module in walk_modules(module_name):
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/utils/misc.py", line 71, in walk_modules
submod = import_module(fullpath)
File "/usr/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 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/scrapy/commands/version.py", line 6, in <module>
import OpenSSL
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/OpenSSL/crypto.py", line 16, in <module>
from OpenSSL._util import (
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/mothinx/laplanetebleue/myvenv/lib/python3.5/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so: cannot enable executable stack as shared object requires: Invalid argument
pip freeze:
asn1crypto==0.22.0
attrs==17.2.0
Automat==0.6.0
cffi==1.11.0
constantly==15.1.0
cryptography==2.0.3
cssselect==1.0.1
hyperlink==17.3.1
idna==2.6
incremental==17.5.0
lxml==4.0.0
parsel==1.2.0
pkg-resources==0.0.0
pyasn1==0.3.5
pyasn1-modules==0.1.4
pycparser==2.18
PyDispatcher==2.0.5
pyOpenSSL==17.3.0
queuelib==1.4.2
Scrapy==1.4.0
service-identity==17.0.0
six==1.11.0
Twisted==17.5.0
w3lib==1.18.0
zope.interface==4.4.2
Is it a problem with crypto or pyOpenSSL ? Pretty new here in python, can someone decrypt me the Traceback ?

Unable to pip install discord.py in python 3.6 on linux

I'm having trouble installing the discord.py package into python 3.6. I've installed it before, but on my other PC which had python 3.4.
The command I am using is as follows:
python3.6 -m pip install -U discord.py
I am getting an error that looks like this, but I'm not sure what it is supposed to mean. Is the library not compatible with python 3.6, or am I doing something wrong? Forgive me if it's rather obvious; I'm new to python.
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in <module>
from pip.log import logger
File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in <module>
import colorama, pkg_resources
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 1479, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in <module>
from pip.log import logger
File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in <module>
import colorama, pkg_resources
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 1479, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
try doing these steps 1 by 1.
1) Create a directory anywhere called 'discord' or whatever you want
2) Download and extract this into the directory https://github.com/Rapptz/discord.py
3) Hold down shift and right click when inside the directory with the discord.py extracted
4) Type: py setup.py
or: py setup.py install
This should install it.
You can install the package manually using pip.
1) Download discord.py from here
2) Open command prompt and type in pip install PathToThe.tar.gz/discord.py-0.16.12.tar.gz
That should be all you need to do to manually install discord.py from pip. If you can do it w/o downloading the tar.gz or .whl file you should do it that way; I'm jumping to the conclusion that something went wrong during the file download.

Categories

Resources