I am trying to uninstall pip using this command in macOS terminal:
pip uninstall pip
The error I am receiving is:
ImportError: cannot import name 'requests'
I have tried many other commands, some unrelated to uninstalling pip such as:
pip --version
I have tried reinstalling the requests module with
pip install requests
All of them are result in the same error.
ImportError: cannot import name 'requests'
Update: I tried to restore pip to pip 9.0.3 using
pip install --upgrade pip==9.0.3
and I tried importing requests. Both resulted in the same error.
I am guessing your pip version is 10.+ . It seems to be broken for some users.
what you can do is manually install a pip package from here enter link description here.
Click on download files and download the pip-18.0.tar.gz file.
After that go to your downloads directory and expand the zipped file with a:
tar -xvf pip-18.0.tar.gz
it will expand it to a folder or dir named pip-18.0, do a:
cd pip-18.0
follow that by running the setup.py file with the following command:
python setup.py install
It will work
Related
I tried to install PyMuPDF on Python 3.9 when first I installed by pip install PymuPDF and re-checked by pip list like this"
But when I imported PyMuPDF:
ModuleNotFoundError: No module named 'PyMuPDF'
Next, I tried to install PymuPDF from doc, it said I need install MuPDF first, and install with Wheel, I tried both:
pip install C:\Users\Admin\Desktop/PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl and pip install PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl but reviced error:
yMuPDF-1.19.6-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.
What should i do to install PyMuPDF, thank you all.
PyMuPDF is available with a wheel under all Windows versions - you should have no problem at all.
But please follow this procedure:
Make sure your pip is the current one. This ensures that any changes in supported platform tags are known to pip.
Then install PyMuPDF.
So overall
py -3.10 -m pip install -U pip
py -3.10 -m pip install -U pymupdf
This should simply work!
In your script however you must do import fitz - this is the top-level name of the package.
My code starts with installing these packages -
pip3 install ipython
pip3 install selenium
pip3 install time
pip3 install parsel
pip3 install csv
but I get -
File "<ipython-input-7-cae965d78112>", line 1
conda install ipython
^
SyntaxError: invalid syntax
I have tried replacing pip3 with pip and conda, it still gives the same error.Please help me to install these packages.
thanks!!!
pip3 and conda are utilities separate to the Python programming language. pip3 and conda make it easier for users to install python packages to their machine/virtual environment which is why you get SyntaxError: invalid syntax because what you've written is not valid Python.
If you want to use pip3 or conda these commands should be used at into a terminal. These tools search online for modules you want to install, download them and install them into the appropriate location (for your user or into your virtual enviroment). If you try to install something that can't be found online in the pypi you'll get an error.
You've tried to install the module csv using pip3 install csv. The csv module is part of Python's standard library so pip3 will not find this package on pypi. Being part of the standard library means that every installation of Python has this library. To use the csv module you can do import csv in your notebook/.py file. The same goes for the module time.
I am trying to install to oct2py package to import in my python script. However whenever I run the command pip install oct2py I get the following error:
Fatal error in launcher: Unable to create process using '"c:\python37\python.exe" "C:\Program Files\Python37\Scripts\pip.exe" ': file cannot be found.
How can I install oct2py?
Found the answer
Deinstalled python and reinstalled it. I checked the environment variable and changed it from this one : 'C:\Program Files\Python39' to this one 'C:\Users\lsee\AppData\Local\Programs\Python\Python39'.
Is unable to locate your pip installer, easy fix is unusually to either upgrade or test pip :
# to upgrade your pip
python -m pip install --upgrade pip
pip --version
# test you have pip in your machine
If your pip version is showing that means you have it installed, it could be a problem activating your virtual environnement, or your path.
It says the file cannot be locate, are you sure your path for Python and pip is correct ?
Try:
python -m pip install oct2py
This should work (as python -m pip install gave not errors)
When i try to run my script, which is just those two lines:
from pytube import YouTube
YouTube('http://youtube.com/watch?v=9bZkp7q19f0').streams.first().download()
i get the error:
ImportError: cannot import name 'YouTube' from 'pytube' (unknown location)
ive used the following documentation to install pytube:
https://github.com/NFicano/pytube
but since i am using python3.8 i installed pytube3 using:
pip3 install pytube3
instead of:
pip install pytube
which does not throw errors from the module.
When double check if there is a "pytube" module directory in:
C:\Users\User\AppData\Local\Programs\Python\Python38\Lib\site-packages
if found the directory: "\pytube" inside of it
when i use: pip install pytube3
i get the output:
Requirement already satisfied: pytube3 in c:\users\User\appdata\local\programs\python\python38\lib\site-packages (9.6.4)
Requirement already satisfied: typing-extensions in c:\users\User\appdata\local\programs\python\python38\lib\site-packages (from pytube3) (3.7.4.2)
pip uninstall pytube3
pip install pytube3
Step 2 returns the filepath where pytube3 was installed. go to the folder that was returned, open "pytube/", and clear the contents of the "pycache" folder, which has all the ".pyc" files. These are not important and can be regenerated by the package whenever it is loaded.
If all of that doesn't work try doing the following pip install pytube3 --upgrade
use this:- it works for me after upgrade your pytube
pip install pytube3 --upgrade
import pytube
myVideo = pytube.YouTube('youtube's video url')
I am using Pycharm and venv, and when I run my code from pycharm it works perfectly. But as soon as I build a .exe file I get this error.
I already tried to:
install pyinstaller in the venv and create .exe file
install google-api-python-client using command line instead of in venv and tried to compile .exe
pip install --upgrade google-api-python-client
pip install --force-reinstall google-api-python-client
None of this works and after checking 'site-packages' it does include googleapiclient. Please help.