This question already has answers here:
Getting "Permission Denied" when running pip as root on my Mac
(6 answers)
Error after upgrading pip: cannot import name 'main'
(32 answers)
Closed 3 years ago.
Command pip doesn't work without sudo
I was happily using pip with sudo but I have read here that I shouldn't do that.
However, when I try to use pip without sudo I get this:
[souto#~]$ pip install <package-name>
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I have tried James Sullivan's tip so my .bash_history file has the content below but to no avail.
[souto#~]$ cat .bash_aliases
alias pip=/usr/bin/pip
I am working on WSL, in case this is relevant.
Related
This question already has answers here:
Installing pip is not working in python < 3.6
(6 answers)
Closed 2 years ago.
Im trying to install the numpy package with python3 (python --version returns Python 3.5.2), but it doesnt work. Somebody can help me please with this problem? When i use the command
pip install numpy
, the terminal return to me
Traceback (most recent call last):
File "/home/fabricio/.local/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
I've tried install using Python2.7 but it was dreprecation
You have, mysteriously, a version of pip that is using f-strings, such as f"ERROR: {exc}", even though f-strings were not introduced until Python 3.6. Furthermore, recent versions of NumPy support Python 3.7 and above.
Try installing a more recent version of Python3, activating a virtual environment, and installing with python3 -m pip install numpy.
Python 3.5 is also EOL as of 2020-09-30.
This question already has answers here:
Error after upgrading pip: cannot import name 'main'
(32 answers)
Closed 3 years ago.
I am not expert in Ubuntu, so i need your help that will make my day.
I have several versions of python on my machine because i'am working with odoo several odoo framewrok versions, after installing odoo 10 which works on Python 2.7. I am deleting it and i have this issue when reinstalling.
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
How can i resolve that issue?
NOTE
When i write type pip in terminal i get this location pip is /home/autoparts/.local/bin/pip. I thougt the pip location is not as the error above.
Any help will be appricated.
Check out this topic on Github Pip 5447
They offered two ways as mentioned below:
We solved this issue by clear hash in bash:
$ hash -d pip
Or in dash (sh):
$ hash -r pip
Or
In this case, the particular issue seems to be:
pip3 install --user --upgrade pip installs pip 10 in the user site, but doesn't uninstall the system site copy of pip.
User runs the system wrapper from /usr/bin/pip3 which is from the OS-supplied pip 8. This wrapper expects to see pip 8, but it doesn't because user site takes priority over system site.
The solution is to use the pip wrapper installed when you installed pip 10 in --user. That will mean changing your PATH to put that first, or using an explicit path when you invoke pip.
This question already has answers here:
ModuleNotFoundError: No module named 'requests' but it's installed?
(2 answers)
Closed 1 year ago.
I know similar questions have been asked before but I couldn't find the solution to my problem.
I am getting the following error message after trying to import requests:
C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe C:/Users/Jm/PycharmProjects/Test/Test_001
Traceback (most recent call last):
File "C:/Users/Jm/PycharmProjects/Test/Test_001", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I only have one version of python installed and python -m pip install requests is saying all the requirements are already satisfied.
Run this code:
C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe -m pip install requests
This forces the installation directory to your python install.
This gives a much different effect than simply python -m pip install requests
As #Daniel Scott mentioned before use the command mentioned above or below
$: path-to-your-python-command -m pip install name-of-module
If you are using linux/mac then you can find path-to-your-python command using:
$: which python3
/usr/bin/python3
Lets say your python is installed here /usr/bin/python3 and the module you are installing is requests. Then you can use:
$: /usr/bin/python3 -m pip install requests
This question already has answers here:
Python 3: ImportError "No Module named Setuptools"
(22 answers)
Closed 8 years ago.
So I am completely unfamiliar with python and wanted to install pymysql.
This is the actual command I typed in cmd and the response I got:
C:\>d:\python27\python d:\pymysql\setup.py install
Traceback (most recent call last):
File "d:\pymysql\setup.py", line 2, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
I have python 2.7.8 and MySQL 6.x
I followed the instructions from here.
I haven't tried to search for the error message but have not found anything. Maybe some of you guys can help?
Install setuptools from here first, and then try to install pymysql again.
This question already has answers here:
No module named pkg_resources
(38 answers)
Closed 8 years ago.
In order to run Pelican, I installed python2.7 and modified first line of file /usr/bin/pelican-quickstart
from:
#!/usr/bin/python
to
#!/usr/bin/env python
when I type pelican-quickstart an error occured:
Traceback (most recent call last):
File "/usr/bin/pelican-quickstart", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I found "pkg_resources" is in this directory:
/usr/lib/python2.6/site-package/
I'm wondering if I have to install some packages after python2.7 is installed?
or, how can I solve this problem.
The problem must be an issue with your setup tools, try the following:
pip install --upgrade setuptools
pip install --upgrade distribute
If this solution doesn't work, you can check the following answer
You said
/usr/lib/python2.6/site-package/
but should be
/usr/lib/python2.6/site-packages/