How do I fix pip on replit? - python

Whenever I run a command related to pip, or pip itself, it just returns an exception and it doesn't install anything
Here's the exception info:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/configuration.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir, enum
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 38, in <module>
from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/__init__.py", line 522, in <module>
from pip._vendor.tenacity._asyncio import AsyncRetrying
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/_asyncio.py", line 19, in <module>
from asyncio import sleep
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
future = tasks.async(future, loop=self)
I was running pip commands to install libraries on replit (because upm doesn't work well), but after uninstalling discord.py, it doesn't seem to work properly anymore

from my experience it is much better to use the pip module instead of the executable.
python3 -m pip install --upgrade pip # upgrade pip
python3 -m pip install replit # install the desired module

Related

eth-brownie installation fails

I tried installing eth-brownie and when I execute brownie --version in terminal I get this
File "/Users/yourlogarithm/Library/Python/3.9/bin/brownie", line 5, in <module>
from brownie._cli.__main__ import main
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/__init__.py", line 6, in <module>
from brownie.project import compile_source, run
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/project/__init__.py", line 3, in <module>
from .main import ( # NOQA 401
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/project/main.py", line 44, in <module>
from brownie.network import web3
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/network/__init__.py", line 4, in <module>
from .account import Accounts
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/network/account.py", line 37, in <module>
from .rpc import Rpc
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/network/rpc/__init__.py", line 16, in <module>
from brownie.network.state import Chain
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/network/state.py", line 23, in <module>
from .transaction import TransactionReceipt
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/brownie/network/transaction.py", line 15, in <module>
import black
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/black/__init__.py", line 13, in <module>
import regex as re
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/__init__.py", line 1, in <module>
from .regex import *
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/regex.py", line 419, in <module>
import regex._regex_core as _regex_core
File "/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/_regex_core.py", line 21, in <module>
import regex._regex as _regex
ImportError: dlopen(/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/_regex.cpython-39-darwin.so, 2): no suitable image found. Did find:
/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/_regex.cpython-39-darwin.so: code signature in (/Users/yourlogarithm/Library/Python/3.9/lib/python/site-packages/regex/_regex.cpython-39-darwin.so) not valid for use in process using Library Validation: Trying to load an unsigned library
I followed the installation guide from here: https://eth-brownie.readthedocs.io/en/stable/install.html
Fixed it by reinstalling regex via pip:
Type in console pip uninstall regex
Type pip install regex

Using virtualenv in VSCode gives ImportError: cannot import name 'appdirs' but normal terminal does not

When using virtualenv in VSCode integrated terminal I get the following error when trying to use pip or pip3
Traceback (most recent call last):
File "/home/me/repo/py-hello/venv/bin/pip3", line 5, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
File "/usr/lib/python3/dist-packages/pip/_internal/locations.py", line 19, in <module>
from pip._internal.utils import appdirs
File "/usr/lib/python3/dist-packages/pip/_internal/utils/appdirs.py", line 13, in <module>
from pip._vendor import appdirs as _appdirs
ImportError: cannot import name 'appdirs' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)
However, this isn't the case when using a regular terminal. I can run pip fine.
I found a few mentions in other posts here and here but neither are helping me.

I can't run ipython and when i try to run it i get syntax error

ipython
Traceback (most recent call last):
File "/home/arvin/.local/bin/ipython", line 5, in <module>
from IPython import start_ipython
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/__init__.py", line 55, in <module>
from .core.application import Application
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/core/crashhandler.py", line 27, in <module>
from IPython.core import ultratb
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/core/ultratb.py", line 116, in <module>
from IPython.utils import path as util_path
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/utils/path.py", line 17, in <module>
from IPython.utils.process import system
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/utils/process.py", line 19, in <module>
from ._process_posix import system, getoutput, arg_split, check_pid
File "/home/arvin/.local/lib/python3.8/site-packages/IPython/utils/_process_posix.py", line 23, in <module>
import pexpect
File "/usr/lib/python3/dist-packages/pexpect/__init__.py", line 75, in <module>
from .pty_spawn import spawn, spawnu
File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 14, in <module>
from .spawnbase import SpawnBase
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 224
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
^
SyntaxError: invalid syntax
async is a python keyword used for coroutines, so you cannot use it normally like a variable. Try changing that line (which should be line 224 in your program) to
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False):
I got the same error after installing Python 3.8
$ ipython
[ . . . ]
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
^
SyntaxError: invalid syntax
Upgrading pexpect as suggested in this answer solved the issue for me:
sudo apt-get remove python-pexpect python3-pexpect
sudo pip3 install --upgrade pexpect

Python ImportError: cannot import name HeaderParsingError when running pip upgrade in virtualenv

Inside the python virtual environment I am unable to install anything via pip.
This is the command I run:
pip install --upgrade pip
The error output:
ImportError: cannot import name HeaderParsingError
The whole traceback is as shown below:
(env)root#ali-Lenovo-G50-80:/home/ali# pip install --upgrade pip
Traceback (most recent call last):
File "/home/ali/env/bin/pip", line 7, in <module>
from pip import main
File "/home/ali/env/local/lib/python2.7/site-packages/pip/__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/home/ali/env/local/lib/python2.7/site-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/home/ali/env/local/lib/python2.7/site-packages/pip/download.py", line 22, in <module>
from pip._vendor import requests, six
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 58, in <module>
from . import utils
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/compat.py", line 7, in <module>
from .packages import chardet
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .connection import (
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 41, in <module>
from .util import (
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py", line 5, in <module>
from .response import is_fp_closed
File "/home/ali/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py", line 4, in <module>
from ..exceptions import HeaderParsingError
ImportError: cannot import name HeaderParsingError
Any help please?

In centos - No module named lazy_object_proxy while executing prospector library for python

After installing prospector by using pip install prospector, I execute this command.
prospector --version
I got this error
Traceback (most recent call last):
File "/home/ec2-user/ingestion/acadenv/bin/prospector", line 7, in <module>
from prospector.run import main
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/run.py", line 8, in <module>
from prospector import blender, postfilter, tools
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/tools/__init__.py", line 7, in <module>
from prospector.tools.pylint import PylintTool
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/tools/pylint/__init__.py", line 6, in <module>
from pylint.config import find_pylintrc
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/pylint/config.py", line 48, in <module>
from pylint import utils
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/pylint/utils.py", line 39, in <module>
from astroid import nodes, Module
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/nodes.py", line 39, in <module>
from astroid.node_classes import (
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 24, in <module>
import lazy_object_proxy
ImportError: No module named lazy_object_proxy
Moreover I have executed pip install lazy_object_proxy but this does not solve the problem also.

Categories

Resources