get-pip.py broken on Windows 10 - python

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.

Related

Using VSCode on Mac, can't get Python 3.8 to run, only Python 2.7.16

I just downloaded VSCode on my Mac as well as Python and pip. I downloaded the latest version of Python via VS Microsoft extensions and installed pip using Python -m ensurepip --upgrade. I have python 2.7.16 on my Mac as well, I believe from my OS (it's not something I downloaded). I am trying to use pip and Python in VSCode. I have my interpreter in my virtual environment set to Python 3.8.2, and I created the virtual environment using "python3 -m venv .venv". However, every time I check the python version (with Python --version) in the terminal, it returns Python 2.7.16. I check the pip version, and there is no command found. When I check the pip3 version, I get back the following warning:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
pip 21.3.1 from /Users/username/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)
Whenever I run Python -m pip or Python -m pip3, it returns "no module named pip".
When installing Python, I got a warning that Python 3 was not on the PATH, but it did not fix the issue when I tried to add the path. Unfortunately, I don't have much experience adding a path so I may have done that incorrectly.
Finally, I installed streamlit via pip3. It resulted in the following message but seemed to install. However, it could not be resolved when I tried to import streamlit in my code.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
Defaulting to user installation because normal site packages is not writeable
How do I add Python 3 to my PATH and ensure that VSCode runs Python 3 instead of 2?
Simply always refer 'python3' rather than 'python'.
python3 --version
python3 -m pip install blahblahblah

getting python pyobcd installed

I'm a little lost on how to get pyodbc installed in my computer.
I have python 3.6.1
The link
http://support.esri.com/en/technical-article/000011656
pointed me to another link
https://github.com/mkleehammer/pyodbc
Which is vague.
I'm used to downloading and running an exe for install.
This link is unclear and says all I have to do is:
"pip install pyodbc"
What exactly do I need to do to get this working?
Since you have not mentioned which OS you are using,
I will assume that you are on windows (as you have mentioned that you are used to install using .exe).
Firstly you need to know what a pip is:
pip is basically a package manager for python packages used to install 3 rd party packages which do not bundle along with the python distribution.
On linux pip comes pre installed also if you are using python version 3.4 onwards or python 2.7.9 you will be having pip pre installed on your system.
All you have to do it to open the command prompt issue the command
pip install package-name(pyobdc here)
it will do the job.
If you do not find pip in your distribution you can refer this link
How do I install pip on Windows?
open cmd in your computer and type
pip install pyobdc
Hello there and welcome to python programming. Basically python comes with its package installer so either you can go to any interpreter that you are using and type pip install pyobdc or use the command prompt in windows and type in pip install pyobdc. This would install your module and just remember to put import pyobdc at the top of the code if you want to use this package. Further information can be found on here

Error installing ipdb for Python 2.7 using virtualenv and pip

When I tried to install ipdb, I had the following problem:
$ pip install ipdb
Collecting ipdb
Using cached ipdb-0.10.3.tar.gz
Complete output from command python setup.py egg_info:
error in ipdb setup command: Invalid environment marker: python_version >= "3.3"
How can I install ipdb in the simplest way?
(I use macOS Sierra 10.12.4, virtualenv 1.11.6, python 2.7.10, pip 9.0.1)
My problem was solved by installing a previous version of ipdb:
$ pip install ipdb==0.10.2
I see your answer, and it's valid I'd also like to add a little bit more.
The issue had occurred because you're using python 2.7 and the most recent version of ipdb has packages that require python 3+.
Instead of specifying a version you could do the following
python2 -m pip install ipdb
Most times you can do this and your version will be recognized and the apropriate packages will be installed (Ie, what's compatible).
Though this isn't always the case it works more often than not.
pip install ipdb==0.10.2
Is also acceptable as you're specifying the version number of the package its self. I will however point out that in this case you can use 0.10.3 with python 2.7; it's installed and works fine for me. There were packages related to ipdb that required higher versions of python but had checks put in place to install other versions which were compatible with both python 2.7. and the latest version of ipdb.
update:
Even the official documentation says it's supported. Maybe you're missing something that wasn't pulled? check the requirements to verify everything was installed right.
It's likely when you installed it the first time (when it originally failed) the required packages that were also brought in were for the wrong version.
In which case you'd need to remove them as well as it would be trying to used the cached versions of them instead of pulling the appropriate ones. Or at least that's a possibility.
I just replicated your problem myself (although fwiw I was using Python 3.5). pip install -U ipdb failed with exactly the same error you reported.
What worked for me was to explicitly upgrade ipython first (pip install -U ipython, although perhaps in your case it needs to be installed for the first time). Then ipdb (re)installed just fine.

Problems with installing matplotlib in python 3.6

I'm trying to teach myself python, and I feel out of my depth. To start, I am working on a mac which already comes with python 2.7 installed.
I installed python 3.6 recently and have been using it to teach myself the basics. I'd like to eventually learn how to produce mathematical plots in python, and I know I will need the matplotlib package to do that.
Following some advice online, I was told that python3 already comes with pip installed, which is what I thought I should use to install matplotlib. The advice said I should type the following into the mac terminal:
python3.6 -m pip install matplotlib
I typed this, and it seemed like the package was installing, but I ended up getting some sort of error code that said:
Command "python setup.py egg_info" failed with error code 1 in [folder].
I tried opening IDLE and typing "import matplotlib", but I got the error: "no module named matplotlib". I also tried typing "import matplotlib.pyplot as plt", but I got the same error.
Based on further research and this youtube video, I've decided to just install miniconda in order to have access to the matplotlib package.
The problem is, I'm not sure if I should somehow be uninstalling whatever was installed when I ran the code above to install matplotlib. I've actually run that line of code 3 or 4 times. Should I remove anything before installing miniconda? Also, I am running python 3.6, while miniconda is listed on the website as being for python 3.5. Does this mean it won't work for my version of python?
Running pip like that would install packages system-wide. I'm guessing it's failing because you're not running as root (i.e. the administrator user). But wait! Don't try again as root! Instead of installing packages, do it in a virtual environment. First create it:
virtualenv myenv
This creates a directory called myenv with a bunch of stuff in it (so make note of where you run this command). Whenever you want to use the virtual environment (like straight away!) you first need to activate it:
. myenv/bin/activate
Don't miss out that dot (followed by a space) at the beginning! As the other answer says, the first thing you should do in it is upgrade pip:
pip install --upgrade pip
Now you're ready install whatever else you like:
pip install matplotlib
One last note: The virtual environment is tied to a particular Python version. By default it uses the system's Python 2.7 installation, so to use a different one you need to specify it when you create the virtual environment, like this (if that Python version is installed system-wide):
virtualenv -p python3.5 myenv
Or like this (if that Python version is not installed system-wide):
virtualenv -p /path/to/my/installation/of/python3.5 myenv
While the virtual environment is activated, you don't need to specify the particular path/version of Python. Just run it like this:
python
I also encountered many problems during my installation.
It seems that version 2 of matplotlib is not compatible with Python version 3.
Finally, I succeeded by specifying version 3 of matplotlib as follows with the following command:
sudo apt-get install python3-matplotlib
Reference from the Matplotlib website:
https://matplotlib.org/users/installing.html#building-on-linux
Try upgrade setup tools
--upgrade setuptools
or
easy_install -U setuptools
or upgrade pip
pip install --upgrade pip
I ended up downloading anaconda and using the python interpreter that comes with it, as anaconda comes with matplotlib and many other python packages of interest.
the pip command typically is for the Python 2. use pip3 instead to install the libraries in the python 3.X path
This should work
pip3 install matplotlib
The solution that work for me in python 3.6 is the following
py -m pip install matplotlib
Matplotlib files are downloaded in ~/.local/lib/python3.6/site-packages/ and not in /usr/lib/python3.6/ .
Try the command:
sudo cp -r ~/.local/lib/python3.6/site-packages/* /usr/lib/python3.6/

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