how can I install pip in python 3.10 - python

I am having trouble to install pip on new PC.
However, it doesn't work
I have run
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ sudo python get-pip.py
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/commands/list.py", line 166, in run
for d in get_environment(options.path).iter_installed_distributions(
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/metadata/__init__.py", line 85, in get_environment
return select_backend().Environment.from_paths(paths)
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/metadata/__init__.py", line 63, in select_backend
from . import pkg_resources
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/metadata/pkg_resources.py", line 8, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3277, in _initialize_master_working_set
tuple(
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3278, in <genexpr>
dist.activate(replace=False)
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2785, in activate
declare_namespace(pkg)
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2284, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2217, in _handle_ns
loader.load_module(packageName)
File "/usr/lib/python3/dist-packages/mpl_toolkits/__init__.py", line 2, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 77, in <module>
__import__('pkg_resources.extern.packaging.requirements')
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
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 672, in _load_unlocked
File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
File "/usr/lib/python3/dist-packages/pkg_resources/extern/__init__.py", line 43, in load_module
__import__(extant)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
collections.MutableMapping.register(ParseResults)
AttributeError: module 'collections' has no attribute 'MutableMapping'

Related

pip freeze throws an exception

I am using Python 3.11.0 on Windows 10. I was able to successfully create a virtual environment with a requirements file. My pip.ini has references to my company's repository.
When I ran pip freeze it threw an exception.
My minimal requirements file is as follows:
asc-security-python
derf-api-catalog
flask
flask-restx
gevent
openpyxl
pandas
pytest
pytest-xdist
requests-negotiate-sspi
sqlalchemy-pyodbc-mssql
waitress
xlsxwriter
The detailed steps are as follows:
%USERPROFILE%\Python\python -m venv %USERPROFILE%\envs\MyEnv
%USERPROFILE%\envs\MyEnv\Scripts\activate
cd %USERPROFILE%\MyProject
pip install -r myrequirements.txt
pip freeze
The exception thrown is as follows:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\johndoe\envs\MyEnv\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
from pip._internal.build_env import get_runnable_pip
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\build_env.py", line 20, in <module>
from pip._internal.cli.spinners import open_spinner
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\cli\spinners.py", line 9, in <module>
from pip._internal.utils.logging import get_indentation
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\utils\logging.py", line 29, in <module>
from pip._internal.utils.misc import ensure_dir
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\utils\misc.py", line 41, in <module>
from pip._internal.exceptions import CommandError
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_vendor\requests\__init__.py", line 149, in <module>
from . import packages, utils
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\pip\_vendor\requests\utils.py", line 24, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
^^^^^^^^^^^^^^^
File "C:\Users\johndoe\envs\MyEnv\Lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johndoe\Python\Lib\contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "C:\Users\johndoe\Python\Lib\importlib\resources\_common.py", line 80, in _tempfile
os.write(fd, reader())
^^^^^^^^
File "C:\Users\johndoe\Python\Lib\importlib\resources\abc.py", line 76, in read_bytes
with self.open('rb') as strm:
^^^^^^^^^^^^^^^
File "C:\Users\johndoe\Python\Lib\importlib\resources\_adapters.py", line 141, in open
raise FileNotFoundError("Can't open orphan path")
FileNotFoundError: Can't open orphan path
Is there a fix for the issue that will allow me to generate a detailed requirements.txt showing all dependencies?

ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory

When running a project via pipenv, I get the following stacktrace. As I typically do not work with pipenv and cookiecutter projects, I have been struggling to fix it. Any help is appreciated. In case it matters, it is this project that I am trying to build and launch.
➜ project-shop git:(master) ✗ pipenv run ./manage.py runserver
[2022-11-04 13:08:19,329 autoreload] INFO: Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/user/miniconda3/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/user/miniconda3/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 "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django_elasticsearch_dsl/__init__.py", line 5, in <module>
from .documents import Document # noqa
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/django_elasticsearch_dsl/documents.py", line 8, in <module>
from elasticsearch.helpers import bulk, parallel_bulk
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/elasticsearch/__init__.py", line 36, in <module>
from .client import Elasticsearch
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 23, in <module>
from ..transport import Transport, TransportError
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/elasticsearch/transport.py", line 26, in <module>
from .connection import Urllib3HttpConnection
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/elasticsearch/connection/__init__.py", line 20, in <module>
from .http_urllib3 import Urllib3HttpConnection, create_ssl_context
File "/home/user/.local/share/virtualenvs/project-shop-d1PiLiCc/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 18, in <module>
import ssl
File "/home/user/miniconda3/lib/python3.7/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory
add :
deb http://security.ubuntu.com/ubuntu xenial-security main
in /etc/apt/source.list
then ==> apt-get update ,
apt install libssl1.0.0

ImportError raised when trying to load 'rest_framework.templatetags.rest_framework'

Good morning, I have django 4.2 and djangorestframework 3.13.1, if I enable it in installed_aps I get the following error, I don't know if it's because of the django version or some dependency.
Anyone know what might be happening?
Thank you
Enabling it in settings.py is where the error occurs
Settings.py
DJANGO_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'rest_framework',
]
The djangorestframework installs fine with the dependencies it needs, the installed versions appear in the pip list
pip list
asgiref 3.5.2
Django 4.2.dev20220721050550 /home/legacy/Documentos/proyectos/dtsc/django
django-debug-toolbar 3.5.0
djangorestframework 3.13.1
importlib-metadata 4.12.0
Pillow 9.2.0
pip 22.2.2
psycopg2-binary 2.9.3
pytz 2022.2.1
setuptools 60.9.3
sqlparse 0.4.2
wheel 0.37.1
zipp 3.8.1
Error
python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 69, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 129, in get_package_libraries
module = import_module(entry[1])
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
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 69, in __getitem__
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 129, in get_package_libraries
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
module = import_module(entry[1])
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 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/legacy/Documentos/proyectos/dtsc/lib/python3.9/site-packages/rest_framework/templatetags/rest_framework.py", line 12, in <module>
from rest_framework.renderers import HTMLFormRenderer
File "/home/legacy/Documentos/proyectos/dtsc/lib/python3.9/site-packages/rest_framework/renderers.py", line 17, in <module>
from django.http.multipartparser import parse_header
ImportError: cannot import name 'parse_header' from 'django.http.multipartparser' (/home/legacy/Documentos/proyectos/dtsc/django/django/http/multipartparser.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/commands/runserver.py", line 134, in inner_run
self.check(display_num_errors=True)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/base.py", line 475, in check
all_issues = checks.run_checks(
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/checks/registry.py", line 89, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/contrib/admin/checks.py", line 78, in check_dependencies
for engine in engines.all():
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 94, in all
return [self[alias] for alias in self]
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 94, in <listcomp>
return [self[alias] for alias in self]
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 85, in __getitem__
engine = engine_cls(params)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 25, in __init__
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/legacy/Documentos/proyectos/dtsc/lib/python3.9/site-packages/rest_framework/templatetags/rest_framework.py", line 12, in <module>
from rest_framework.renderers import HTMLFormRenderer
File "/home/legacy/Documentos/proyectos/dtsc/lib/python3.9/site-packages/rest_framework/renderers.py", line 17, in <module>
from django.http.multipartparser import parse_header
ImportError: cannot import name 'parse_header' from 'django.http.multipartparser' (/home/legacy/Documentos/proyectos/dtsc/django/django/http/multipartparser.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/legacy/Documentos/proyectos/dtsc/observatorio/manage.py", line 22, in <module>
main()
File "/home/legacy/Documentos/proyectos/dtsc/observatorio/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/commands/runserver.py", line 74, in execute
options["libraries"] = self.get_templatetag_libraries(libraries)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 43, in get_templatetag_libraries
super().execute(*args, **options)
libraries = get_installed_libraries()
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/base.py", line 448, in execute
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 117, in get_installed_libraries
output = self.handle(*args, **options)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/commands/runserver.py", line 111, in handle
return {
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 117, in <dictcomp>
self.run(**options)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/core/management/commands/runserver.py", line 118, in run
return {
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 106, in get_template_tag_modules
autoreload.run_with_reloader(self.inner_run, **options)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/utils/autoreload.py", line 680, in run_with_reloader
for name in get_package_libraries(pkg):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 131, in get_package_libraries
raise InvalidTemplateLibrary(
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'rest_framework.templatetags.rest_framework': cannot import name 'parse_header' from 'django.http.multipartparser' (/home/legacy/Documentos/proyectos/dtsc/django/django/http/multipartparser.py)
start_django(reloader, main_func, *args, **kwargs)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/utils/autoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/utils/autoreload.py", line 343, in run
autoreload_started.send(sender=self)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/dispatch/dispatcher.py", line 176, in send
return [
File "/home/legacy/Documentos/proyectos/dtsc/django/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/autoreload.py", line 43, in watch_for_template_changes
for directory in get_template_directories():
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/autoreload.py", line 16, in get_template_directories
for backend in engines.all():
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 94, in all
return [self[alias] for alias in self]
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 94, in <listcomp>
return [self[alias] for alias in self]
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/utils.py", line 85, in __getitem__
engine = engine_cls(params)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 25, in __init__
options["libraries"] = self.get_templatetag_libraries(libraries)
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 117, in get_installed_libraries
return {
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 117, in <dictcomp>
return {
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 106, in get_template_tag_modules
for name in get_package_libraries(pkg):
File "/home/legacy/Documentos/proyectos/dtsc/django/django/template/backends/django.py", line 131, in get_package_libraries
raise InvalidTemplateLibrary(
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'rest_framework.templatetags.rest_framework': cannot import name 'parse_header' from 'django.http.multipartparser' (/home/legacy/Documentos/proyectos/dtsc/django/django/http/multipartparser.py)

pipenv install django failed on ubuntu

I tried to install django in my vscode, but the output is like this
(my ubuntu version is 20.04),is there something wrong with my ubuntu or my python?
pipenv install djangoTraceback (most recent call last):File "/usr/bin/pipenv", line 6, in <module>from pkg_resources import load_entry_pointFile "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 3254, in <module>def _initialize_master_working_set():File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 3237, in _call_asidef(*args, **kwargs)File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 3266, in _initialize_master_working_setworking_set = WorkingSet._build_master()File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 584, in _build_masterws.require(_requires_)File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 901, in requireneeded = self.resolve(parse_requirements(requirements))File "/usr/lib/python3/dist-packages/pkg_resources/_init_.py", line 787, in resolveraise DistributionNotFound(req, requirers)pkg_resources.DistributionNotFound: The 'pathlib' distribution was not found and is required by pipenv
I tried use this
`sudo pip install --upgrade pip`
but i got this
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)

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 ?

Categories

Resources