Reputation: 151
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?
Upvotes: 4
Views: 1103
Reputation: 305
Rather old question, but as I stumbled upon it, here goes:
It's rare that a macports package I install requires the installation of a macports-managed py39-whatever package but it happens. Either way, this way there is no confict.
At the end of the day, probably still best to use virtualenv for anything that has specific requirements, but at least this is a decent way to install things into your main environment.
Upvotes: 1
Reputation: 9359
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.
Upvotes: 2