[MacPorts] #59789: explicit execution of pip3.7 results in pip from python 2.7
MacPorts
noreply at macports.org
Sun Dec 1 23:11:59 UTC 2019
#59789: explicit execution of pip3.7 results in pip from python 2.7
---------------------------+-------------------------------------
Reporter: duaneellissd | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.2
Resolution: | Keywords: python3.7 pip3.7 pip2.7
Port: |
---------------------------+-------------------------------------
Comment (by ryandesign):
Replying to [ticket:59789 duaneellissd]:
> I am new to Macports, but very familiar with python on linux etc.
Welcome!
> I have a new Mac (Catalina) purchased Nov 2019 (with a real Escape key!)
I'm very jealous :)
> Then tried to install some packages in the system provided "python3.7"
via pip.
I'm not sure if you can install modules into the system- (Apple-)provided
Python, due to system integrity protection, read-only system volumes and
so on. And even if it does work (i.e. if they end up getting installed to
a writable non-system location such as somewhere in /Library) I'm not sure
if it's a good idea. If you want to install python modules for use
globally, MacPorts can do that for you; we have thousands of Python
modules available. (You can search for "py-" on our
[https://ports.macports.org/ports/category/python/ ports web site].) If a
module isn't available for what you want, it's usually easy for us (or
you, with a pull request) to add one.
On the other hand, if you want to install separate copies of Python
modules locally into your own Python-based projects (in a "virtual env",
if I remember the term correctly), then using pip for that is probably
fine.
> At the command line if I type: "pip3.7 install PACKAGE" - I would
expect to have the package installed in Python 3.7 as provided and came
with my Mac, or at least the Python3.7 version that comes with MacPorts
>
> Instead - it redirects to Python2.7
>
> For example: 'pip3.7 install roku' - actually installs the 2.7
version.
>
> 'python3.7 -m pip install roku' works and installs the package into
Python 3.7
>
> Example command output:
> {{{
> duane at Duanes-MacBook-Pro ~ % which pip3.7
> /usr/local/bin/pip3.7
> }}}
I don't know where you got this pip3.7, but it wasn't from MacPorts, so I
can't tell you why it's doing what it's doing. MacPorts installs into
/opt/local by default, not /usr/local, and having things in /usr/local
while using MacPorts will cause conflicts and confusion; see
wiki:FAQ#usrlocal. Perhaps you installed those things with Homebrew, which
does put things in /usr/local in some circumstances, as far as I know. If
you would like to continue using MacPorts, then I suggest you remove
whatever you put in /usr/local before continuing. If you put them there
with Homebrew, follow their uninstallation instructions.
--
Ticket URL: <https://trac.macports.org/ticket/59789#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list