ICan't Do Anything With Pip because it won't install anything - python

Any time i try to install anything with pip i would get this type of error. I've updated my computer, updated visual studios, pip 20.0.2, python 3.8.2, and still nothing works, I've even tried reinstalling everything.
ERROR: https://i.stack.imgur.com/m8Yqv.png

You need to install PortAudio on your system to use one of the libraries you're trying to install.

try using pip3 instead of pip or check paths

Related

No module named 'cv2' issue with opencv and contrib modules

No matter what I install, it's either opencv-python, opencv-contrib-python or both at the same time, I keep getting the "No module named 'cv2'" error. I couldn't find an answer here. Some say that only opencv-python works, others say opencv-contrib-python works. I tried everything but nothing seems to work. I'm trying to use the aruco function and I know it belongs to the contrib module.
Any tip? Thanks
Did you try to restart your code editor? I often need to close the file or whole VScoode and reopen for it to see the library I just installed.
Another problem could be that you're installing cv2 to a python verse that youre not using on your code editor..
If youre using python2.9 on your code editor but you install cv2 on your terminal with "pip3.10 install opencv-python" command, your code editor wont find it
I would recommend using conda and creating a new enviroment. Then try sudo pip3 install opencv-python if youre using python3 or you can try sudo pip install opencv-python if you're using python2. This worked for me.
Another tip is to always check that you have the newest version of pip pip install --upgrade pip

pip: failed to create process. How do I fix this?

I started having this issue a while ago, when I used pip to install new things. Every time I try to use pip, my command line says: failed to create process. I have checked the system PATH for my Python folder and it seems to be correct. I have tried uninstalling and reinstalling pip several times. I reinstalled Python as well.
Pip commands do work when I put the full path to pip in the command, but I would rather just type pip whatever than pip "C:/path to it" or whatever. Anyone got any fixes or ideas?
I have checked other places where this was answered, and none of the suggestions helped.
Try this & again check path in environment
python -m pip install --upgrade pip --force-reinstall

Import "cv2" could not be resolved

I've installed python and opencv by using the correct commands in the cmd, but when I type in 'import cv2' in a python then I get the error in visual studio code and I can't find any solution online how to fix this
Import "cv2" could not be resolved Pylance (reportMissingImports)
More of the error in the terminal
ModuleNotFoundError: No module named 'cv2'
It just happened to me and I solved it installing both opencv-python and opencv-python-headless with pip and reloading the Visual Studio Code window right after it.
To install the needed packages, just run this command in the terminal:
$ pip install opencv-python opencv-python-headless
Make sure that its using the correct version of Python; e.g., I installed Python from the windows store, which is working:
However, if I use another one, it does not work:
I noticed that Visual Studio does not support the latest Python 3.8, so I had to use PyCharm as an IDE.
I had a similar issue so I installed opencv-python-headless (install opencv-python if not earlier) and reloaded the VScode window.
pip install opencv-python-headless
However, some methods like imshow() kept failing:
cv2.error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
This was resolved by installing opencv-contrib-python. You can install it by running the following code in your terminal:
pip install opencv-contrib-python
In your terminal (cmd if Windows) run the following (make sure that you're on the current working environment):
pip install opencv-python
then:
pip install opencv-python-headless
I just uninstalled the older python version and installed a new one again. That is probably the simplest and the most hassle-free one in my mind. Stick to version 3.8.8, that should do the trick. Also no worries about maintaining multiple versions of python in the system. It is indeed true that the lack of support from VS is causing this issue.
I am on a mac and struggle with this and this is the best way to do it, when ur in your .py file, on the lower left part of your vscode windown u will see the version of python you are using, click that and try different versions until your open cv command works, in my case, 3.8.8 worked for me.

get-pip.py broken on Windows 10

Get Pip (Python file from Pypa.io) on Windows 10 is not extracting on my laptop. I followed all the instructions on pypa.io - Installing, however, when I tried to execute the file, despite many attempts to fix this, it says:
ERROR: To modify pip, please run the following command: C:\Python27\python.exe -m pip
So I ran C:\Python27\python.exe -m pip and then it shows another error message:
C:\Python27\python.exe: No module named pip
I then consulted with a friend of mine, and he said that the second error message is obviously not a file error, but (me reflecting now) is quite logical. Of course it says that there is no module named pip because that was the very thing that I am trying to download. Then it occurred to me that Python must think that I already have it because it is asking me to modify pip. So I looked into this and saw that I had a pip folder but nothing inside it to do with Python.
So this made me think Why is it not downloading?
or Why does it think that I already have it?
UPDATE
The Python installer now comes with an option to install pip which should solve any further problems!
Pretty sure that I had the exact same problem as you. I am using Python 2.7.14 64-bit, and when I try to install pip using get-pip.py, I get the exact same error.
I fixed this by simply running the following command:
python -m ensurepip --default-pip
This then installed pip. This is because the version of Python I downloaded is packaged with pip.
Note that this installed pip without the wheel portion, so I then had to run:
python -m pip install --upgrade pip setuptools wheel
After that, everything was ready to go.
I just stumbled upon this very same issue. However, I am using (have to) Python 2.7.8 32-bit.
https://pip.pypa.io/en/latest/installing/ clearly states that
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org
so that my call to python -m ensurepip --default-pip did in fact result in No module named ensurepip (as I am not using >=2.7.9).
Yet I was finally able to get pip running: instead of using the latest get-pip.py at https://bootstrap.pypa.io/get-pip.py I used https://bootstrap.pypa.io/2.6/get-pip.py.
For future reference, and those who want to compare against any version of get-pip.py in https://github.com/pypa/get-pip:
29af88001263a19911c0911057cc192e ./get-pip.py did *not* work for me,
e4bd67ad4de5329bd4291e06ee3ba012 ./2.6/get-pip.py *did* work for me.
You may find it easier to install Python and Pip from the executable from python.org.
pip.pypa.io seems to make installing Python harder than it has to be. Maybe it has a special use case.
Edit:
I also recommend uninstalling the current version you have now so there are no conflicts.

How to install pip in a new python installation

I recently installed python 2.7.2 on my Mac running OSX 10.6.8. Previously, I had version 2.6. I set my path in .bash_profile as follows:
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/share/python:$PATH
so that when I run python it will refer to my new installation. It does.
I would also like to use pip with my new installation, but the problem is that I already have the current version of pip installed at
/usr/local/bin/pip.
I tried to re-install pip with:
easy_install pip
But, of course this does not put pip in the desired new directory
/usr/local/share/python/pip
but simply refers to the existing version in /usr/local/bin/pip.
Can someone tell me how to fix this?
I would like to then use pip to install NumPy and SciPy in the correct directory (I was having trouble getting the SciPy installation to work with my old version of python, hence the new install).
If you'd like, you can visit the website where I found instructions for installing python 2.7, creating/updating my .bash_profile, installing pip, and NumPy and SciPy. Might provide some insight, or I'm happy to give more details if needed. Thanks!
http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/#python
Install distribute as per the instructions at http://pypi.python.org/pypi/distribute .
Make sure you specify the full path to the python executable (/usr/local/share/python/python or smth in your case).
$ curl -O https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
$ /usr/local/share/python/python distribute_setup.py
Then you should have /usr/local/share/python/easy_install.
After that, run:
$ /usr/local/share/python/easy_install pip
Then you should have /usr/local/share/python/pip.
Depending on the ordering of things in your PATH, either your old, or the newly installed pip is executed when you execute the pip command, so you either might have to adapt your PATH, or specify the full path to /usr/local/share/python/pip when installing eggs.
(shameless plug:
In any case, you might consider using virtualenv for installing packages into a "project" specific isolated environment, as opposed to installing them globally.)
I needed to uninstall brew's python.
Then, I was left with python v2.7.6
Next to install, pip I ran
sudo easy_install pip
installed fine and working
I had a similar issue, try this:
$ python -m pip install --upgrade --force-reinstall pip
This will force reinstall pip with whatever version of python you use including installing the binary.
A few days ago I had a friend who was starting Python Programming and needed help with the same issue: installing pip. There are debates over which one to choose between easy_install and pip and it seems everybody is heading the pip direction. Either way, installing either of them can be frustrating.
You can use this simple tutorial : installing pip package manager the easy way
Here are what you should keep in mind as you follow the above guide:
If you already have an older version installed, uninstall it or totally remove the python installation
Once that is cleared, download an install Python.
After that, download ez_setup.py file and save it to your desktop - easily accessible from the command line
Now run it from the command line and it will install easy_install for you after which,
You can use it to install pip.
Once again, you can do this or use the above link to find a simple step-by-step guide on how to get it installed on your computer.
Good luck.
Just so that people knew, ATM we can install PIP by downloading get-pip.py from the page with docs and run it like this:
c:\python27\python.exe get-pip.py
BTW, Python 3.4 comes with PIP pre-installed.
One of the command line options lets you choose where to install to.
--install-dir (-d) install package to DIR
So something like - # easy_install pip -d /usr/local/share/python
(Please correct me if I'm wrong.)
Just wanted to say that I found a way to get around my problem. I don't know that I can explain it perfectly, since I am not very good at understanding what I am doing with this stuff just yet! But, the problem seems to have been with my PATH. I removed the PATH that I posted in my original question, and then used easy_install pip. It went straight to python 2.7.2 (my new version) with no problem. I then successfully used pip to install NumPy and SciPy in the correct location, and they both work. Thanks to ErikAllik and FakeRainBrigand for taking the time to look into it!

Categories