I downgraded Pip from the most recent version using sudo python -m pip install pip==18.0 --upgrade, and now I am receiving the following error when running pip/pip3, including when trying to re-upgrade it using pip3 install --upgrade pip
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in \<module\>
from pip.\_internal import main
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/__init__.py", line 42, in \<module\>
from pip.\_internal import cmdoptions
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/cmdoptions.py", line 16, in \<module\>
from pip.\_internal.index import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/index.py", line 14, in \<module\>
from pip.\_vendor import html5lib, requests, six
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/__init__.py", line 25, in \<module\>
from .html5parser import HTMLParser, parse, parseFragment
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/html5parser.py", line 8, in \<module\>
from . import \_tokenizer
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_tokenizer.py", line 16, in \<module\>
from .\_trie import Trie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/__init__.py", line 3, in \<module\>
from .py import Trie as PyTrie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/py.py", line 6, in \<module\>
from .\_base import Trie as ABCTrie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/\_base.py", line 3, in \<module\>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
Not sure if there's a specific reason you installed pip 18.0 as it looks incompatible with Python 3.10. It looks like in Python 3.10 collections.Mapping moved to collections.abc.Mapping. I would suggest just completely uninstalling pip and reinstalling, without using pip to do so.
In general, you should try to use the latest version of pip.
Related
This is the full error message.
Traceback (most recent call last):
File "C:\Users\adi\OneDrive\Desktop\Python310\machine learning project.py", line 3, in <module>
import streamlit as st
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\__init__.py", line 70, in <module>
from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\delta_generator.py", line 19, in <module>
from streamlit import cursor, caching
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\cursor.py", line 18, in <module>
from streamlit.scriptrunner import get_script_run_ctx
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\__init__.py", line 16, in <module>
from .script_runner import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 35, in <module>
from streamlit.state import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\__init__.py", line 27, in <module>
from .session_state_proxy import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\session_state_proxy.py", line 24, in <module>
from streamlit.type_util import Key
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\type_util.py", line 22, in <module>
import pyarrow as pa
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\pyarrow\__init__.py", line 65, in <module>
import pyarrow.lib as _lib
I am working with streamlit for a project but can't work out this problem.
I have tried uninstalling and reinstalling streamlit but that did'nt help.
i using python 3.8
Uninstalling and re-installing solved the issue for me:
pip uninstall pyarrow
pip install pyarrow
I think I messed things up by changing the Python version in my Conda environment.
You need to install pyarrow
python3 -m pip install pyarrow
Check these 2 things(worked for me) -
1-If you have changed your python version recently, uninstall all libraries then install.(can be done easily by pip uninstall -r requirements.txt -y & then pip install -r requirements.txt -y
2- If you have installed pyarrow in a different environment.
I am quite new to programming so don't be mad if I get something wrong.
I updated pip to its latest version (something like 21.x.x) and I tried to install the Detectron2 Git repo.
But anything related with pip (even when checking its version) I get the following Traceback:
Traceback (most recent call last):
File "/Users/user/opt/anaconda3/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 8, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 9, in <module>
from pip._internal.utils.logging import get_indentation
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 14, in <module>
from pip._internal.utils.misc import ensure_dir
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 29, in <module>
from pip._internal.locations import get_major_minor_version, site_packages, user_site
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
from . import _distutils, _sysconfig
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/exceptions.py)
Is there a solution for my problem?
I also tried downgrading to an earlier version but as I said any comment with pip inside gives me this Traceback...
If anyone out there can help me I would be so grateful!
I was having the same error after upgrading to pip 20.x.x, there is a solution on GitHub(https://github.com/pypa/pip/issues/5599) which helped me to understand the problem, but it doesn't help me. So let's come to the solution
Solution
Manually remove or delete the pip file and pip-20.2.4-py3.7.egg-info file from the directory, which in your case is located in /Users/user/opt/anaconda3/lib/python3.7/site-packages and for some it's in /home/user/anaconda3/lib/python3.7/site-packages.
Now use conda remove --force pip to completely remove pip from your system.
Finally, use conda install -c anaconda pip to install pip in your anaconda environment.
For me, it worked, hope it will work for you too
best of luck
I was trying to install matplotlib but first I had to install pip in MobaXterm and I think something failed.
I did:
python -m ensurepip
apt-get install python3-pip
Here I didn't want to, but I closed MobaXterm.
Then I tried starting again and I got:
Found package python3-pip
Package python3-pip is already installed, skipping
But then, when I try to install matplotlib:
pip3 install matplotlib
And I got:
Traceback (most recent call last):
File "/bin/pip3", line 7, in <module>
from pip import main
File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3.4/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip._vendor import pkg_resources, six
File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 36, in <module>
import plistlib
File "/usr/lib/python3.4/plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "/usr/lib/python3.4/xml/parsers/expat.py", line 4, in <module>
from pyexpat import *
ImportError: No such process
Thank you and sorry, I'm really not an experienced programmer.
I have the Anaconda distribution of Python 2.7 and I needed to install the Jupyter notebook package. During the installation process my computer turned off and after that I couldn't continue with the process. I tried to uninstall Jupyter and try installing it again, but I keep getting the same error:
Traceback (most recent call last):
File "C:\Users\Acer\Anaconda\Scripts\ipython-script.py", line 3, in <module>
from IPython import start_ipython
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 22, in <module>
from IPython.core.completer import IPCompleter
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\core\completer.py", line 71, in <module>
from IPython.utils import generics
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\utils\generics.py", line 8, in <module>
from simplegeneric import generic
ImportError: No module named simplegeneric
What should I remove/add in order to make it work?
You need to install the python package simplegeneric. After you install it, you need to install the next package that you fail to import. Continue this process until you dont get any import errors.
I tried to help('modules') and there was no nose module.
I even tried pip install nose, sudo pip install nose, and etc..
When ever I tried to install nose with command line, it will throw out
SyntaxError: invalid syntax.
Traceback (most recent call last):
File "C:\Python34\plot_cluster_iris.py", line 31, in <module>
from sklearn.cluster import KMeans
File "C:\Python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "C:\Python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module>
from ..utils import check_random_state, as_float_array
File "C:\Python34\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array, check_arrays, safe_asarray,
File "C:\Python34\lib\site-packages\sklearn\utils\validation.py", line 17, in <module>
from .fixes import safe_copy
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
from .testing import ignore_warnings
File "C:\Python34\lib\site-packages\sklearn\utils\testing.py", line 36, in <module>
from nose.tools import assert_equal
What should I do?
I think your pip3 and python3 versions are mismatched, possibly due to multiple versions of Python 3 installed.
Run pip3 --version to find the exact Python version that pip3 is associated with and the location of site-packages directory.
Then, run python3 and look at the location of site-packages using:
import site
site.getsitepackages()
If you see different directory locations then that's your problem - multiple versions of Python 3. If it is indeed the problem, remove both the versions, re-install the correct one and then install your packages.
I hope this helps!