This question already has answers here:
What is the most compatible way to install python modules on a Mac?
(13 answers)
Closed 8 years ago.
i'm learning python from on online book and have come to the stage where the author asks the reader to install pip, virtualenv, nose, and distribute. to make it fun, he asks the reader to figure out how :-)
well, i'm an utter novice and have spent the last week trying to figure that out
on the basis of recommendation i found, i've downloaded homebrew and tried to use pip (sudo easy_install). it runs ok and says something about finishing processing dependencies.
yet when i try nosetests, i get a 'command not found'.
Edit - Zmo, i tried what you suggested and this is the result. thanks for your help.
unknown-00-25-00-47-cc-3d:~ k$ sudo /usr/bin/easy_install pip
Password:
Searching for pip
Best match: pip 1.5.4
Processing pip-1.5.4-py2.7.egg
pip 1.5.4 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
unknown-00-25-00-47-cc-3d:~ k$ sudo /usr/local/bin/pip install nosetests
Downloading/unpacking nosetests
Could not find any downloads that satisfy the requirement nosetests
Cleaning up...
No distributions at all found for nosetests
Storing debug log for failure in /Users/k/Library/Logs/pip.log
I have two requests for the community:
1) can someone help me solve this specific problem? (i use a 2009 mac with mavericks) and
2) can someone point me in the direction of some resources online where an utter novice like myself can learn about packages for python? (every resource i see assumes some level of knowledge, which i don't have).
thanks in advance,
K.
I recommend going through the tutorial and installing first "easy Install" http://pythonhosted.org/setuptools/easy_install.html and then install pip and the rest of the items with it.
Also you can follow the tutorial on (http://pip.readthedocs.org/en/latest/installing.html ) after that everything will be installed with pip itself.
PS: This question also can be useful (What is the most compatible way to install python modules on a Mac?)
anyway, as you're on OSX 10.9, run exactly what follows in the terminal:
sudo /usr/bin/easy_install pip
sudo /usr/local/bin/pip install nosetests
if you get errors here, please copy/paste them in your question as an edit
/usr/local/bin/nosetests
for the resources, please refer to leonardo's links, all I'd do is copy/paste them here (or do the same duckducking as he did).
Related
I'm running macOS 11.2.2 Big Sur and I'm trying to get pip to work with the latest Python 3.9.4. This turned out to be ridiculously difficult even though I've read a number of articles on the subject. Possibly, it is the debris I accumulated in the system over the years which is causing me trouble. I need advice as to how to get things right again.
Checklist:
/usr/local/opt/python/bin/python3 --version is Python 3.9.4 installed from brew in the most usual way; it's a symlink to ../Frameworks/Python.framework/Versions/3.9/bin/python3, which is in Cellar.
Both python and python3 commands are aliased to /usr/local/opt/python/bin/python3, they give the correct version.
I used both get-pip.py and ensurepip, and both of them say everything is fine: "Successfully installed pip-21.1.1 setuptools-56.0.0"
The only thing in env that has anything to do with Python is this part of PATH: /usr/local/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/bin. The lack of this one is reported as warning when you install pip.
Still, I get this:
python -m pip --version
/usr/local/opt/python#3.9/bin/python3.9: No module named pip
What am I missing? 🤯
I also found this article that instructs to use pyenv, but running it on the latest macOS is yet another problem: pyenv install 3.9.4 doesn't build for some reason.
Using pointers from #gold_cy in the comments I was able to resolve the problem by running get-pip.py with an additional parameter: --prefix=/usr/local/.
While the official pip installation guide does mention that there may be problems on the systems like macOS that manage their own Python install, it doesn't say directly what you can do about it. Which is a shame, because the phrasing in PyPA » Python Packaging User Guide » Tutorials » Installing Packages is exactly the same, only the last phrase is missing from pip's page:
Warning Be cautious if you’re using a Python install that’s managed by your
operating system or another package manager. get-pip.py does not coordinate
with those tools, and may leave your system in an inconsistent state. You can
use python get-pip.py --prefix=/usr/local/ to install in /usr/local which is
designed for locally-installed software.
I was trying to resolve the problem for python3 in MacOS. The accepted answer didn't help me.
What helped me is complete reinstall of the python3:
brew uninstall python3 # if python3 worked before
brew install python3
I am updating this question because the basis of the question was really in error to begin with.
If you're having issues with installing your modules, first check to see if you (like me) followed a tutorial saying to use sudo -i to install modules. This is HORRIBLE advice. HORRRR IIII BBBBLE advice. Your modules will be installed but not really accessible to the users, but then when you try to do things right, and use sudo pip install BeautifulSoup4 you'll get a message that the module is already installed. So if you know you've installed modules on your server / VPS, Linux, etc. but you can't access them, uninstall them, go to sudo -i and uninstall them, make sure that EVERYTHING. IS. CLEAN. of your modules, then go to your admin account and use sudo pip install <modules name>.
This will be MUCH better and you won't waste your time trying to figure out what you've done wrong. Most likely, what you did wrong was follow some stupid tutorial saying to install things as root# and it's messed you up from the start.
You'll need to uninstall it from your version of python 3.4.8, then reinstall it using sudo rights to do it globally.
python3 -m pip uninstall python-docx
sudo python3 -m pip install python-docx
I'm a little confused though, since in your screenshots, it shows MySQLdb as installed for python2.6, not python3.4. Are you aware of this, and is it part of your problem?
This question already has answers here:
python3 --version shows "NameError: name 'python3' is not defined"
(2 answers)
Closed 4 years ago.
everyone.
I just started to learn python, and am currently trying to add some nice additional features to Atom.
I was trying to follow the steps from the video "Setting up a Python Development Environment in Atom":
https://www.youtube.com/watch?v=DjEuROpsvp4 (just for those who are interested to know more ,starting from around 13:30.)
But I failed at installing pip autopep8. As I downloaded "pip autopep8" in Atom and typed in "pip install autopep8" at the command line in python. what I got was a warning of "invalid syntax", which lead me to nowhere to know what got wrong.
invalid syntax, installing pip autopep8
I hope someone could help me figure out what was the problem, and how could I push the installing forward. Thank you all!
Try in CMD:
pip install autopep8
Upon looking at your image, don't run pip through your IDLE, run it straight from CMD
https://i.stack.imgur.com/RH9cR.png <-- Example
Editing because I found some additional info for future users. If you're running additional versions of python on the same system (Centos for instance requires python 2 for a lot of dependencies) you can use the pip instance of a specific python install by running the following:
python3.6 -m pip install discord
As an example, python3.6 in my case was the additional instance I installed on my Centos server. Normal pip was installing packages for the Python 2 instance.
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.
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!