I am very new to python, and am having difficulty getting any packages from online to install properly. I'm pretty sure I'm doing something fundamentally wrong, but since I am new to language I am unsure of what it is. I have read through several online sources but still can't get it to work. I feel really dumb asking this, but I would greatly appreciate it if someone could walk me through how to install it starting from the point of downloading the package online. Thanks!
If your primary use case is the scipy stack, for example as a Matlab replacement. I would highly recommend using the Anaconda distribution. It is brilliant for new comers, a large majority of what you are likely after comes pre installed.
Download it here:
https://www.continuum.io/downloads#_macosx
I would recommend picking the python 3 64bit installer. A direct link to the download is here:
https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.3.0-MacOSX-x86_64.pkg
Your best bet is to use Homebrew as your general package manager and then use use it to install Pip to manage all of your python packages. Both of the links below will walk you through how to do these things.
See Homebrew link
See How to install pip on Mac for Pip
Go here and download get-pip.py
Then, from terminal run the command python get-pip.py
This should install pip for you. Pip is awesome, and you really want to have it. Now, all you have to do is run this command from terminal:
pip install matplotlib
Or to get Numpy:
pip install numpy
Related
I've been trying to install astropy and at the end of the installation I get this message:
Cannot uninstall 'numpy'. It is a distutils installed project and thus
we cannot accurately determine which files belong to it which would
lead to only a partial uninstall.
I have tried: pip uninstall numpy and then I get the same message.
I have Python 2.7.10 in a macOS High Sierra version 13.10.5
This doesn't directly answer your question, but that's because you're asking the wrong question.
Astropy requires Python 3.5 or 3.6. Trying to get it working with Apple's pre-installed Python 2.7 is a waste of time. You might be able to get an old version working this way, but not by using the installation instructions on astropy.org, and it won't be supported even if you do.
The easy solution is to just Install the latest Anaconda 5.x with Python 3.6, because it comes with Astropy built in.
The almost-as-easy solution is to install Python 3.6 from either a python.org binary installer, or Homebrew, and then use pip3 or, better, python3 -m pip to install everything, as explained on the Astropy install page.
Either way, before doing anything else, you want to get back to a clean slate. In particular, you do not want pip, or any other scripts, attached to Apple's Python 2.7; they will only cause confusion. Assuming you can't reinstall macOS from scratch, the best way to do this is:
Look in /Library/Python/2.7/site-packages and delete everything there except for README and Extras.pth.
Look in /usr/local/bin for symlinks to anything in that site-packages. (If you don't know much about using Unix, try this command: ls -l /usr/local/bin | grep 2.7.) You'll probably have pip and pip2.7 here, and probably nothing else. But whatever you have here, delete it.
Now, when you install Python 3.6, the only thing named pip anywhere will be that Python 3.6's pip. You still want to use pip3 or python3 -m pip, but if you screw up and type pip by accident, it won't break anything.
Also, you should strongly consider using a virtual environment. See the Python Packaging Authority's User Guide (or the Anaconda docs, if you went that way) for more on this.
One simple solution I found:
sudo -H pip install astropy --ignore-installed numpy
I also had this issue and couldn't get around it in a clean way, but this is what I did:
Inside the Lib folder search "numpy" for an egg_info file (eg. numpy-1.11.0.dev0_2329eae.egg-info).
In my case, this is what Pip was looking at to determine if a current version already exists. I deleted it, then ran normal
pip install numpy
and installed the newest version.
I don't recommend this because I don't understand what it's doing under the hood and it doesn't properly uninstall the old version which could be a recipe for trouble down the line, but if you're desperate like I was then maybe this is a solution for you.
I was just given a new mac and after installing pip and lcc through pip I get a command not found error when running lcc run.
When running help("modules") inside of python I can see the lcc package there.
the same goes for pip freeze
pip freeze | grep lemon
lemoncheesecake==0.15.2
I'm running out of ideas.....
maybe I messed up the pip installation because I did it first with:
python get-pip.py
and then with
sudo easy_install pip
how do I fix this?
this is my echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Thanks
From what you're saying it seems that your python installation is not quite right, and Mac's version of python is also not quite right by default, you can read more about it here: http://docs.python-guide.org/en/latest/starting/install/osx/#doing-it-right
Also, I would highly advise that when you get a brand new Mac and plan to do some development work as a rule of thumb follow these steps:
Install xcode
Install Homebrew
Then you can install anything else you want.
I think the problem is due to the fact you have more than one version of python installed. Package installed by pip are visible to one version, but not to the other. I think this issue is quite common, and has already been answered (for example) here:
Too many different Python versions on my system and causing problems
To check that this is the case:
pip show Icc
should tell you where Icc was installed.
import sys
print sys.path
should tell where python looks for modules.
I'm super new to Python, and can't figure out how to install packages or modules. I know you can use Pip to easily install them, but none of the commands I've found have done anything but give me errors. Any help would be appreciated.
Have you tried pip install? A good thing to remember is pip usually requires sudo on linux distributions. Also, for some modules it's easier to use conda, since it takes care of dependencies. It this is the best general information I can give. If you told me some packages you've tried to install, that would help a lot!
I am still pretty new to python, and I was wondering if anyone has had this problem before. I have read other threads, but I haven't seen this problem addressed yet. I need to install the GDAL module for python, and I have seen threads saying you need to install GDAL first and then it can be used on python, but I have also see others that said that conda install GDAL is enough. When I try the latter, I get this error. Any ideas?
I had the same problem two days ago trying to install GDAL on Debian Jessie.
The solution was using pygdal python package from PyPi.
Just read the instructions at PyPi and follow them, they are a bit different then one expects. In general:
install required dependencies into your system (e.g. using apt-get install libgdal1-dev
check, what version of GDAL is installed
use pip to install pygdal with a version matching the installed GDAL lib.
The last step is a bit unusual, but does the trick.
This works for Linux. For Windows my colleagues claim, there are ready made binaries, which can be installed.
I'm struggling with Pillow on my shell hosting based on FreeBSD.
Running pip install Pillow (inside virtualenv, if it does matter) results with this:
http://justpaste.it/ich2
I have absolutely no idea what's wrong. Someone knows the problem?
Ok, running installer with MAX_CONCURRENCY=1 pip install pillow did the trick.
Maybe it will be useful for someone.
Suggested way is to install from packages; they often contain patches that fix various system-specific problems. Doing "pkg search pillow" shows that you can do "pkg install py27-pillow".