Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#59789 closed defect (invalid)

explicit execution of pip3.7 results in pip from python 2.7

Reported by: duaneellissd Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port:

Description

I am new to Macports, but very familiar with python on linux etc.

I have a new Mac (Catalina) purchased Nov 2019 (with a real Escape key!)

Installed: "Mac ports" - (new install on Dec 1 2019)

Then tried to install some packages in the system provided "python3.7" via pip.

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@Duanes-MacBook-Pro ~ % 
duane@Duanes-MacBook-Pro ~ % 
duane@Duanes-MacBook-Pro ~ % which pip3.7
/usr/local/bin/pip3.7
duane@Duanes-MacBook-Pro ~ % pip3.7 -V
pip 19.3.1 from /Library/Python/2.7/site-packages/pip-19.3.1-py2.7.egg/pip (python 2.7)
duane@Duanes-MacBook-Pro ~ % 
duane@Duanes-MacBook-Pro ~ % python3 -m pip -V
pip 19.0.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)

Change History (4)

comment:1 in reply to:  description Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to 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 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@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.

comment:2 Changed 5 years ago by duaneellissd

I don't have HOMEBREW installed.

duane> I have a new Mac (Catalina) purchased Nov 2019 (with a real Escape key!) Ryan> I'm very jealous :)

I won't mention the TB3+ CalDig docking station, I can confirm it drives 2 external 4K monitors at full resolution (yes, 3 screens!)

Back to the issue at hand...

I *think* - I see a similarity... based on timestamps

The timestamps for these *MATCH* or are near, some other tools I installed elsewhere from "Espressif" (they make a low power embedded micro controller that does bluetooth and wifi) and Visual Studio for MAC - maybe it was a combination of these that caused this.

FYI - pip3.7 - comes from Xcode.

 python3 -m pip -V    
pip 19.0.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
duane@Duanes-MacBook-Pro ~ % 

which I also installed around the same time.

I think it is something else that caused this... and thus I would suggest closing this ticket.

comment:3 Changed 5 years ago by jmroot (Joshua Root)

Resolution: invalid
Status: newclosed

OK. Make sure that /opt/local/bin is listed first in your PATH if you want commands there to be found by your shell instead of ones in /usr/local/bin. Also note that for pip to be available with MacPorts Python 3.7, you have to install the py37-pip port.

comment:4 Changed 5 years ago by mf2k (Frank Schima)

Keywords: python3.7 pip3.7 pip2.7 removed
Note: See TracTickets for help on using tickets.