Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Macports does not recognize pip-installed packages

Until today, I have been using the macports version of python27 and installing python packages through macports. Today, I needed some packages which were not available through macports; I learned about pip and found them there. After installing these packages through pip, however, I realized that neither pip nor macports could see what had been installed by the other. So, for consistency, I decided to uninstall all macports packages, install python27 and py27-pip through macports and then proceed to install all of my python packages through pip.

This worked fine, but since macports does not know about my pip-installed python packages, I ran into trouble when installing something else which depends on python (e.g., inkscape): macports tried to install its own version of, e.g. py27-numpy (already installed by pip) and then failed installation because it "already exists and does not belong to a registered port."

Is there a consistent way to use pip and to get macports to recognize that the python packages it might need for something else are already installed?

like image 488
Ben H Avatar asked Oct 16 '25 10:10

Ben H


1 Answers

The solution is: dont use Macports for installing Python's packages.

Macports is a general package manager and it registers installed packages in its database.

Pip is a package manager for Python so if you want to install Python package, use appropriate package management tool. Pip doesnt have it's own database to keep evidence about installed stuff - it just checks Python's path to see if the package is there (and that's what you want).

Sooner or later you'll use Virtualenv anyway and you'll need pip to install packages in there too so it's better to use it everywhere.

like image 157
yedpodtrzitko Avatar answered Oct 18 '25 00:10

yedpodtrzitko