How to install python-numpy on OSX using apt-get? - python

so I have tried installing numpy using Homebrew. While it said on home-brew that I successfully installed it, the program I run couldn't detect it and it recommend using apt-get.
So I got apt-get through fink, but I couldn't install numpy like I wanted to.
The most relevant answer I found online is here:
http://mrprajesh.blogspot.hk/2009/11/e-couldnt-find-package-on-apt-get.html
But it only covers linux and I am not sure how to do the same on an OSX machine. Does anyone has experience with this?
Below is the error message. Any help is appreciated.
yings-mbp:madanalysis5 yvonne$ sudo apt-get install python-numpy
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package python-numpy
yings-mbp:madanalysis5 yvonne$ sudo apt-get install update
Password:
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package update
yings-mbp:madanalysis5 Sam$

In my opinion the best way to installing numpy and scipy, is just download Anaconda, even though its large, things are compiled and just work. If you need a smaller package then get miniconda, and run "conda install numpy". If you don't care for space, just get anaconda.

Related

Why does it gives error while installing pip? [duplicate]

This question already has an answer here:
This is the result I get when trying to install pip3
(1 answer)
Closed 1 year ago.
I am getting error while installing pip. I have python 3.9.2 installed.
root#kali:~# sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-pip : Depends: python3-distutils but it is not going to be installed
Depends: python3-setuptools but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root#kali:~# ^C
enter image description here
Pip comes installed with Python 2 >=2.7.9 or Python 3 >=3.4.
First check it using:
python -m pip --version
To install it manually:
First, run this code to download get-pip.py using curl.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then, run this command in the folder that you have installed get-pip.py
python get-pip.py
It’s weird but I thought apt-get is supposed to retrieve any dependencies. Yet it tells you what it’s missing and refuses to install them. Have you tried to install the dependencies, then pip?
I’m not too familiar with apt-get but I recommend checking the error message to get to the bottom of why it refuses to install the dependencies. Your screen shot doesn’t have the whole message.
The last resort is the force install option. See if it understands --force as an argument. Note that this might put your package management system in a strange state if it isn’t already.
I’m not sure what “ig” is but I do not plan to link other social network applications to this one.

Error Install Matplotlib for Python3 on Debian 9

I'm trying to install MatPlotLib for Python3 using Debian 8. The pip3
command asks for the missing dependency: libfreetype. However, this is what happens when I try to install this package!
debnub#debhub:~$ sudo apt-get install libfreetype6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libfreetype6-dev : Depends: libfreetype6 (= 2.5.2-3+deb8u2) but 2.
6.3-3.2 is to be installed
E: Unable to correct problems, you have held broken packages.
debnub#debhub:~$
I've tried a lot of different solutions including using aptitude. Is there anything I might be missing in this case?
This was solved by running:
sudo aptitude -f install libfreetype6-dev
And then selecting no to downgrade the installed version of libfreetype6.

install HDF5 and pytables in ubuntu

I am trying to install tables package in Ubuntu 14.04 but sems like it is complaining.
I am trying to install it using PyCharm and its package installer, however seems like it is complaining about HDF5 package.
However, seems like I cannnot find any hdf5 package to install before tables.
Could anyone explain the procedure to follow?
I found that installing the libhdf5-serial-dev with
sudo apt-get install libhdf5-serial-dev
did the trick.
Search for the HDF5 library in the ubuntu package repository.
apt-cache search hdf5
The command will show the packages relating to hdf5.
install the relevant package to you.
sudo apt-get install package-name.
mostly you have to install the hdf5-tools, h5utils, python-tables.
Try to install libhdf5-7 and python-tables via apt
To be more precise, do two steps on Ubuntu
1) install hdf5
sudo apt-get install libhdf5-serial-dev
2) install pytables
pip install tables

How to `pip install` a package that has non-Python dependencies?

Many python packages have build dependencies on non-Python packages. I'm specifically thinking of lxml and cffi, but this dilemma applies to a lot of packages on PyPI. Both of these packages have unadvertised build dependencies on non-Python packages like libxml2-dev, libxslt-dev, zlib1g-dev, and libffi-dev. The websites for lxml and cffi declare some of these dependencies, but it appears that there is no way to do figure this out from a command line.
As a result, there are hundreds of questions on SO that take this general form:
pip install foo fails with an error: "fatal error: bar.h: No such file or directory". How do I fix it?
Is this a misuse of pip or is this how it is intended to work? Is there a sane way to know what build dependencies to install before running pip? My current approach is:
I want to install a package called foo.
pip install foo
foo has a dependency on a Python package bar.
If bar build fails, then look at error message and guess/google what non-Python dependency I need to install.
sudo apt-get install libbaz-dev
sudo pip install bar
Repeat until bar succeeds.
sudo pip uninstall foo
Repeat entire process until no error messages.
Step #4 is particularly annoying. Apparently pip (version 1.5.4) installs the requested package first, before any dependencies. So if any dependencies fail, you can't just ask pip to install it again, because it thinks its already installed. There's also no option to install just the dependencies, so you must uninstall the package and then reinstall it.
Is there some more intelligent process for using pip?
This is actually a comment about the answer suggesting using apt-get but I don't have enough reputation points to leave one.
If you use virtualenv a lot, then installing the python-packages through apt-get can become a pain, as you can get mysterious errors when the python packages installed system-wide and the python packages installed in your virtualenv try to interact with each other. One thing that I have found that does help is to use the build-dep feature. To build the matplotlib dependencies, for example:
sudo apt-get build-dep python-matplotlib
And then activate your virtual environment and do pip install matplotlib. It will still go through the build process but many of the dependencies will be taken care of for you.
This is sort what the cran repositories suggest when installing R packages in ubuntu.
For most popular packages, There is a workaround for recent ubuntu systems. For example, I want to install matplotlib. When you order pip install matplotlib, it usually fails because of a missing dependency.
You can use apt-get install python-matplotlib instead. For python3, you can use apt-get install python3-matplotlib

Can't upgrade Scipy

I'm trying to upgrade Scipy from 0.9.0 to 0.12.0. I use the command:
sudo pip install --upgrade scipy
and I get all sorts of errors which can be seen in the pip.log file here and I'm unfortunately not python-savvy enough to understand what's wrong. Any help will be appreciated.
The error messages all state the same: You lack BLAS (Basic Linear Algebra Subroutines) on your system, or scipy cannot find it. When installing packages from source in ubuntu, as you are effectively trying to do with pip, one of the easiest ways to make sure dependencies are in place is by the command
$ sudo apt-get build-dep python-scipy
which will install all packages needed to build the package python-scipy. You may in some cases run into the problem that the version of the source package you are trying to install have different dependencies than the version included with ubuntu, but in your case, I think chances are good that the above command will be sufficient to fetch BLAS for you, headers included.
I had the same problem upgrading from scipy 0.9 to 0.13.3, and I solved it using the following answer and installing:
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install gfortran
Make sure libatlas-base-dev and libatlas-sse2-dev are installed, it seems like it can't find your atlas library. Also, see this question:
Does Python SciPy need BLAS?
I found Adam Klein's instructions for setting up scipy (and friends) in a virtual environment very useful.
One problem I ran into (which was probably my own fault): After all was said and done, I found importing scipy still loaded version 0.9.0, not 0.12.0. The problem was that my sys.path was finding the old system version before the new version.
The fix was to make
/path/to/.virtualenvs/arthur/local/lib/python2.7/site-packages
appear before
/usr/lib/python2.7/dist-packages
in sys.path. If you have virtualenvwrapper installed, then
you can add the path using
add2virtualenv /path/to/.virtualenvs/arthur/lib/python2.7/site-packages

Categories